Linear MCP OAuth fails with "Invalid client" — metadata-URL clientId + ephemeral loopback port

Resolved 💬 17 comments Opened Apr 13, 2026 by m-tse Closed May 23, 2026
💡 Likely answer: A maintainer (mhegazy, contributor) responded on this thread — see the highlighted reply below.

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

  1. claude mcp add --transport http linear-server https://mcp.linear.app/mcp
  2. /mcp → authenticate Linear
  3. 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

View original on GitHub ↗

17 Comments

github-actions[bot] · 3 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/37747
  2. https://github.com/anthropics/claude-code/issues/38296
  3. https://github.com/anthropics/claude-code/issues/35740

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

darrenchiu · 3 months ago

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

mhegazy contributor · 3 months ago

Upon inspection, Claude is behaving per spec.

Per RFC

The authorization server MUST allow any port to be specified at the

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

localden collaborator · 3 months ago

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.

tommoor · 3 months ago

Hi! We (Linear) deployed a change here, could you see if the behaviour is fixed now?

kcbuilder · 3 months ago
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

Invalid client. The clientId provided does not match to this client.
wongww · 3 months ago

Still relevant.

tommoor · 3 months ago

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.

inksamy · 3 months ago
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.

gnzchan · 3 months ago
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.

issue still there

breakingmind · 3 months ago

I've already reinstalled, but this issue is still unresolved.

Bovey0809 · 2 months ago

same problem, any update?

hoangman1108 · 2 months ago

tried removing and reinstalling it, but the problem still persists.

kcbuilder · 2 months ago

Looks like fixed, finally unlocked claude + linear integration

hoangman1108 · 2 months ago

yeah, this problem is fixed

localden collaborator · 1 month ago

Closing as this is fixed.

github-actions[bot] · 4 days ago

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.