Linear MCP OAuth fails with "Invalid client" — metadata-URL clientId + ephemeral loopback port
Description
Linear MCP (https://mcp.linear.app/mcp) rejects Claude Code's OAuth authorize request with:
Invalid client. The clientId provided does not match to this client.
Every new session requires re-authentication because no refresh token is ever obtained (auth never completes). Clearing mcpOAuth from the keychain, removing/re-adding the server, and revoking the app in Linear all fail to fix it.
Environment
- Claude Code: 2.1.104
- macOS 25.3.0 (Darwin)
- MCP server:
https://mcp.linear.app/mcp(http transport)
Root cause (suspected)
Claude Code uses the Client ID Metadata Document spec — sending its metadata URL as the client_id:
client_id=https://claude.ai/oauth/claude-code-client-metadata
That metadata doc declares:
{
"redirect_uris": ["http://localhost/callback", "http://127.0.0.1/callback"],
...
}
But Claude Code sends an ephemeral loopback port in the actual authorize request:
redirect_uri=http://localhost:53076/callback
Linear advertises client_id_metadata_document_supported: true and appears to do strict matching of redirect_uri against the declared list, which doesn't include a port. Per RFC 8252 §7.3, servers MUST allow any port for loopback redirect URIs — but it's ambiguous how this interacts with the Client ID Metadata Document draft.
Either:
- Claude's metadata doc should declare
http://localhost:*/callback(or equivalent port-wildcard form), or - Claude should send port-less loopback URIs, or
- Linear should honor RFC 8252's port-wildcard rule here.
Logs
From ~/Library/Caches/claude-cli-nodejs/<project>/mcp-logs-linear-server/*.jsonl:
{"debug":"No client info found"}
{"debug":"Token expired without refresh token"}
{"debug":"Authorization URL: https://mcp.linear.app/authorize?response_type=code&client_id=https%3A%2F%2Fclaude.ai%2Foauth%2Fclaude-code-client-metadata&...&redirect_uri=http%3A%2F%2Flocalhost%3A53076%2Fcallback&..."}
{"debug":"Scopes in URL: NOT FOUND"}
{"debug":"Error during auth completion: AuthenticationCancelledError: Authentication was cancelled"}
Browser lands on Linear's /authorize page showing the "Invalid client" error before the user can consent.
Steps to reproduce
claude mcp add --transport http linear-server https://mcp.linear.app/mcp/mcp→ authenticate Linear- Browser shows "Invalid client. The clientId provided does not match to this client."
Related
- #28256 — MCP OAuth token refresh not persisting (Notion) — same shape
- #5706 — Missing token refresh mechanism for MCP
- #38102, #26675 — MCP OAuth DCR/clientId handling
17 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
i am also seeing the same. Any workaround for now?
UPDATE:i just downgraded to 2.1.79 and seems it would work again, as described by #38296, i think the version 2.1.80 might have introduced the bug
Upon inspection, Claude is behaving per spec.
Per RFC
time of the request for loopback IP redirect URIs, to accommodate
clients that obtain an available ephemeral port from the operating
system at the time of the request.
If Linear is rejecting a port, then this is a Linear bug
For some additional context, we're engaging with the Linear team to see what we can do here to fix their MCP server's behavior.
Hi! We (Linear) deployed a change here, could you see if the behaviour is fixed now?
still getting error, also reported it earlier to linear support
Still relevant.
Hey folks – this seems to happen when you copy the URL from the terminal. At wrapping points space characters are getting included. Try cmd+click in terminal instead to navigate to the correct url.
This doesn't fix the issue on my end.
issue still there
I've already reinstalled, but this issue is still unresolved.
same problem, any update?
tried removing and reinstalling it, but the problem still persists.
Looks like fixed, finally unlocked claude + linear integration
yeah, this problem is fixed
Closing as this is fixed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.