Repository navigation
feat(mcp): serve the MCP 2026-07-28 revision with MCP_PROTOCOL=modern - #287
Merged
Merged
Conversation
adityamparikh
marked this pull request as draft
November 16, 2026 21:04
adityamparikh
force-pushed
the
feat/mcp-modern-protocol
branch
from
November 20, 2026 23:03
dfd87d7 to
56c1243
Compare
adityamparikh
marked this pull request as ready for review
November 20, 2026 23:03
- Spring Boot 4.1.1 -> 4.2.0, Spring AI 2.0.1 -> 2.1.0. - Drop the mcp-bom 2.0.1 pin. Spring AI 2.1.0 depends on MCP SDK 2.2.0 itself, and the pin, declared ahead of spring-ai-bom, would have held the SDK back at 2.0.1 under "first declaration wins". - opentelemetry-logback-appender 2.28.1-alpha -> 2.34.0-alpha, the release built against Boot 4.2's OpenTelemetry 1.68.0. The old appender left opentelemetry-api-incubator at 1.62.0-alpha, which fails OpenTelemetrySdk creation with NoClassDefFoundError: io/opentelemetry/api/internal/ConfigUtil. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
adityamparikh
force-pushed
the
feat/mcp-modern-protocol
branch
from
November 20, 2026 23:24
56c1243 to
47df56a
Compare
Spring AI 2.1.0 ships the modern MCP server for the 2026-07-28 spec revision: no initialize handshake or session, server/discover, _meta on every request, and Mcp-Method/Mcp-Name headers on a single POST /mcp. MCP_PROTOCOL=modern turns it on for the HTTP and STDIO profiles. The defaults stay on the 2025 revisions (stateless HTTP, streamable STDIO) because the new revision is not wire-compatible with today's clients. - Allow the Mcp-Method and Mcp-Name headers in the HTTP CORS config. - Work around two Spring AI 2.1.0 modern STDIO bugs: the JVM exited right after startup because the stdin reader runs on daemon threads, and a request sent at launch could be read before the context was ready. - Add HTTP, method-security and STDIO integration tests that speak raw 2026-07-28 JSON-RPC, since the SDK has no modern client yet. - Document the mode in docs/modern-protocol.md, with the setting in the README, AGENTS.md, THREAT_MODEL.md, the architecture and native-image dev-docs, the HTTP security CORS list and the CHANGELOG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
adityamparikh
force-pushed
the
feat/mcp-modern-protocol
branch
from
November 21, 2026 14:45
47df56a to
25e96ce
Compare
|
adityamparikh
added a commit
to adityamparikh/solr-mcp
that referenced
this pull request
Nov 24, 2026
McpModernProtocolMethodSecurityTest arrived with apache#287 and authenticates its caller with only ROLE_USER, which was enough while list-collections required isAuthenticated(). Under scoped authorization the tool requires SCOPE_solr:read, so the authenticated call was denied and the test failed. The stand-in user now carries that scope, and the anonymous case still proves the modern transport runs the tool on the request thread with its SecurityContext. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Stacked on #286 (Spring Boot 4.2.0 / Spring AI 2.1.0), whose commit is the first one here; review only the second commit.
Summary
Spring AI 2.1 ships a server for the MCP 2026-07-28 revision: no
initializehandshake or session,server/discover,_metaon every request, andMcp-Method/Mcp-Nameheaders on a singlePOST /mcp. This makes it selectable withMCP_PROTOCOL=modern. The default stays on the 2025 revisions that today's clients speak, because the two are not wire-compatible.Spring AI chooses the server with
@ConditionalOnProperty(protocol = MODERN), so the property is the switch. Every tool, resource, prompt and completion, and the@PreAuthorizescopes on tools, are served unchanged in either mode.HTTP: the CORS allow-list gains
Mcp-MethodandMcp-Name, which a browser client sends on every modern request and which would otherwise fail preflight.STDIO:
ModernStdioTransportConfigurationreplaces Spring AI's@ConditionalOnMissingBeanstdio transport, in modern STDIO mode only:The SDK's
StdioMcpTransport.start()javadoc says its threads do not keep the JVM alive and callers should block on the returnedMono; Spring AI's lifecycle only subscribes. Deferring reads toApplicationReadyEventalso stops a request written at launch from being read before startup completes. The class is meant to be deleted once Spring AI handles both.docs/modern-protocol.mddocuments the mode (client-visible changes, CORS,request-state-secretfor multiple instances, native images).MCP_PROTOCOLis also listed in the README's environment table,AGENTS.md(transport modes, configuration, native-image notes) and theTHREAT_MODEL.mdconfiguration table.dev-docs/ARCHITECTURE.mdanddev-docs/graalvm-native-image.mdnote the revision choice and that native images fix it at build time,docs/security/http.mdlists the two new CORS headers, and the CHANGELOG has an entry.Evidence
The SDK has no 2026-07-28 client yet, so the new tests speak raw JSON-RPC (
ModernMcpRequests):McpModernProtocolHttpIntegrationTest:server/discoveradvertises the revision and every capability;tools/listkeeps every tool and its hints;tools/callcreates a collection, indexes and searches; resources and templates are readable.McpModernProtocolMethodSecurityTest: an anonymous call to a secured tool is rejected and an authenticated one succeeds.McpModernProtocolStdioIntegrationTest: launches the jar withMCP_PROTOCOL=modernand sends the first request immediately, thenserver/discoverandtools/list.McpInspectorCorsTest: preflight with the modern headers is allowed; an unknown origin is still rejected.Before: Spring AI 2.1.0's own modern STDIO transport exits right after startup, so the first request gets no answer.
After:
./gradlew build→ 468 tests, 0 failures, 0 skipped (the 457 from chore(deps): upgrade to Spring Boot 4.2.0 and Spring AI 2.1.0 #286 plus the 11 above),BUILD SUCCESSFUL.Merge Danger
Door: two-way
Nothing changes unless
MCP_PROTOCOL=modernis set; reverting removes an opt-in mode and one configuration class.Blast Radius: opt-in
Default HTTP and STDIO behaviour is unchanged. In the native images the condition is fixed when the binary is built, so
MCP_PROTOCOLatdocker runtime has no effect there; the doc says so.🤖 Generated with Claude Code