Class McpServerConfig
/mcp
like any servlet, and an McpToolServer over it.
The server scans the named packages for @MCP tools, turns each caller into a
consumer through the resolver, and answers one question through the access policy:
may this consumer use this tool. The same answer decides what the consumer sees listed
and what it may call, so grants cannot be probed. What a caller receives is the tool as
this application declared it - the input schema generated from its input class, the
description from its annotation - and everything a caller sends is checked against that
schema before the tool runs. Every call runs as a job under the caller's name, recorded
like any other work, and a call that outlives setCallTimeout has its whole
workflow cancelled.
This example admits every caller as one consumer, local-agent; a real host
authenticates the request first, the way it authenticates any request, and records the
principal it admitted in the transport's context extractor.
- Since:
- 0.1 (2026-09-28)
- Author:
- Andrey Santrosyan
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.boot.web.servlet.ServletRegistrationBean<io.modelcontextprotocol.server.transport.HttpServletStatelessServerTransport> mcpServlet(io.modelcontextprotocol.server.transport.HttpServletStatelessServerTransport transport) mcpToolServer(io.modelcontextprotocol.server.transport.HttpServletStatelessServerTransport transport, McpServerConfig.NucleoRuntime runtime) io.modelcontextprotocol.server.transport.HttpServletStatelessServerTransportThe runtime's lifecycle, wired by hand: a real application putsnucleo-spring-boot-starteron its classpath, which starts the dispatcher with the application and binds credentials from properties.
-
Constructor Details
-
McpServerConfig
public McpServerConfig()
-
-
Method Details
-
nucleoRuntime
The runtime's lifecycle, wired by hand: a real application putsnucleo-spring-boot-starteron its classpath, which starts the dispatcher with the application and binds credentials from properties. The other examples of this module are plain mains, so the starter stays off its classpath and this bean does the starter's one job here. Beans are destroyed in reverse creation order, so the server below closes before the dispatcher drains. -
mcpTransport
@Bean public io.modelcontextprotocol.server.transport.HttpServletStatelessServerTransport mcpTransport() -
mcpServlet
@Bean public org.springframework.boot.web.servlet.ServletRegistrationBean<io.modelcontextprotocol.server.transport.HttpServletStatelessServerTransport> mcpServlet(io.modelcontextprotocol.server.transport.HttpServletStatelessServerTransport transport) -
mcpToolServer
@Bean(destroyMethod="close") public McpToolServer mcpToolServer(io.modelcontextprotocol.server.transport.HttpServletStatelessServerTransport transport, McpServerConfig.NucleoRuntime runtime)
-