Class SpringExampleMcpServer

All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable, BasicUniversalConfig, DefaultConfig, DefaultHtmlConfig, McpEndpointMixin, McpEndpoint

The Spring Boot flavor of the MCP server.

Extending SpringMcpRestServlet (rather than the plain McpRestServlet) is the whole point: it bridges the Spring ApplicationContext into each MCP handler's per-request BeanStore, so ctx.getBean(GreetingService.class) resolves the real Spring-managed GreetingService singleton. The same handler on a plain McpRestServlet would not see Spring beans.

When registered at servlet mapping /* (see SpringExampleApplication), the MCP endpoint is served at /mcp (the Spring convenience servlet mounts its operation at /mcp relative to the servlet root).