Can't access auth when calling an agent from MCP
Hello, I am facing a problem happy to get your help! 🙂
Working with express, I have created the following MCP
The req.auth works great in tools, I have been doing something like this:
Here is where I face a problem / bug.
I am using the MCP inspector from Anthropic.
When I execute a tool, it works great with options?.extra?.authInfo.
But if I send a question to my agent "ask_postiz",
I don't get the options?.extra?.authInfo in the tool anymore.
Are there any extra steps I am missing?
9 Replies
I ended up using AsyncStorage for now
waiting for a response 🙂
Hey @Daniel Lew ! Is that something that's possible currently?
📝 Created GitHub issue: https://github.com/mastra-ai/mastra/issues/8948
GitHub
[DISCORD:1428353801869332650] Can't access auth when calling an age...
This issue was created from Discord post: https://discord.com/channels/1309558646228779139/1428353801869332650 Hello, I am facing a problem happy to get your help! 🙂 Working with express, I have cr...
hmm if I understand correctly, when you use the MCPClient and pull the tool off of the MCPServer to pass to the agent, the req.auth does not get set, is that right?
Yup
is your MCP route '/mcp/:id' getting hit when the agent executes the tool?
Yes, all the other tools get the auth, only the ask<agent> after passing to the tool is not passing so for example:
execute >> tool >> there is auth
execute >> tool (ask<name>) - which is the agent >> tool - no auth
ooh! Now I understand, when you convert the agent to a tool it doesn't work as expected. I'm getting there is probably just some context not being passed to the agent when we convert it into a tool
Does it supposed to pass the auth, or it's not how it should work? 🙂