Bug Description
When using a Streamable HTTP MCP server ("type": "http") with either headers or headersHelper in .mcp.json, Claude Code does not attach the configured headers to the HTTP requests it sends to the MCP endpoint.
Reproduction
.mcp.json config (tried both variants):
With headersHelper:
{
"mcpServers": {
"my-server": {
"type": "http",
"url": "https://example.com/api/v4.0/mcp",
"headersHelper": "./get-token.sh"
}
}
}
With static headers:
{
"mcpServers": {
"my-server": {
"type": "http",
"url": "https://example.com/api/v4.0/mcp",
"headers": {
"Authorization": "Bearer <valid-token>"
}
}
}
}
Steps to reproduce:
- Configure an HTTP MCP server that requires Bearer token auth (validated at the gateway before reaching the MCP handler)
- Run
/mcp to connect
- Call any tool
Expected behavior:
The Authorization header from headers/headersHelper should be included in every HTTP POST to the MCP endpoint.
Actual behavior:
The request reaches the server without the Authorization header, resulting in a 403 from the auth gateway.
Verification:
- The same token works when calling the endpoint directly via
curl or Postman
- The
headersHelper script produces valid output: {"Authorization": "Bearer eyJ..."}
- Server-side logs confirm the request never reaches the MCP handler (blocked at the auth gateway layer)
- Both
headers and headersHelper configurations exhibit the same behavior
Environment
- macOS (Darwin 24.6.0)
- Claude Code CLI
🤖 Generated with Claude Code
Bug Description
When using a Streamable HTTP MCP server (
"type": "http") with eitherheadersorheadersHelperin.mcp.json, Claude Code does not attach the configured headers to the HTTP requests it sends to the MCP endpoint.Reproduction
.mcp.jsonconfig (tried both variants):With
headersHelper:{ "mcpServers": { "my-server": { "type": "http", "url": "https://example.com/api/v4.0/mcp", "headersHelper": "./get-token.sh" } } }With static
headers:{ "mcpServers": { "my-server": { "type": "http", "url": "https://example.com/api/v4.0/mcp", "headers": { "Authorization": "Bearer <valid-token>" } } } }Steps to reproduce:
/mcpto connectExpected behavior:
The
Authorizationheader fromheaders/headersHelpershould be included in every HTTP POST to the MCP endpoint.Actual behavior:
The request reaches the server without the
Authorizationheader, resulting in a 403 from the auth gateway.Verification:
curlor PostmanheadersHelperscript produces valid output:{"Authorization": "Bearer eyJ..."}headersandheadersHelperconfigurations exhibit the same behaviorEnvironment
🤖 Generated with Claude Code