There are concurrency safety issues in the sampling
method of McpSyncClientCustomizer
. When multiple MCP clients send requests simultaneously, it may lead to model routing errors and exceptions.
running code : https://github.com/spring-projects/spring-ai-examples/tree/main/model-context-protocol/sampling
code location: https://github.com/spring-projects/spring-ai-examples/blob/main/model-context-protocol/sampling/mcp-weather-webmvc-server/src/main/java/org/springframework/ai/mcp/sample/server/WeatherService.java
then , client code will lead to model routing errors : code location :