Skip to content

Incorrect mcp version floor in google-adk 1.28.0 causes runtime TypeError #5058

@jnuvola

Description

@jnuvola

Description

google-adk==1.28.0 declares mcp>=1.23.0,<2.0.0 in its dependencies, but the ADK's MCP session code passes sampling_capabilities to mcp.ClientSession.__init__(), a keyword argument that does not exist in mcp versions prior to 1.24.0. This causes a TypeError at runtime when the resolver picks mcp==1.23.0 (the declared lower bound).

Environment

  • google-adk==1.28.0
  • mcp==1.23.0 (resolved by uv from the declared >=1.23.0 floor)
  • Python 3.13.5
  • macOS (also reproducible on Linux)

Steps to Reproduce

  1. Install google-adk==1.28.0 without pinning mcp separately
  2. Allow the resolver to pick mcp==1.23.0 (the minimum allowed version)
  3. Configure any agent with an MCP toolset using Streamable HTTP transport
  4. Start the agent (e.g. adk web or programmatically via Runner.run_async)

Expected Behavior

MCP session initializes successfully and tools are discovered from the remote MCP server.

Actual Behavior

Session creation fails immediately with:

TypeError: ClientSession.__init__() got an unexpected keyword argument 'sampling_capabilities'

Full traceback:

ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | File ".../google/adk/tools/mcp_tool/session_context.py", line 186, in _run
    |     ClientSession(
    |         *transports[:2],
    |         ...
    |         sampling_capabilities=self._sampling_capabilities,
    |     )
    | TypeError: ClientSession.__init__() got an unexpected keyword argument 'sampling_capabilities'
    +------------------------------------

The ADK retries once, then surfaces a ConnectionError: Failed to create MCP session.

Suggested Fix

Bump the lower bound in pyproject.toml:

- "mcp>=1.23.0,<2.0.0"
+ "mcp>=1.24.0,<2.0.0"

Workaround

Add an explicit mcp>=1.24.0 dependency in the downstream project to force a compatible version.

Metadata

Metadata

Assignees

Labels

mcp[Component] Issues about MCP supporttools[Component] This issue is related to tools

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions