使用spring-ai-mcp-client-webflux-spring-boot-starter-1.0.0.M6 maven依赖,创建mcp client启动时报错:Multiple tools with the same name, 即使tools名称未冲突也会报错。

查看源码: spring-ai-mcp-client-spring-boot-autoconfigure-1.0.0-M6.jar 中 SseHttpClientTransportAutoConfiguration

Image

@ConditionalOnMissingClass("io.modelcontextprotocol.client.transport.public class WebFluxSseClientTransport") 类路径写错了,导致SseHttpClientTransportAutoConfiguration和SseWebFluxTransportAutoConfiguration都会注入 List NamedClientMcpTransport 导致生成两个相同的mcpClients所有tool都会有一份一样的,然后校验tool的时候就会报错。

Image

Comment From: luojinggit

试试在 Application 类中加上: @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, SseHttpClientTransportAutoConfiguration.class, McpClientAutoConfiguration.class})

Comment From: chengchangan

你@tool 的name 是不是中文的,我也有这个问题,但是已经解决了,可以参考:https://github.com/spring-projects/spring-ai/issues/3854

Comment From: lihuagang03

Please provide the tool name or all. @spacesss