Bug
The http (streamable HTTP) transport does not pass httpHeaders from the config to the MCP client. This causes authentication failures when connecting to MCP servers that require Bearer token auth (e.g., Omni).
Root Cause
In internal/mcp/client.go, the SSE transport correctly passes headers:
case "sse":
hdr := make(http.Header)
for k, v := range resolvedHeaders {
hdr.Set(k, v)
}
mcpClient, err = NewSSEMCPClientWithRetry(addressOrCommand, hdr, mcpLogger)
But the HTTP transport ignores them:
case "http":
mcpClient, err = client.NewStreamableHttpClient(addressOrCommand)
Fix
The mcp-go library (v0.43.1) already supports WithHeaders:
case "http":
headers := make(map[string]string)
for k, v := range resolvedHeaders {
headers[k] = v
}
mcpClient, err = client.NewStreamableHttpClient(addressOrCommand, transport.WithHeaders(headers))
Config
{
"mcpServers": {
"omni": {
"transport": "http",
"url": "https://example.com/mcp/https",
"httpHeaders": {
"Authorization": "Bearer ${API_KEY}"
}
}
}
}
This config works for SSE but not HTTP transport.
Bug
The
http(streamable HTTP) transport does not passhttpHeadersfrom the config to the MCP client. This causes authentication failures when connecting to MCP servers that require Bearer token auth (e.g., Omni).Root Cause
In
internal/mcp/client.go, the SSE transport correctly passes headers:But the HTTP transport ignores them:
Fix
The
mcp-golibrary (v0.43.1) already supportsWithHeaders:Config
{ "mcpServers": { "omni": { "transport": "http", "url": "https://example.com/mcp/https", "httpHeaders": { "Authorization": "Bearer ${API_KEY}" } } } }This config works for SSE but not HTTP transport.