3D editorial illustration of glass data capsules gliding across a cyan suspension bridge between server hubs, passing through a glowing amber human-in-the-loop verification archway.Illustration of stateless MCP 2026-07-28 transport and multi-round-trip human elicitation in Spring AI 2.1.

Back in July, we walked through Integrating MCP Tooling with Spring AI, wiring up Model Context Protocol servers over SSE and Streamable HTTP. It worked great on localhost. Then teams put those MCP servers behind a Kubernetes Ingress with three replicas—and immediately ran headfirst into sticky sessions, dropped initialize handshakes, and broken server-to-client elicitation callbacks whenever a pod rolled.

Spring AI 2.1 (via 2.1.0-RC2 and MCP Java SDK 2.2.0-M2) solves that deployment headache head-on by shipping first-class support for the 2026-07-28 (“Modern”) MCP specification (spring.ai.mcp.server.protocol=MODERN).

No initialize handshake. No server-side session state. A single POST /mcp endpoint that scales horizontally behind any plain round-robin load balancer—while still supporting interactive human confirmation and sampling through Multi-Round-Trip Requests (MRTR).

In this sequel, we will compare legacy stateful MCP against protocol=MODERN, build a real Spring Boot 4.2 @McpTool that pauses to ask a human for confirmation before deleting a record, and cover the key migration caveats (including OAuth governance and the Anthropic SDK 3.4.0 breaking changes bundled in Spring AI 2.1).

1. Legacy Stateful MCP vs. Modern 2026-07-28 MCP

At AGNTCon + MCPCon NA 2026, James Ward and Alexander Ioffe argued that teams need to stop treating MCP as a thin CRUD wrapper and start designing it as a true Agent Integration Interface. The 2026-07-28 protocol redesign makes that architecture cloud-native by stripping away stateful session plumbing:

CapabilityLegacy SSE / STREAMABLE MCPModern 2026-07-28 (protocol=MODERN)
Session StateStateful server sessions; requires sticky routing across K8s replicas100% sessionless; any replica can serve any request
Capability HandshakeStateful initialize negotiation per connectionCacheable server/discover request; protocol version & client capabilities travel in _meta on every call
HTTP TransportMulti-endpoint SSE + POST or long-lived Streamable streamsSingle POST /mcp endpoint (returns JSON or short-lived text/event-stream for progress updates)
Human Confirmation / SamplingSession-bound server-to-client callbacks (ctx.elicit, ctx.sample)Multi-Round-Trip Requests (MRTR) via InputRequiredResult + sealed requestState
Change NotificationsBound to active client session streamDedicated subscriptions/listen stream backed by runtime repositories
Capability EnforcementManual checks inside tool bodiesDeclarative requiredCapabilities attribute on @McpTool, @McpResource, @McpPrompt

Supported transports for protocol=MODERN include Spring WebMVC, Spring WebFlux, and STDIO.

2. Enabling protocol=MODERN in Gradle and application.yml

If you already run a STATELESS MCP server in Spring AI, migrating your existing @McpTool, @McpResource, and @McpPrompt beans is literally a one-line configuration switch.

// build.gradle.kts
ext["springAiVersion"] = "2.1.0-RC2"

dependencyManagement {
    imports {
        mavenBom("org.springframework.ai:spring-ai-bom:${property("springAiVersion")}")
    }
}

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-webmvc")
    implementation("org.springframework.ai:spring-ai-starter-mcp-server-webmvc")
}
# application.yml
spring:
  ai:
    mcp:
      server:
        name: task-operations-mcp
        version: 2.1.0
        protocol: MODERN
        type: SYNC
        streamable-http:
          mcp-endpoint: /mcp

Important RC2 constraint: Modern MCP server support currently requires spring.ai.mcp.server.type=SYNC. Combining type=ASYNC with protocol=MODERN fails fast at application startup rather than misbehaving silently. On Java 25 with spring.threads.virtual.enabled=true, synchronous WebMVC handlers already scale cleanly without reactive boilerplate.

3. Building a Destructive @McpTool with Multi-Round-Trip Elicitation

How do you ask a human for confirmation—“Are you sure you want to delete production task TASK-409?”—when the server holds zero session memory between HTTP calls?

MCP 2026-07-28 solves this cleanly with Multi-Round-Trip Requests (MRTR):

  1. Round-Trip 1: The client calls POST /mcp to invoke delete_task. Spring AI first verifies the client declared McpClientCapability.ELICITATION_FORM in its request _meta (rejecting the call automatically if unsupported). Inside our Java method, ctx.inputResponse("confirm", Map.class) returns null.
  2. Our handler emits a progress update via McpSyncNotifier and returns an InputRequiredResult containing a JSON Schema confirmation form plus a sealed requestState payload (here, the task ID).
  3. The client renders the confirmation form to the user, collects { "confirmed": true }, and sends Round-Trip 2 to POST /mcp—which can land on an entirely different Kubernetes pod—carrying both inputResponses and requestState.
  4. Our handler reads ctx.inputResponse("confirm", Map.class), verifies the user approved, and executes the deletion.
package com.ghostprogrammer.mcp.tools;

import java.util.Map;

