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

@@ -19,12 +19,13 @@ spring:
locations: classpath:db/migration
mvc:
async:
request-timeout: 0 # SSE streams must not time out
# Spring AI MCP server. In Spring AI 1.0.0 the WebMVC transport is SSE-based
# (WebMvcSseServerTransportProvider) — the closest available transport to the 2025-03-26
# "Streamable HTTP" spec; there is no separate "protocol: streamable" property in this
# starter. JSON-RPC POSTs land on `sse-message-endpoint` (/mcp); server-initiated
# notifications stream over `sse-endpoint` (/sse). See com.trueref.adapter.in.mcp.
request-timeout: 0 # MCP GET streams must not time out
# Spring AI MCP server — Streamable HTTP transport (MCP spec 2025-03-26).
# McpWebMvcServerAutoConfiguration (SSE transport) is excluded below;
# WebMvcStreamableServerTransportProvider is wired manually in McpConfig.
# Clients connect with type: http at POST /mcp.
autoconfigure:
exclude: org.springframework.ai.mcp.server.autoconfigure.McpWebMvcServerAutoConfiguration
ai:
mcp:
server:
@@ -32,8 +33,6 @@ spring:
name: trueref
version: 0.1.0
type: SYNC
sse-message-endpoint: /mcp
sse-endpoint: /sse
server:
port: 8080