Describe the bug
When using a MCPToolset that requires OAuth and engaging in a long running session, the token expires and causes subsequent calls to an MCP server that requires OAuth to fail.
To Reproduce
- Create an agent that requires OAuth i.e:
McpToolset(
connection_params=StreamableHTTPConnectionParams(
url=config.MCP_URL
),
auth_scheme=OAuth2(
flows=OAuthFlows(
authorizationCode=OAuthFlowAuthorizationCode(
authorizationUrl=config.AUTHORIZATION_SERVER_URL,
tokenUrl=config.TOKEN_SERVER_URL,
scopes={...},
)
)),
auth_credential=AuthCredential(
auth_type=AuthCredentialTypes.OAUTH2,
oauth2=OAuth2Auth(
client_id=config.OAUTH_CLIENT_ID,
client_secret=config.OAUTH_CLIENT_SECRET
)
),
)
- Create a session with the agent and complete OAuth such that ones obtains an access token and refresh token
- Engage with the agent after the time the access token expires, and one will encounter 401's
Expected behavior
One would expect the token to refresh.
Desktop (please complete the following information):
- OS: macOS
- Python version: 3.11.13
- ADK version: 1.19.0
Model Information:
- Are you using LiteLLM: No
- Which model is being used: Gemini 2.5 Flash
Describe the bug
When using a MCPToolset that requires OAuth and engaging in a long running session, the token expires and causes subsequent calls to an MCP server that requires OAuth to fail.
To Reproduce
Expected behavior
One would expect the token to refresh.
Desktop (please complete the following information):
Model Information: