Skip to content

MCPToolset doesn't propagate auth headers to server, and provides no dynamic auth #33

@a613

Description

@a613

** Please make sure you read the contribution guide and file the issues in the
right place. **
Contribution guide.

Describe the bug

Despite passing header: { Authorization: 'Bearer abc123' } to new MCPToolset(), the MCP server rejects the request. This suggests that the MCPToolset is not passing headers to the server.

{"error":"Streamable HTTP error: Error POSTing to endpoint: {\n \"error\": \"invalid_token\",\n \"error_description\": \"Missing Authorization header\"\n}"}

That being said, it's useless to set a fixed header. We need support for dynamically choosing/generating headers on the fly so we can refresh the token and/or send additional info for requests. Here is a feature request for that: #32

To Reproduce
Steps to reproduce the behavior:

with the following tool

const mcpTools = new MCPToolset({
  url: 'https://someserver.example.com/mcp',
  type: 'StreamableHTTPConnectionParams',
  header: { Authorization: 'Bearer abc123' },
})

registered as a tool as tools: [mcpTools], run the agent and execute a query. The MCP server you aimed it at will return an error.

Expected behavior

The map of headers in header passed to MCPToolset should be propagated to the MCP server.

Screenshots
If applicable, add screenshots to help explain your problem.

Image

Desktop (please complete the following information):

  • OS: macOS 26.1
  • TS version/environment: "typescript": "^5.9.3", "node": "22.18.0", "npm": "10.9.3"
  • ADK version(see maven dependency): 0.2.1

Additional context

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions