-
Notifications
You must be signed in to change notification settings - Fork 310
Open
Labels
Description
Hi there 👋
I'm currently working with the Anthropic SDK + FastMCP setup, and I ran into a small limitation. Right now, it seems like the only way to pass headers to an MCP server is by using the authorization_token
field — which always gets sent as an Authorization: Bearer ...
header.
That works for authentication, but what if I just want to pass some extra context to the server? Things like:
X-Client: abc123
X-Session-ID: abc123
Right now I have to "abuse" the authorization token just to sneak in custom values, and it just a messy way to get things work.
It’d be amazing if we could pass actual custom headers through the MCP server config, directly in the BetaRequestMCPServerURLDefinitionParam
object like this:
class BetaRequestMCPServerURLDefinitionParam(TypedDict, total=False):
name: Required[str]
type: Required[Literal["url"]]
url: Required[str]
authorization_token: Optional[str]
tool_configuration: Optional[BetaRequestMCPServerToolConfigurationParam]
extra_headers: Optional[dict[str, str]] # <--- new addition
Thanks a lot in advance.
Khalid