[BUG] HTTP MCP server custom headers not being sent to server

Resolved 💬 2 comments Opened Dec 21, 2025 by liransmartlighthouse Closed Dec 21, 2025

Description

Custom headers configured for HTTP MCP servers are not being transmitted to the server, causing authentication failures.

Steps to Reproduce

  1. Configure an HTTP MCP server with custom headers in ~/.claude.json:
{
  "mcpServers": {
    "magic-patterns": {
      "type": "http",
      "url": "https://mcp.magicpatterns.com/mcp",
      "headers": {
        "X-MCP-KEY": "<api-key>"
      }
    }
  }
}
  1. Restart Claude Code
  2. Verify server shows as connected via claude mcp list:

``
magic-patterns: https://mcp.magicpatterns.com/mcp (HTTP) - ✓ Connected
``

  1. Attempt to use any tool from the MCP server
  2. Receive authentication error: Error: Authentication failed. Check your MAGIC_PATTERNS_MCP_KEY.

Expected Behavior

The X-MCP-KEY header should be sent with requests to the MCP server, allowing authentication to succeed.

Actual Behavior

The header is not sent. The server returns an authentication error.

Verification

The same request works correctly via curl:

curl -s -X POST "https://mcp.magicpatterns.com/mcp" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "X-MCP-KEY: <api-key>" \
  -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
# Returns: {"result":{"tools":[...]}}

This confirms the API key is valid and the issue is with Claude Code's HTTP MCP client not sending the configured headers.

Environment

Configuration Method

Configured via CLI:

claude mcp add-json magic-patterns '{"type":"http","url":"https://mcp.magicpatterns.com/mcp","headers":{"X-MCP-KEY":"<key>"}}'

Also tried via:

claude mcp add magic-patterns https://mcp.magicpatterns.com/mcp --transport http -H "X-MCP-KEY: <key>"

Both methods produce correct config in ~/.claude.json but headers are not transmitted.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