Repository navigation
Closed
Closed
Feature
Copy link
Labels
mcp[Component] This issues is related to MCP supportneeds review[Status] The PR/issue is awaiting review from the maintainerrequest clarification[Status] The maintainer need clarification or more information from the authorstale[Status] Issues which have been marked inactive since there is no user responsetools[Component] This issue is related to tools
Description
Description
Scenario
- Our MCP Tools are intended for internal use and rely on API calls that require a user JWT token for authentication.
- The ADK session.state can hold the JWT token, but the current implementation of MCP tools does not have direct access to the Context.
- Even if some context access is possible, there is no mechanism to propagate the JWT token from the ADK session to the MCP server context.
Impact
- MCP Tools cannot authenticate API requests on behalf of the user, blocking essential functionality.
- There is a gap between where the JWT token resides (ADK session.state) and where it is needed (MCP server context).
Text-Based Flow Diagram
+----------+ +--------------------------+ +-------------+ +--------------------+ +-------------+
| User | --> | ADK Session | --> | MCP Tool | -X->| MCP Server Context | --> | Backend API |
+----------+ | (JWT Token Stored Here) | | | | (Needs JWT Token) | | (Needs JWT) |
+--------------------------+ +-------------+ +--------------------+ +-------------+
|
|
V
Problem Area:
MCP Tool cannot pass JWT
from ADK Session to
MCP Server Context.
The "-X->" indicates the broken path.
Where Things Fall Apart
- The MCP Tool does not have a mechanism to retrieve the JWT token from the ADK Session.
- Consequently, there is no way to provide this JWT token to the MCP Server Context, which needs it to make authenticated calls to the Backend API.
Proposed solution - #1198
Reacted by Dino Chiesa, Antonio Iorga and Romaric Parmentier
Metadata
Metadata
Assignees
Labels
mcp[Component] This issues is related to MCP supportneeds review[Status] The PR/issue is awaiting review from the maintainerrequest clarification[Status] The maintainer need clarification or more information from the authorstale[Status] Issues which have been marked inactive since there is no user responsetools[Component] This issue is related to tools
Activity
Jacksunwei commentedon Jun 14, 2025
@seanzhou1023 is this something that you're working on?
pandasanjay commentedon Jun 14, 2025
Just few more context where and why we need it:
I’m developing a multi-user MAS where agents can autonomously schedule background tasks on behalf of users. To ensure secure access and prevent unauthorized usage of user resources, I’m implementing JWT tokens in the sessions at the user state level. This ensures that user identities and their conversation sessions are isolated and not confused with others.
The approach works seamlessly with ADK tools using CallbackContext or ToolContext. However, it doesn’t function as expected when applied to MCP as this information needed passed to MCP STDIO session to used as Env variable.
But for other MCP transports like Streamable HTTP,need to explore some way to pass this existing token, instead of re authenticating.
muliu commentedon Jul 15, 2025
I also have such a requestment.
The MCP Server used by the Agent requires authentication (check the Authorization Token in the HTTP header sent to the MCP Server)
Assuming I already have a Token, the question now is: In ADK, what method should I use to transfer the Token to MCP Server?
klateefa commentedon Nov 19, 2025
@pandasanjay Thanks for reporting we have noted the feature request . This feature is currently under review. Thank you for your understanding.
jeevanragula commentedon Nov 19, 2025
@klateefa Can we know if this is feature is being considered? We are also looking for the same feature where we need to pass the JWT token header to MCP Server calls.
I see in mcp_tool.py file, tool_context is not being used anywhere in this method. Is this useful to pass the request headers to MCP server tool call?
wukath commentedon Jan 15, 2026
@pandasanjay @muliu @jeevanragula We've added a
header_providerparam (https://github.com/google/adk-python/blob/main/src/google/adk/tools/mcp_tool/mcp_toolset.py#L96) that you can use to insert headers into the MCP session - it is a Callable that takes in aReadonlyContextwhere you could retrieve your JWT token.It could look something like this:
Let me know if that works for your use case?
adk-bot commentedon Jan 22, 2026
This issue has been automatically marked as stale because it has not had recent activity for 7 days after a maintainer requested clarification. It will be closed if no further activity occurs within 7 days.
adk-bot commentedon Jan 29, 2026
This has been automatically closed because it has been marked as stale for over 7 days.