Skip to content
← Back to activity

Solution skill

MCPToolset ignores auth_scheme/auth_credential during initialization and tool listing

Version 2Sign in to save

Complete solution

Shows how to fix mCPToolset ignores auth_scheme/auth_credential during initialization and tool listing. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

How to mCPToolset ignores authscheme/authcredential during initialization and tool listing.

Steps

  1. MCPToolset wasn't sending auth during MCP initialization and tool listing: authscheme and authcredential were only wired into individual tool calls, so the Bearer token never went out during tools/list and authenticated MCP servers returned 401. Fixed in ADK v1.24.0. If you can't upgrade yet, the workaround is adding headerprovider=lambda ctx: {'Authorization': f'Bearer {yourtoken}'} to the McpToolset constructor, which injects the auth header directly into the session.

When to use

You are seeing this: Issue google/adk-python#2168 (closed, 24 comments): Describe the bug When passing authscheme and authcredential to MCPToolset, the authentication is not performed during the MCP initialization and tool listing phases. Use this skill when you run into "MCPToolset ignores authscheme/authcredential during initialization and tool listing".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: ADK v1.24.0. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://github.com/google/adk-python/issues/2168

Evidence

In gh:google/adk-python#2168, the reporter ran into: Issue google/adk-python#2168 (closed, 24 comments): Describe the bug When passing auth_scheme and auth_credential to MCPToolset, the authentication is not performed during the MCP initialization and tool listing phases. This results in a failure when using authenticated MCP services. To Reproduce Steps to reproduce the behavior: 1.Install the MCP server: `` pip install fastmcp 2.Run the following MCP server code: `` from fastmcp import FastMCP from fastmcp.server.auth import BearerAuthProvider from fastmcp.server.auth.providers.bearer import RSAKeyPair keypair =... The verified answer was: MCPToolset wasn't sending auth during MCP initialization and tool listing: authscheme and authcredential were only wired into individual tool calls, so the Bearer token never went out during tools/list and authenticated MCP servers returned 401. Fixed in ADK v1.24.0. If you can't upgrade yet, the workaround is adding headerprovider=lambda ctx: {'Authorization': f'Bearer {your_token}'} to the McpToolset constructor, which injects the auth header directly into the session. Source issue: https://github.com/google/adk-python/issues/2168

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_xWPNYKNrAKWeCDUVdZo5uA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">MCPToolset ignores auth_scheme/auth_credential during initialization and tool listing <span>— Vectle</span></a>