-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Feat: Dynamic authentication handling in MCPToolset from Adk ReadonlyContext.state using Callback #1198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feat: Dynamic authentication handling in MCPToolset from Adk ReadonlyContext.state using Callback #1198
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
6b9f641
to
673d387
Compare
…riable functionality - Updated test_mcp_toolset_auth.py to improve code readability and maintainability by restructuring imports and fixtures. - Added new test cases to validate the behavior of MCPToolset with both authentication and environment callbacks. - Enhanced mock setups to ensure proper isolation of tests and avoid dependency issues. - Refactored test assertions for clarity and consistency. - Updated test_mcp_toolset_env.py to rename environment transform callback for clarity and improved structure. - Ensured that tests validate the integration of environment variable extraction and injection with the MCPToolset.
afd46e2
to
f257b9a
Compare
…o_mcp_passing_env_from_adk_state
….com/pandasanjay/adk-python into stdio_mcp_passing_env_from_adk_state
Hi @seanzhou1023, Apologies for tagging you directly. I noticed you've recently reviewed several of the MCPTools. If you have a moment, could you take a look at this pull request? Your feedback would be greatly appreciated. |
Add authentication information to MCPToolset from Adk ReadonlyContext.state
This PR implements dynamic authentication handling in MCPToolset by passing authentication information (such as user-specific tokens) directly from the Adk session.state. With this approach, user tokens can be injected and sent from the ADK Context state to MCP, supporting user-specific authentication flows.
Key Improvements:
Dynamic Token Management:
Improved Unit Tests: Enhancements for better readability and maintainability.
New Sample: Demonstrates passing user tokens to MCP via environment variables, showcasing the dynamic flow from session.state.
Flexible & Secure Integration: Allows for more flexible and secure integration scenarios, supporting distinct authentication credentials per session or user.
#805 - Partially added ability to pass Authentication Details from ReadonlyContext, if the same JWT token can be reused.
#1402 - Fully support for the STDIO Transport.