import org.springaicommunity.mcp.annotation.McpTool;
import org.springaicommunity.mcp.annotation.McpToolParam;
import org.springframework.ai.mcp.modern.CallToolOutcome;
import org.springframework.ai.mcp.modern.ElicitFormRequest;
import org.springframework.ai.mcp.modern.InputRequiredResult;
import org.springframework.ai.mcp.modern.McpClientCapability;
import org.springframework.ai.mcp.modern.McpModernSyncRequestContext;
import org.springframework.ai.mcp.modern.McpSyncNotifier;
import org.springframework.stereotype.Component;

@Component
public class TaskOperationsTools {

    private final TaskRepository taskRepository;

    public TaskOperationsTools(TaskRepository taskRepository) {
        this.taskRepository = taskRepository;
    }

    @McpTool(
            name = "delete_task",
            description = "Permanently deletes a task after explicit human confirmation",
            requiredCapabilities = McpClientCapability.ELICITATION_FORM
    )
    public CallToolOutcome deleteTask(
            McpSyncNotifier notifier,
            McpModernSyncRequestContext ctx,
            @McpToolParam(description = "Unique task identifier") String id) {

        // Round-Trip 1: null until the client submits the elicitation form
        Map<?, ?> answer = ctx.inputResponse("confirm", Map.class);
        if (answer == null) {
            notifier.progress(10, 100.0, "Requesting user confirmation for task " + id);

            Map<String, Object> confirmationSchema = Map.of(
                    "type", "object",
                    "required", java.util.List.of("confirmed"),
                    "properties", Map.of(
                            "confirmed", Map.of(
                                    "type", "boolean",
                                    "title", "Confirm permanent deletion"
                            )
                    )
            );

            return InputRequiredResult.builder()
                    .elicit("confirm", ElicitFormRequest.builder(
                            "Permanently delete task " + id + "?",
                            confirmationSchema).build())
                    .requestState(id)
                    .build();
        }

        // Round-Trip 2: verify explicit approval before mutating state
        boolean confirmed = Boolean.TRUE.equals(answer.get("confirmed"));
        if (!confirmed) {
            return CallToolOutcome.text("Deletion cancelled by user for task " + id + ".");
        }

        notifier.progress(75, 100.0, "Deleting task " + id);
        taskRepository.deleteById(id);
        notifier.progress(100, 100.0, "Deleted task " + id);

        return CallToolOutcome.text("Task " + id + " was permanently deleted.");
    }
}

Bonus Metadata Annotations in Modern MCP

Spring AI 2.1 also adds rich descriptor metadata so agent clients can render better UIs and cache read-only resources aggressively:

  • @McpIcon: Attach brand or domain icons to tools and resources.
  • @McpArg(title = "..."): Provide human-friendly argument labels.
  • @McpResource(size = ..., ttlMs = ..., cacheScope = ...): Let clients cache static documentation or schema resources cleanly.
  • @McpToolParam(header = true): Bind HTTP request headers (such as tenant IDs or correlation IDs) directly into tool parameters without exposing them to the LLM schema.

4. Enterprise Security & Spring AI 2.1 Migration Pitfalls

As you upgrade your MCP servers to Spring AI 2.1, keep three production gotchas on your checklist:

  1. Securing Stateless MCP with OAuth: Stateless POST /mcp plays dramatically better with standard Spring Security OAuth2 Resource Server JWT validation than long-lived SSE streams did. Check out the community spring-ai-community/mcp-security project (highlighted alongside Spring Office Hours S5E29) for ready-made OAuth 2.1 metadata discovery and token enforcement for MCP servers and clients.
  2. Legacy Streamable APIs Without Modern Equivalents Yet: When migrating from STREAMABLE to MODERN, replace ctx.elicit(...)/ctx.sample(...) with InputRequiredResult, and replace ctx.progress(...) with McpSyncNotifier. Note that client logging, ctx.roots(), and ctx.ping() do not yet have equivalents in McpModernSyncRequestContext.
  3. Anthropic Java SDK 3.4.0 Breaking Changes in Spring AI 2.1: If your MCP host application also calls Anthropic models, Spring AI 2.1.0-RC2 upgrades to Anthropic SDK 3.4.0 (API version 2026-10-21), which rejects temperature, topP, and topK (Spring AI deprecates, strips, and logs a WARN) and switches authentication from X-Api-Key to Authorization: Bearer. Also remove any manual cache-token addition in your billing code: Usage.getPromptTokens() now includes prompt cache read and write tokens automatically for both Anthropic and AWS Bedrock Converse.

Conclusion

Stateless protocol=MODERN turns MCP from a fragile laptop prototype protocol into an enterprise-grade HTTP interface ready for auto-scaled Kubernetes clusters. Pairing POST /mcp with requiredCapabilities and Multi-Round-Trip InputRequiredResult gives Java teams the best of both worlds: horizontal scalability on the backend and ironclad human-in-the-loop safety on destructive agent actions.


Discover more from GhostProgrammer - Jeff Miller

Subscribe to get the latest posts sent to your email.

By Jeffery Miller

I am known for being able to quickly decipher difficult problems to assist development teams in producing a solution. I have been called upon to be the Team Lead for multiple large-scale projects. I have a keen interest in learning new technologies, always ready for a new challenge.