-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
Bug description
A clear and concise description of what the bug is about.
I create mcp client to invoke @modelcontextprotocol/server-filesystem by stdio. It can invoke server-filesystem success, But when
SyncMcpToolCallback call method response field error is null, it will NPE.
Environment
Spring AI version: 1.0.0-SNAPSHOT
Java Version: 21
Steps to reproduce
- application.properties
spring.application.name=mcp-examples
spring.ai.ollama.base-url=http://localhost:11434
spring.ai.ollama.chat.model=qwen2.5:latest
spring.ai.mcp.client.enabled=true
spring.ai.mcp.client.name=mcp-client
spring.ai.mcp.client.version=1.0.0
spring.ai.mcp.client.type=SYNC
spring.ai.mcp.client.request-timeout=30s
spring.ai.mcp.client.stdio.servers-configuration=classpath:/mcp-servers-config.json
- mcp-servers-config.json
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"."
]
}
}
}
- controller
@RestController
public class FileSystemController {
@Resource
private OllamaChatModel ollamaChatModel;
@Resource
private SyncMcpToolCallbackProvider toolCallbackProvider;
@GetMapping("/chat")
public String call(@RequestParam String input) {
ChatClient chatClient = ChatClient.builder(ollamaChatModel)
.defaultTools(toolCallbackProvider.getToolCallbacks())
.build();
return chatClient.prompt(input).call().content();
}
}
- visit http://localhost:8080/chat?input=create folder mcp
Metadata
Metadata
Assignees
Labels
No labels
