An autoscaled MCP service needs a lifecycle design that matches the clients it actually supports. For July 2026 MCP, requests carry their own protocol metadata and the transport no longer uses protocol sessions. Older supported Streamable HTTP revisions can still use initialization and optional sessions. Choose a modern-only or dual-era implementation from an explicit client inventory; adding more instances does not make either era inherently incompatible.
Write the compatibility worksheet first
Record each host build, SDK version, transport, protocol revision and authentication path. Then add whether the server requires process-local state, durable application state or no protocol session state. These are separate dimensions. A legacy server may be intentionally stateless, while a modern request can still start a durable business operation whose status must survive instance replacement. Neither a protocol date nor a session identifier describes your entire persistence design.
The July 2026 Streamable HTTP specification removes the standalone GET stream and protocol-level sessions and describes backward compatibility. Earlier Streamable HTTP revisions remain implementable through their own lifecycle rules. This makes request metadata a useful routing input, but accepting the new header alone is not a complete upgrade.
MCP Streamable HTTP: revision changes and backward compatibility
Trace a request across two instances
Use a synthetic load-balancer trace with instance A and instance B. Under a legacy design with required state held only in A's memory, initialization on A followed by a call on B needs an explicit solution. That solution might be shared state, an implementation that avoids required session state, or routing behavior that you have verified under failover. Sticky routing alone leaves instance termination and scale-down unresolved.
In a modern design, B receives the declared version, identity and capabilities with its request instead of depending on an earlier initialization stored on A. B must still authenticate the caller, validate mirrored headers and resolve application permissions. An export job created on A must be stored durably if B is expected to report its status. Removing protocol sessions does not turn an in-memory job dictionary into a durable queue.
| Design | Request on B | Replacement question |
|---|---|---|
| Legacy, local session state | Needs the earlier state | How is it recovered? |
| Legacy, shared required state | Resolve shared session contract | Does cleanup preserve active work? |
| Modern, request metadata | Validate this request independently | Where does job status live? |
Keep stream lifetime separate from job lifetime
A request-scoped stream occupies a network connection and some execution resources. A durable report or write has a business identity that may outlive a network connection only if your application explicitly supports that behavior. Define what happens when the client disconnects under the chosen revision. Do not copy a resumable-stream design from an older transport into a newer one without checking cancellation and response rules.
For the worksheet, write one line per operation: expected duration, side effects, durable status location, cancellation behavior and reconciliation method. A read-only summary may simply be cancelled. A committed billing update needs an accurate final state even if the reply is lost. A queued export needs an authorized status lookup and artifact retention policy. These decisions belong in application services shared by the MCP adapter and other clients.
Synthetic sequence to inspect, not an executed Cloud Run trace
1. A receives discover or legacy initialize.
2. B receives an authorized read request.
3. A is replaced before the next request.
4. B receives status lookup or the next permitted read.
5. Client handles the declared lifecycle and response contract.Test the deployment boundary you intend to rely on
Use a disposable service with two identifiable instances and synthetic records. Exercise a second request on another instance, instance replacement, a slow stream and a denied account. Retain request IDs, revision labels and final operation state; avoid token or customer-content logs. Compare maximum concurrent streams with connection-pool occupancy because an otherwise stateless adapter can still exhaust database capacity.
The dual-era trace above is a proposed test plan, not a claimed Cloud Run measurement. Before changing a live service, pin the server implementation and run it with the actual supported hosts. Keep older clients on a documented compatibility path until that path is deliberately retired. A useful upgrade gate proves both the new lifecycle and the continued behavior promised to installed clients.
MCP vs REST API: when an agent adapter earns its place
Evaluate the tool action, not just the answer.
Bring one tool workflow, supported hosts and a sanitized failure trace for a scoped AI integration review.
AptixLabs ai agent development
How should MCP sessions be designed for Cloud Run autoscaling?
Match state handling to supported revisions: modern July 2026 requests carry metadata per request; legacy session behavior needs an explicit cross-instance design.
Are legacy MCP sessions automatically broken on Cloud Run?
No. A supported legacy implementation can use an explicit shared-state, stateless or verified routing design with failover behavior.
Does modern MCP remove the need for durable job storage?
No. Application jobs, authorization and side-effect reconciliation remain separate from protocol session state.
