Spring AI-MCP源码整理
MCP Server
| 说明 | 源码 |
| MCP server处理SSe连接的地方 | io.modelcontextprotocol.server.transport.WebFluxSseServerTransportProvider#handleSseConnection |
| MCP server处理JRPC请求的地方 |
io.modelcontextprotocol.server.transport.WebFluxSseServerTransportProvider#handleMessage → io.modelcontextprotocol.spec.McpServerSession#handleIncomingRequest |
| MCP Server自动装配的地方 | org.springframework.ai.mcp.server.autoconfigure.McpServerAutoConfiguration |
MCP Client
| 说明 | 源码 |
| MCPClient调用McpServer Tool的地方 | org.springframework.ai.model.tool.DefaultToolCallingManager#executeToolCalls → org.springframework.ai.model.tool.DefaultToolCallingManager#executeToolCall → org.springframework.ai.mcp.AsyncMcpToolCallback#call(java.lang.String, org.springframework.ai.chat.model.ToolContext) → io.modelcontextprotocol.spec.McpClientSession#sendRequest |
| Spring AI Chat 调用模型的地方 |
org.springframework.ai.openai.OpenAiChatModel#internalStream -> org.springframework.ai.openai.api.OpenAiApi#chatCompletionStream(org.springframework.ai.openai.api.OpenAiApi.ChatCompletionRequest, org.springframework.util.MultiValueMap<java.lang.String,java.lang.String>) |
| MCP Client自动装配的地方 |
org.springframework.ai.mcp.client.autoconfigure.McpClientAutoConfiguration |

浙公网安备 33010602011771号