Skip to content

NoSuchMethodError in DefaultMcpTransportBuilder when using Spring AI 2.0 (MCP 1.x classpath collision) #1190

@akbarkanso

Description

@akbarkanso

🔴 Required Information

Describe the Bug:
The google-adk-spring-ai library is binary-incompatible with Spring AI 2.0.0 (GA) and the MCP 1.x SDK. This is due to a classpath collision in the io.modelcontextprotocol.json.McpJsonMapper class. ADK calls a static method (.getDefault()) that existed in the legacy MCP 0.17.x SDK but has been removed in the 1.x line used by Spring AI 2.0.

Steps to Reproduce:

  1. Create a Spring Boot project and include the Spring AI 2.0.0 BOM and dependencies.
  2. Add the com.google.adk:google-adk-spring-ai:1.2.0 dependency.
  3. Attempt to initialize an McpToolset or any code path that triggers the DefaultMcpTransportBuilder.
  4. Observe the runtime crash during class loading/initialization.

Expected Behavior:
The ADK McpToolset should be compatible with the modern mcp-core:1.x architecture, allowing users to leverage the stable release of Spring AI 2.0 alongside Google ADK.

Observed Behavior:
The application fails with the following stack trace:

java.lang.NoSuchMethodError: 'io.modelcontextprotocol.json.McpJsonMapper io.modelcontextprotocol.json.McpJsonMapper.getDefault()'
    at com.google.adk.tools.mcp.DefaultMcpTransportBuilder.<clinit>(DefaultMcpTransportBuilder.java:...)

Environment Details:

  • ADK Library Version: 1.2.0
  • OS: macOS / Linux
  • TS Version: N/A (Java Environment)

Model Information:

  • Which model is being used: N/A (This is a protocol/library level initialization error)

🟡 Optional Information

Regression:
No. This is an incompatibility introduced by the architectural shift between MCP 0.17.x (which ADK pins) and MCP 1.x (which Spring AI 2.0 pins).

Additional Context:
Both google-adk and spring-ai now share a dependency on the same Fully Qualified Class Name (FQCN): io.modelcontextprotocol.json.McpJsonMapper.

  • ADK's DefaultMcpTransportBuilder expects a static getDefault() method.
  • Spring AI 2.0 pulls in mcp-core:1.x, where this method was removed/renamed to createDefault().
    Since Gradle/Maven resolves the conflict to version 1.x to satisfy Spring AI, the ADK code attempts to call a non-existent method on the 1.x class.

Minimal Reproduction Code:
In a standard Spring AI 2.0 project, simply attempting to use the default MCP transport via ADK will fail:

// This triggers the static initializer of DefaultMcpTransportBuilder
McpToolset toolset = McpToolset.builder()
    .parameters(StreamableHttpServerParameters.builder()
        .uri("https://mcp-server/mcp")
        .build())
    .build();

How often has this issue occurred?:

  • Always (100%) when Spring AI 2.0 and Google ADK 1.2.0 are present on the same classpath.

Metadata

Metadata

Assignees

Labels

waiting on reporterWaiting for reaction by reporter. Failing that, maintainers will eventually closed it as stale.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions