-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
Description
Initial Checks
- I confirm that I'm using the latest version of Pydantic AI
- I confirm that I searched for my issue in https://github.com/pydantic/pydantic-ai/issues before opening this issue
Description
Issue
When using MCPServerStreamableHTTP with the headers parameter, authentication headers are not being sent with HTTP requests to the MCP server, causing authentication failures.
Code Example
from pydantic_ai.mcp import MCPServerStreamableHTTP
# Headers are not sent to the server
mcp_server = MCPServerStreamableHTTP(
url="http://localhost:8080/mcp",
headers={"x-api-key": "my-api-key"}
)Expected Behavior
Headers should be included in all HTTP requests to the MCP server, similar to how MCPServerTool handles the headers parameter in the documentation.
Question
Is this a bug, or is there a different recommended way to pass authentication headers to MCP servers using MCPServerStreamableHTTP?
Python, Pydantic AI & LLM client version
pydantic-ai version: 1.9.1
Python version: 3.13
httpx version: 0.28.1
Malachi-M