-
Notifications
You must be signed in to change notification settings - Fork 1.8k
refactor: restructure MCP server auto-configuraitons, adding streamable-http support #4179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
tzolov
commented
Aug 18, 2025
- Extract MCP server functionality into specialized modules:
- STDIO/SSE servers (existing functionality)
- Streamable-HTTP servers with change notifications
- Stateless servers for simplified deployments
- Add new auto-configuration modules:
- spring-ai-autoconfigure-mcp-streamable-server-common
- spring-ai-autoconfigure-mcp-streamable-server-webflux/webmvc
- spring-ai-autoconfigure-mcp-stateless-server-common
- spring-ai-autoconfigure-mcp-stateless-server-webflux/webmvc
- Add server-specific property prefixes for different server types
- Extract ToolCallbackConverter into separate auto-configuration with conditional enablement via tool-callback-converter property
- Enhance transport providers with builder patterns and new features:
- Keep-alive interval support for connection health
- Add keep-alive-interval and other transport-specific options
- Add comprehensive integration tests for all server types
- Update documentation to reflect new architecture and server options
…le-http support - Extract MCP server functionality into specialized modules: * STDIO/SSE servers (existing functionality) * Streamable-HTTP servers with change notifications * Stateless servers for simplified deployments - Add new auto-configuration modules: * spring-ai-autoconfigure-mcp-streamable-server-common * spring-ai-autoconfigure-mcp-streamable-server-webflux/webmvc * spring-ai-autoconfigure-mcp-stateless-server-common * spring-ai-autoconfigure-mcp-stateless-server-webflux/webmvc * Add server-specific property prefixes for different server types - Extract ToolCallbackConverter into separate auto-configuration with conditional enablement via tool-callback-converter property - Enhance transport providers with builder patterns and new features: * Keep-alive interval support for connection health * Add keep-alive-interval and other transport-specific options - Add comprehensive integration tests for all server types - Update documentation to reflect new architecture and server options Signed-off-by: Christian Tzolov <[email protected]>
|
This looks great. I did some similar things for the IT testing in the integration tests for spring-ai-examples. i think there are some reusable patterns we can discuss. |
| // De-duplicate tools by their name, keeping the first occurrence of each tool | ||
| // name | ||
| return tools.stream() // Key: tool name | ||
| .collect(Collectors.toMap(tool -> tool.getToolDefinition().name(), tool -> tool, // Value: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic is duplicated in the sync version, can share a utility method
| .withConfiguration(AutoConfigurations.of(McpToolCallbackAutoConfiguration.class, | ||
| McpClientAutoConfiguration.class, SseWebFluxTransportAutoConfiguration.class)); | ||
|
|
||
| static AtomicReference<LoggingMessageNotification> loggingNotificationRef = new AtomicReference<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static can introduce side effects, make them instance vars and reset state in @beforeeach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As those are shared between the test and the spring configuration beens we can't use the beforeeach but we can make them a special TestContext been as part for the client test configuration.
I will fix it for the Sse and the Streamable its
Signed-off-by: Christian Tzolov <[email protected]>
Signed-off-by: Christian Tzolov <[email protected]>
|
Thanks @markpollack I've addressed the above recomendations |