adityamparikh opened a new pull request, #287:
URL: https://github.com/apache/solr-mcp/pull/287

   Stacked on #286 (Spring Boot 4.2.0-RC2 / Spring AI 2.1.0-RC2), 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](https://modelcontextprotocol.io/specification/2026-07-28): no 
`initialize` handshake or session, `server/discover`, `_meta` on every request, 
and `Mcp-Method`/`Mcp-Name` headers on a single `POST /mcp`. This makes it 
selectable with `MCP_PROTOCOL=modern`. The default stays on the 2025 revisions 
that today's clients speak, because the two are not wire-compatible.
   
   ```diff
    application-http.properties
   -spring.ai.mcp.server.protocol=stateless
   +spring.ai.mcp.server.protocol=${MCP_PROTOCOL:stateless}
    application-stdio.properties
   +spring.ai.mcp.server.protocol=${MCP_PROTOCOL:streamable}
   ```
   
   Spring AI chooses the server with `@ConditionalOnProperty(protocol = 
MODERN)`, so the property is the switch. Every tool, resource, prompt and 
completion, and the `@PreAuthorize` scopes on tools, are served unchanged in 
either mode.
   
   **HTTP:** the CORS allow-list gains `Mcp-Method` and `Mcp-Name`, which a 
browser client sends on every modern request and which would otherwise fail 
preflight.
   
   **STDIO:** `ModernStdioTransportConfiguration` replaces Spring AI's 
`@ConditionalOnMissingBean` stdio transport, in modern STDIO mode only:
   
   ```text
   Spring AI 2.1.0-RC2                       this PR
   StdioMcpTransportLifecycle.start()        ReadyStdioMcpTransport
     transport.start().subscribe()             start()   → returns the session 
Mono, reads nothing yet
       reader on daemon threads                on ApplicationReadyEvent
     main returns → JVM exits                    super.start() on a non-daemon 
keep-alive thread
                                                 ends when stdin closes or the 
context stops
   ```
   
   The SDK's `StdioMcpTransport.start()` javadoc says its threads do not keep 
the JVM alive and callers should block on the returned `Mono`; Spring AI's 
lifecycle only subscribes. Deferring reads to `ApplicationReadyEvent` also 
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.md` documents the mode (client-visible changes, CORS, 
`request-state-secret` for multiple instances, native images), with a pointer 
from the README's environment table and the CHANGELOG.
   
   ## Evidence
   
   The SDK has no 2026-07-28 client yet, so the new tests speak raw JSON-RPC 
(`ModernMcpRequests`):
   
   - `McpModernProtocolHttpIntegrationTest`: `server/discover` advertises the 
revision and every capability; `tools/list` keeps every tool and its hints; 
`tools/call` creates 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 with 
`MCP_PROTOCOL=modern` and sends the first request immediately, then 
`server/discover` and `tools/list`.
   - `McpInspectorCorsTest`: preflight with the modern headers is allowed; an 
unknown origin is still rejected.
   
   - **Before:** Spring AI 2.1.0-RC2's own modern STDIO transport exits right 
after startup, so the first request gets no answer.
     **After:** `./gradlew build` → 471 tests, 0 failures, 0 skipped (the 460 
from #286 plus the 11 above), `BUILD SUCCESSFUL`.
   
   ## Merge Danger
   
   **Door:** two-way
   
   Nothing changes unless `MCP_PROTOCOL=modern` is 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_PROTOCOL` at `docker run` 
time has no effect there; the doc says so.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [PR] feat(mcp): serve the MCP ... adityamparikh (via GitHub) via issues

Reply via email to