CodeWhale
CodeWhale copied to clipboard
MCP Streamable HTTP transport lacks custom headers support for authentication
Problem
The McpServerConfig struct has no headers field, so HTTP-based MCP servers that require authentication headers (e.g. Authorization: Bearer <token>, X-API-Key) cannot be configured.
Multiple public MCP services require custom HTTP headers:
| Service | Required Header |
|---|---|
| Hugging Face MCP | Authorization: Bearer <HF_TOKEN> |
| GitHub MCP | Authorization: Bearer <GITHUB_TOKEN> |
| Atlassian Rovo MCP | Authorization: Basic <base64> or Authorization: Bearer <api_key> |
| Generic HTTP MCP | Authorization: Bearer <token> |
This is a standard feature across other MCP clients:
- Claude Code:
mcp.jsonsupportsheadersfield - Codex:
.codex/config.tomlsupportsenv_http_headers - OpenCode:
opencode.jsonsupportsAuthorizationfield
Proposed solution
Add an optional headers: HashMap<String, String> field to McpServerConfig, and pass them through to the StreamableHttpTransport so they are included in every HTTP request to the MCP server.
The config would look like:
{
"mcpServers": {
"myserver": {
"url": "https://api.example.com/mcp",
"headers": {
"Authorization": "Bearer ${TOKEN}"
}
}
}
}