Class SpringExampleMcpServer
java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
org.apache.juneau.rest.server.servlet.RestServlet
org.apache.juneau.rest.server.springboot.SpringRestServlet
org.apache.juneau.rest.server.springboot.BasicSpringRestServlet
org.apache.juneau.rest.server.mcp.v20260728.SpringMcpRestServlet
org.apache.juneau.examples.mcp.spring.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).
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.juneau.rest.server.servlet.RestServlet
RestServlet.Builder<R extends RestServlet,SELF extends RestServlet.Builder<R, SELF>>, RestServlet.DefaultBuilder<R extends RestServlet> -
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns theMcpServerConfigbacking this endpoint.On revision2026-07-28,server/discover'sinstructionsfield is sourced fromMcpOptions, notMcpServerConfig.setInstructions(java.lang.String), which only feeds the legacy v1initializehandshake.Methods inherited from class org.apache.juneau.rest.server.springboot.SpringRestServlet
createBeanStoreMethods inherited from class org.apache.juneau.rest.server.servlet.RestServlet
builder, createAuthenticator, destroy, doLog, getContext, getPath, getPaths, getRequest, getResponse, getRestBuilder, init, log, log, service, setContextMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, isSensitiveHeader, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, logMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.juneau.rest.server.mcp.v20260728.McpEndpoint
mcpOptionsBean, mcpProtectedResourceMetadataPathInserted, mcpProtectedResourceMetadataRoot, mcpResourceServerAuth, mcpTraceContextExtractor, revision, subscriptionBrokerMethods inherited from interface org.apache.juneau.rest.server.mcp.McpEndpointMixin
handleMcpRequest
-
Constructor Details
-
SpringExampleMcpServer
public SpringExampleMcpServer()
-
-
Method Details
-
getMcpConfig
Description copied from interface:McpEndpointMixinReturns theMcpServerConfigbacking this endpoint.- Returns:
- The config. Never
null.
-
getMcpOptions
On revision2026-07-28,server/discover'sinstructionsfield is sourced fromMcpOptions, notMcpServerConfig.setInstructions(java.lang.String), which only feeds the legacy v1initializehandshake.- Returns:
- This endpoint's options. Must not be
null .
-