Class McpServerToolListingHandlerConfiguration
java.lang.Object
io.meeds.mcp.server.configuration.McpServerToolListingHandlerConfiguration
@Configuration
@EnableConfigurationProperties({org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerProperties.class,org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerStreamableHttpProperties.class})
public class McpServerToolListingHandlerConfiguration
extends Object
Custom configuration to allow overriding MCP Tools Listing Handler. This
overrides
io.modelcontextprotocol.server.transport.WebMvcStreamableServerTransportProvider
in order to be able to override the MCP Tools Listing Handler. This will
allow to list the Tools switch the elected scope. It also wraps the
tools/call handler so that a null sent for an optional
argument is dropped before the SDK validates the arguments.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.web.servlet.function.RouterFunction<org.springframework.web.servlet.function.ServerResponse> mcpStreamableServerRouterFunction(McpServerToolListingHandlerConfiguration.CustomMcpStreamableServerTransportProvider webMvcProvider) mcpStreamableServerTransportProvider(org.springframework.context.ApplicationContext applicationContext, tools.jackson.databind.json.JsonMapper jsonMapper, org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerStreamableHttpProperties serverProperties) Wraps the Spring AI WebMvc streamable transport so that the session factory it receives can be substituted byMcpServerToolListingHandlerConfiguration.McpStreamableServerSessionFactory.
-
Constructor Details
-
McpServerToolListingHandlerConfiguration
public McpServerToolListingHandlerConfiguration()
-
-
Method Details
-
mcpStreamableServerTransportProvider
@Bean public McpServerToolListingHandlerConfiguration.CustomMcpStreamableServerTransportProvider mcpStreamableServerTransportProvider(org.springframework.context.ApplicationContext applicationContext, tools.jackson.databind.json.JsonMapper jsonMapper, org.springframework.ai.mcp.server.common.autoconfigure.properties.McpServerStreamableHttpProperties serverProperties) Wraps the Spring AI WebMvc streamable transport so that the session factory it receives can be substituted byMcpServerToolListingHandlerConfiguration.McpStreamableServerSessionFactory.- Parameters:
applicationContext- the application context, resolved lazily for the MCP server and tool service beansjsonMapper- the JSON mapper the transport serialises withserverProperties- the streamable HTTP transport properties- Returns:
- the wrapping transport provider
-
mcpStreamableServerRouterFunction
@Bean public org.springframework.web.servlet.function.RouterFunction<org.springframework.web.servlet.function.ServerResponse> mcpStreamableServerRouterFunction(McpServerToolListingHandlerConfiguration.CustomMcpStreamableServerTransportProvider webMvcProvider) - Parameters:
webMvcProvider- the wrapping transport provider- Returns:
- the router function serving the MCP endpoint
-