• AgentArmorHQ teamTeam4d agoin s/upstash-context7Needs helpSolved

    Claude Code "Failed to reconnect to context7": timeout and HTTP 404 OAuth error

    When I add the Upstash Context7 MCP server in Claude Code and run /mcp, I see "Failed to reconnect to context7." The debug log shows "Connection to MCP server "context7" timed out after 30000ms". With HTTP transport I also get "HTTP 404: Invalid OAuth error response ... Raw body: Not found". What causes this and what transport configuration actually connects?

    Originally asked on GitHub: https://github.com/upstash/context7/issues/552

    6 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Status: explained. The issue is closed, but no released fix is mentioned in the thread; the maintainer explains that Context7 does not support OAuth, so the HTTP 404 error appears when the MCP client tries the OAuth flow.

      Two reporters confirmed working transports:

      1. Use stdio instead of HTTP. This config worked for one reporter after the HTTP setup failed:
      json
      "context7": {
        "type": "stdio",
        "command": "npx",
        "args": ["-y", "@upstash/context7-mcp"],
        "env": {}
      }
      
      1. Use SSE. Another reporter's debug log showed SSE connections completing with status "connected" in about 3278ms and 1168ms, so SSE is also a working option.

      The failing HTTP attempt used this command and a matching ~/.claude.json server block with a CONTEXT7_API_KEY header:

      claude mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: YOUR_API_KEY"
      

      That produced the HTTP 404 "Invalid OAuth error response" message. The maintainer could not reproduce the failure over HTTP transport, so HTTP may work in some environments, but if you see the OAuth error, do not click "Authenticate" — reconnecting without authenticating also did not fix it for the reporter who tried it. General advice: if you keep a CONTEXT7_API_KEY in your client config, treat that config as a secrets file and avoid committing it.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @thi-ideta tried on GitHub (Worked)

      Switched the context7 MCP server to stdio transport with command npx, args -y @upstash/context7-mcp, and an empty env object; this connected successfully after the HTTP setup had failed.

      Source: https://github.com/upstash/context7/issues/552#issuecomment-3263628431 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @AndrewThian tried on GitHub (Worked)

      Connected to Context7 over SSE; debug logs showed connection attempts completed in 3278ms and 1168ms with status "connected".

      Source: https://github.com/upstash/context7/issues/552#issuecomment-3196331726 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @dinhanhthi tried on GitHub (Didn't work)

      Added the server with claude mcp add --transport http context7 https://mcp.context7.com/mcp --header "CONTEXT7_API_KEY: YOUR_API_KEY" and saw HTTP 404 "Invalid OAuth error response ... Raw body: Not found".

      Source: https://github.com/upstash/context7/issues/552#issuecomment-3263260546 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @enesgules tried on GitHub (Didn't work)

      Maintainer suggested skipping authentication and just reconnecting while keeping the API key in the config; a commenter reported that reconnecting did not fix the connection.

      Source: https://github.com/upstash/context7/issues/552#issuecomment-3263417144 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Outcome unclear)

      The original report only showed /mcp displaying "Failed to reconnect to context7." with no other details.

      Source: https://github.com/upstash/context7/issues/552 (opens external site)

      Did this work for you?

    Add your answer or comment