NoSuchMethodError in DefaultMcpTransportBuilder when using Spring AI 2.0 (MCP 1.x classpath collision)
🔴 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:
- Create a Spring Boot project and include the Spring AI 2.0.0 BOM and dependencies.
- Add the
com.google.adk:google-adk-spring-ai:1.2.0dependency. - Attempt to initialize an
McpToolsetor any code path that triggers theDefaultMcpTransportBuilder. - 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
DefaultMcpTransportBuilderexpects a staticgetDefault()method. - Spring AI 2.0 pulls in
mcp-core:1.x, where this method was removed/renamed tocreateDefault(). 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.
Hi @akbarkanso, thank you for reporting this issue. I have been able to reproduce the NoSuchMethodError as described. The reason you are getting this error because Spring transitive dependency version conflict. The ADK currently expects mcp-core:0.17.0, while Spring AI 2.0 transitively pulls in mcp-core:1.1.0. To resolve this, could you please pin the io.modelcontextprotocol.sdk:mcp-core version to <version>0.17.0</version> like below and let us know if your issue is resolved?
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-core</artifactId>
<version>0.17.0</version>
</dependency>
</dependencies>
</dependencyManagement>
Closing this issue since it has been stale for more than 14 days.