Spring AI 刚好就有 MCP Server Boot Starter 模块,直接拿来用就行了: https://docs.spring.io/spring-ai/reference/api/mcp/mcp-server-boot-starter-docs.html
Spring MCP Server 提供了三种不同的模式:
Standard Input/Output (STDIO)
spring-ai-starter-mcp-server(适合简单的本地开发和单进程通信)
Spring MVC (Server-Sent Events)
spring-ai-starter-mcp-server-webmvc(适合传统的基于 Servlet 的 Web 应用,支持同步模式)