Skip to content
This repository was archived by the owner on Apr 12, 2026. It is now read-only.
This repository was archived by the owner on Apr 12, 2026. It is now read-only.

HTTP (streamable) transport ignores httpHeaders config #166

@jimmynail

Description

@jimmynail

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions