Configure and pass dynamic headers in mcp configuration #329
Replies: 2 comments 1 reply
-
The MCP SDK takes the headers when you connect to the Server, so we either need to:
Option 1 is the most sensible; if you need to do this programmatically, the best way to go is to use the AgentConfig class directly and dynamically create the servers. There's some code in The other alternative is that 0.3.0 will break out the tool calling loop to make it easier to manage your own tool calls if you want. That should be ready fairly soon. |
Beta Was this translation helpful? Give feedback.
-
This was just merged in. I'm using this feature in lieu of per request headers |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to pass header value dynamically to mcp server? So basically I need to pass bearer token for user to mcp server as each user might have different one
From what I see in documentation, mcp server configuration is loaded once and there seems to be no way to modify header information when invoking it
There is way to populate header through environment variable but its loaded only at startup and it can't be modified per request basis
Is there any other way to do this? or support needs to be added for this?
Beta Was this translation helpful? Give feedback.
All reactions