claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Claude Code MCP Server OAuth authentication doesn't work in SSH remote sessions

Open herculesggimenes opened this issue 6 months ago • 4 comments

Environment

  • Platform (select one):
    • [ ] Anthropic API
    • [X] AWS Bedrock
    • [ ] Google Vertex AI
    • [ ] Other:
  • Claude CLI version: 0.2.122
  • Operating System: macOS 15.4.1
  • Terminal: Iterm2

Bug Description

Claude Code MCP authentication doesn't work in SSH remote sessions.

I was testing linear MCP, and the authentication worked locally. However, when I joined through an SSH session to my Remote Development Environment using SSH, the authentication process didn't work as there was no way to access a browser remotely.

linear:
  Scope: Local (private to you in this project)
  Type: stdio
  Command: npx -y mcp-remote https://mcp.linear.app/sse
  Args:
  Environment:

These are the mcp-logs:

[
  {
    "error": "Connection failed: spawn npx -y mcp-remote https://mcp.linear.app/sse ENOENT",
    "timestamp": "2025-05-19T19:43:39.452Z",
    "sessionId": "2ef38d86-08ff-4331-b58c-91b977b6d207",
    "cwd": "/home/owner/src/..."
  }
]

When I try to connect using SSE instead of stdio, it returns 401.

The same setup worked in Cursor and the Claude desktop, since they are all local.

Steps to Reproduce

  1. Connect to a remote server using ssh
  2. Add an MCP that requires OAuth Authentication
  3. Run claude

Expected Behavior

I expect a prompt similar to AWS auth, which tries to open locally, but since it's an SSH connection, it also allows me to add the authorization token

Actual Behavior

It returned 401

Additional Context

herculesggimenes avatar May 19 '25 19:05 herculesggimenes

I'm running into similar issues setting up Linear in Cursor, and as you wrote it was working for you in Cursor, how did you set it up? I followed their instructions but get these errors as well:

config

{
  "mcpServers": {
    "linear": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.linear.app/sse"]
    }
}

errors

[info] near: Starting new stdio process with command: npx -y mcp-remote https://mcp.linear.app/sse
[info] near: Client closed for command
[info] near: Handling ListOfferings action

denisyilmaz avatar May 22 '25 06:05 denisyilmaz

I am having the same issue running Claude Code on Windows 11 in WSL on a snapdragon X-Elite laptop.

jmatser-reputable avatar Jun 02 '25 23:06 jmatser-reputable

I have a workaround for this issue with the following

  1. npm install -g mcp-remote
  2. mcp-remote https://mcp.linear.app/sse go through the auth process so it can be cached
  3. Setup mcp in claude claude mcp add linear mcp-remote https://mcp.linear.app/sse
  4. Start claude --debug code up and should see success logs

linuxlewis avatar Jun 13 '25 20:06 linuxlewis

When in doubt. MCP remote. lol unfortunately. But it seems to be getting better.

zackify avatar Jun 15 '25 22:06 zackify

Would like to see this prioritized; it's been nearly 3 months

dcieslak19973 avatar Aug 18 '25 19:08 dcieslak19973

And another month has gone by without this being addressed

dcieslak19973 avatar Sep 19 '25 16:09 dcieslak19973

And another month has gone by without this being addressed

Checks notes It's still broken. This is so annoying cuz if you're remote you think it just doesn't work. You can also just use API keys btw with this solution

claude mcp add --transport http <service-name> <service-url> --header "Authorization: Bearer <your-api-key>"

plappag avatar Nov 06 '25 10:11 plappag