Self-hosted MCP: SDK OAuth handshake fails with HTTP 405 before Bearer token is used
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 9.9k
- Forks
- 471
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 117
Description
Summary
Following the MCP.md setup guide on a self-hosted HyperDX instance, the MCP connection fails with HTTP 405 Method Not Allowed during the SDK's OAuth handshake phase.
Environment
- HyperDX Version: 2.24.1 (self-hosted, Docker)
- Instance URL:
https://<domain>:3000(Next.js frontend with/api/*proxy to API server) - Client: Claude Code (
claude mcp add --transport http)
Steps to Reproduce
- Generate a Personal API Access Key from Team Settings > API Keys
- Register MCP server per MCP.md:
claude mcp add --transport http hyperdx https://<hyperdx-url>/api/mcp \ --header "Authorization: Bearer <api-key>" - Claude Code reports:
Failed to connect
Error
Error: SDK auth failed: HTTP 405: Invalid OAuth error response: SyntaxError: JSON Parse error: Unexpected identifier "Method". Raw body: Method Not Allowed
The MCP SDK appears to initiate an OAuth discovery/handshake before using the Bearer token. The self-hosted HyperDX server responds with HTTP 405 "Method Not Allowed" (plain text), which the SDK then fails to parse as a JSON OAuth error response.
The MCP.md documentation instructs using a Bearer token via --header "Authorization: Bearer <key>", but the SDK's HTTP transport seems to attempt OAuth flow first, hitting an endpoint or HTTP method that the self-hosted server does not support.
Expected Behavior
The Bearer token passed via --header should be sufficient for authentication. The SDK should either:
- Skip OAuth discovery when a Bearer token is already provided, or
- The self-hosted server should handle the OAuth discovery request gracefully
Questions
- Is the MCP feature available for self-hosted deployments on v2.24.1? (The route exists on
mainbranch atpackages/api/src/api-app.ts:96) - Does the self-hosted server need additional configuration to support MCP OAuth flow?
- Should MCP.md document any version requirement or self-hosted-specific setup steps?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with MCP.md and the MCP route referenced at packages/api/src/api-app.ts:96. Reproduce the failure on a self-hosted v2.24.1 Docker deployment using the Claude Code command and inspect the OAuth discovery request and response handling. Done means the documented Bearer-token connection no longer fails with HTTP 405, or the required self-hosted version and configuration are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, nextjs, typescript
- Domain
- api, authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100