Custom MCP Server not connected to N8N via MCP Client Tool
While I have configured integration the simple n8n workflow and integrated the MCP client tool, I have created custom MCP server which has to be joined to the MCP client, but it was failed and I figured out the problem on the MCP server side.
I bumped into the problem when I configured the MCP server when checked locally. As a base, I had a Spring Boot application, with some logic, and according to the MCP server protocol rules,
I have done next:
- ** added dependency to our product **
(org.springframework.ai:spring-ai-mcp-server- webmvc-spring-boot-starter:1.0.0-M6) - ** put next data to properties file: **
spring.ai.mcp.server.name=my-mcp-server
spring.ai.mcp.server.version=1.0.0
spring.ai.mcp.server.type=SYNC
spring.ai.mcp.server.sse-endpoint=/sse
spring.ai.mcp.server.sse-message-endpoint=/mcp/messages - ** added bean to set up the tool provider **
@Bean
public ToolCallbackProvider toolCallbackProvider(ToolsService toolsService) {
return MethodToolCallbackProvider.builder()
.toolObjects(toolsService)
.build();
} - ** and add method to the bean ToolService **
@Tool(name = “get_by_id”)
public String getById(Map<String, Object> input) {
return "ID: " + input.get(“id”);
} - ** open socket by terminal: **
curl http://localhost:8080/sse
id:276e07ac-61d4-462b-a820-67352e21b3df
event:endpoint
data:/mcp/messages
- ** try to send message with target parameter of ID: **
curl -X POST http://localhost:8080/mcp/messages -H “Content-Type: application/json” -d ‘{
“jsonrpc”: “2.0”,
“id”: “1”,
“method”: “get_by_id”,
“params”: {
“id”: “1234”
}
}’ - ** and the result was next: **
id:45c23cfd-fd17-48f8-86d3-81e90f841781
event:message
data:{“jsonrpc”:“2.0”,“id”:“1”,“error”:{“code”:-32601,“message”:“Method not found: get_by_id”}}
I have searched several ways to solve it, but there was no solution which fixed this problem, it is block me from integrating our MCP server to n8n and I could not continue the configuration.