spring-ai
spring-ai copied to clipboard
mcp-server can not close while mcp-client closed.
Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create. If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:
Bug description mcp-server can not close while mcp-client closed.
Environment
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.4</version>
<properties>
<java.version>21</java.version>
<spring-ai.version>1.0.0-M7</spring-ai.version>
</properties>
Steps to reproduce first: create a mcp-client project, and the content in application.yml:
spring:
ai:
mcp:
client:
stdio:
servers-configuration: file:d:/mcp_server_config.json
the content with mcp_server_config.json:
{
"mcpServers": {
"spring-ai-mcp-weather": {
"command": "java",
"args": [
"-Dspring.ai.mcp.server.transport=STDIO",
"-jar",
"D:\\mcp-server.jar"
]
}
}
}
second: compiled this project and started it, it started the mcp-server.jar, and works well.
but, when I closed the project, it didn't close the mcp-server.jar, and the next time the project can't start mcp-server again, and pending after this message:
2025-04-21T20:36:23.925+08:00 INFO 4536 --- [ai-mcp-client] [pool-3-thread-1] i.m.client.McpAsyncClient : Server response with Protocol: 2024-11-05, Capabilities: ServerCapabilities[experimental=null, logging=LoggingCapabilities[], prompts=null, resources=null, tools=ToolCapabilities[listChanged=true]], Info: Implementation[name=mcp-server, version=1.0.0] and Instructions null
Expected behavior I want the mcp-server can be close while mcp-client closed. And I found Claude-desktop, Cursor can close mcp-server.