feat(mcp): migrate to Streamable HTTP transport (MCP spec 2025-03-26)
All checks were successful
Build and publish Docker image / Build and push CPU image (push) Successful in 2m7s
Build and publish Docker image / Build and push GPU image (push) Successful in 2m56s

- Upgrade mcp-spring-webmvc from 0.10.0 to 0.18.1 (adds
  WebMvcStreamableServerTransportProvider alongside the legacy SSE provider)
- Add mcp-json-jackson2 0.18.1 for JacksonMcpJsonMapper adapter
- Exclude McpWebMvcServerAutoConfiguration (SSE transport) via
  spring.autoconfigure.exclude; register WebMvcStreamableServerTransportProvider
  and its RouterFunction manually in McpConfig so Spring AI's
  McpServerAutoConfiguration picks up the correct transport bean
- Remove sse-message-endpoint / sse-endpoint from application.yml;
  all MCP traffic now flows through POST+GET /mcp
- Remove McpSseMethodNotAllowed workaround from WebConfig and drop
  'sse' from SPA fallback exclusions (no longer needed)

Clients should connect with type: http at https://trueref.sal.giize.com/mcp
This commit is contained in:
moze
2026-05-06 02:34:27 +02:00
parent c3e657e2a1
commit 343a4ff3c3
4 changed files with 54 additions and 35 deletions

View File

@@ -44,12 +44,27 @@
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<!-- Spring AI MCP server (Streamable HTTP) -->
<!-- Spring AI MCP server — tool/resource registration and McpSyncServer wiring.
McpWebMvcServerAutoConfiguration (SSE transport) is excluded in application.yml;
the Streamable HTTP transport is wired manually in McpConfig. -->
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-mcp-server-webmvc</artifactId>
</dependency>
<!-- MCP Java SDK 0.18.1: provides WebMvcStreamableServerTransportProvider.
Overrides the 0.10.0 version pulled in by spring-ai-starter-mcp-server-webmvc. -->
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-spring-webmvc</artifactId>
<version>0.18.1</version>
</dependency>
<dependency>
<groupId>io.modelcontextprotocol.sdk</groupId>
<artifactId>mcp-json-jackson2</artifactId>
<version>0.18.1</version>
</dependency>
<!-- H2 + Flyway -->
<dependency>
<groupId>com.h2database</groupId>