Solon v3.3.2

mcp - 外部工具使用注意事项

</> markdown

1、MCP Inspector

使用 MCP Inspector 时,端点使用注意:

  • sse 端点,必须时 /sse
  • message 端点,必须是 /message

示例:

@McpServerEndpoint(sseEndpoint = "/sse", messageEndpoint = "/message")
public class McpServerTool2 {
    @ToolMapping(description = "查询天气预报")
    public String getWeather(@Param(description = "城市位置") String location) {
        return "晴,14度";
    }
}

2、Cherry Studio

如果 tool 描述有 outputSchema 输出,(暂时)则会不兼容。

@McpServerEndpoint(sseEndpoint = "/sse", enableOutputSchema = false)
public class McpServerTool2 {
    @ToolMapping(description = "查询天气预报")
    public String getWeather(@Param(description = "城市位置") String location) {
        return "晴,14度";
    }
}

// enableOutputSchema 属性,v3.3.3 后支持

3、Spring Mcp Client

(暂时)不支持 sse 心跳包。需要关闭心跳机制(heartbeatInterval 置为空)

@McpServerEndpoint(sseEndpoint = "/sse", heartbeatInterval = "")
public class McpServerTool2 {
    @ToolMapping(description = "查询天气预报")
    public String getWeather(@Param(description = "城市位置") String location) {
        return "晴,14度";
    }
}