Where must an instance renegotiate MCP capabilities when an HTTP-native stateless server silently downgrades its tool surface between requests
**Date of Record:** 2026 December 2 **Scope:** Applies to MCP clients that connect to HTTP-native (streamable-HTTP / stateless) MCP servers where each request may be served by a different backend replica and the `initialize` handshake is not guaranteed to be pinned to a single process. Does not apply to stdio-transport servers or stateful SSE sessions with a sticky session token that guarantees capability stability across the connection lifetime.
Core Distinction
The distinction that matters here is between **negotiated capability** and **advertised capability at call time**. In a stateful MCP session, the `initialize` response is a contract: the `tools/list` result you receive is the same surface you will call against for the life of the session. In a stateless HTTP deployment, `initialize` is a *snapshot of one replica at one instant*. The client caches that snapshot as if it were a contract, but the server has made no such promise — the next `POST /mcp` with a `tools/call` may land on a replica running a different tool manifest, a different schema version, or a partially-rolled-out build. The failure is not that the server lies; it is that the client treats a per-request advertisement as a session-level invariant.
This is distinct from ordinary schema drift. Schema drift is a versioned, observable change. This is *capability negotiation divergence*: the client and server disagree about what was agreed, and neither side has a mechanism to detect the disagreement because the negotiation itself was never durable.
What Was Observed
A planner agent was configured against an HTTP-native MCP server exposing a `filesystem` tool family. The `initialize` response during cold start returned a capability block declaring `tools.listChanged: false` and a `tools/list` result containing 14 tools, including `write_file` and `move_file`. The agent cached this manifest, built a plan that assumed atomic `move_file` semantics (write-then-move as a single tool call), and began execution.
Mid-task, a canary deployment shifted 30% of traffic to a replica built from a branch where `move_file` had been split into `copy_file` + `delete_file` pending a safety review, and where `write_file` required an additional `expected_hash` argument for idempotency. The client's cached manifest still listed `move_file` and the old `write_file` schema. The next `tools/call` for `move_file` returned JSON-RPC error `-32601 Method not found` — not a capability error, a *method* error, because the server's dispatcher no longer had that method registered.
The agent's error-handling loop treated `-32601` as a transient routing failure (a reasonable prior for stateless HTTP) and retried three times with backoff. All three retries landed on the downgraded replica. On the fourth attempt the request landed on a healthy replica, `move_file` succeeded, and the agent proceeded — but the preceding `write_file` call, issued during the downgraded window, had been rejected with `-32602 Invalid params` (missing `expected_hash`), which the agent had also retried and eventually succeeded against a healthy replica. The net effect: the file was written twice with different content because the agent's retry logic re-ran a non-idempotent write against a replica that had accepted the first one.
The observable signature was a **split-brain tool surface**: the client's manifest said 14 tools; the server's per-replica manifests said 14, 13, and 14-with-different-schemas depending on which replica answered. No error was surfaced at the protocol layer that said "your negotiated capabilities are stale." The client had to infer it from a `-32601` that it had already classified as retryable.
Condition of Validity
The invariant that was violated is: **in a stateless HTTP MCP deployment, a cached `tools/list` result is valid only for the request that produced it, and any `tools/call` issued against a cached manifest must be treated as a capability *proposal*, not a capability *assertion*.**
This invariant holds precisely when the following conditions are met, and the failure mode described above is only reachable when *all* of them hold:
- The transport is stateless HTTP with no session affinity — the server does not pin a client to a replica for the life of a logical session.
- The server does not implement `tools/listChanged` notifications (or the client does not subscribe to them over a persistent channel, which stateless HTTP cannot provide).
- The deployment performs rolling or canary updates that produce a window in which two or more tool manifests are simultaneously live.
- The client caches the manifest across requests and does not re-validate it before each `tools/call`.
If any one of these is absent, the failure is bounded. If the server pins sessions, the manifest is stable. If it emits `listChanged`, the client can invalidate. If the deployment is atomic (blue-green with a hard cutover), there is no window. If the client re-lists before every call, it pays a latency cost but never acts on a stale manifest. The dangerous configuration is exactly the one that looks most efficient: stateless HTTP + cached manifest + rolling deploy.
The boundary is sharp: the failure does not occur at the moment of deployment. It occurs at the moment a *retry* crosses the deployment boundary. A single request that fails and is not retried is a clean error. A request that fails, is classified as transient, and is retried against a different replica is where the state corruption enters.
Decision Boundary
The decision the client must make, on every `tools/call`, is whether to trust the cached manifest or re-negotiate. The correct boundary is not "re-list always" (too expensive) nor "trust the cache" (unsafe). It is:
- **Trust the cache for the first attempt** of any `tools/call`, because the cost of re-listing on every call is a full round-trip and most calls will succeed.
- **On any error that could indicate capability divergence** — specifically `-32601` (method not found), `-32602` (invalid params, which may indicate a schema change), or a `tools/call` result whose shape does not match the cached output schema — **do not retry against the cached manifest.** Instead, issue a fresh `tools/list`, diff it against the cache, and only proceed if the diff is empty or if the required tool is still present with a compatible schema.
- **On any retry of a non-idempotent tool**, require an idempotency key or a pre-call hash check, because the retry may cross a replica boundary where the first attempt already committed.
The guardrail is a **manifest generation token**. The server should include an opaque `manifest_version` in the `initialize` response and in every `tools/call` error payload. The client stores the version it negotiated and, on any error, compares the error's version to its cached version. If they differ, the client knows the error is a capability divergence, not a transient fault, and must re-negotiate before retrying. Without this token, the client is forced to infer divergence from error codes, which is ambiguous — `-32601` can mean "tool removed" or "request routed to a replica that never had it," and the correct response differs.
Operational Effect
The practical consequence is that **stateless HTTP MCP deployments must treat capability negotiation as a per-request concern, not a per-session concern**, and clients must be built to detect and recover from mid-flight manifest changes without corrupting state. This has three concrete effects:
- **Retry logic must be capability-aware.** A blanket "retry on error with backoff" policy is actively dangerous against a stateless MCP server, because it converts a clean capability mismatch into a state-corruption event. Retries must be gated on a fresh manifest check whenever the error is capability-shaped.
- **Non-idempotent tools require idempotency keys.** Because retries can cross replica boundaries, `write_file`, `move_file`, and any mutating tool must accept a client-supplied idempotency key, and the server must deduplicate on it. Without this, the split-brain window produces duplicate writes.
- **Deployment windows are agent-visible.** A canary rollout that changes the tool surface is not invisible to agents; it is a mid-task capability change that the agent must survive. The correct deployment pattern is to make the manifest change *additive and backward-compatible* during the window (keep `move_file` registered and functional until all replicas agree), or to emit `listChanged` over a persistent channel if one exists. A hard cutover with a mixed window and no notification is the configuration that produces the failure.
The invariant to hold: **the client's cached manifest is a hypothesis, and every mutating call is an experiment that may falsify it.** The client must be prepared to renegotiate on falsification, and the server must give it enough signal (a version token) to distinguish falsification from transient noise.
import hashlib
from dataclasses import dataclass, field
from typing import Optional
class CapabilityDivergenceError(RuntimeError):
"""Raised when a tools/call error indicates the cached MCP manifest
no longer matches the server's actual tool surface."""
pass
class IdempotencyViolationError(RuntimeError):
"""Raised when a non-idempotent tool is retried without an idempotency key."""
pass
@dataclass
class ManifestSnapshot:
version: str
tools: dict # name -> schema dict
idempotent: set = field(default_factory=set)
@dataclass
class McpClient:
cached: Optional[ManifestSnapshot] = None
_idempotency_log: dict = field(default_factory=dict)
def negotiate(self, initialize_response: dict) -> ManifestSnapshot:
version = initialize_response.get("manifest_version")
if not version:
raise CapabilityDivergenceError(
"server did not provide manifest_version; cannot detect divergence"
)
self.cached = ManifestSnapshot(
version=version,
tools=initialize_response["tools"],
idempotent=set(initialize_response.get("idempotent_tools", [])),
)
return self.cached
def call_tool(self, name: str, args: dict, idempotency_key: Optional[str] = None):
if self.cached is None:
raise CapabilityDivergenceError("call_tool before negotiate()")
if name not in self.cached.tools:
raise CapabilityDivergenceError(
f"tool {name!r} not in cached manifest {self.cached.version}"
)
is_mutating = name not in self.cached.idempotent
if is_mutating and idempotency_key is None:
raise IdempotencyViolationError(
f"mutating tool {name!r} requires idempotency_key to survive replica-boundary retries"
)
# Simulated transport: returns (result, error_payload_or_None)
result, err = self._transport(name, args, idempotency_key)
if err is not None:
err_version = err.get("manifest_version")
if err_version and err_version != self.cached.version:
raise CapabilityDivergenceError(
f"manifest divergence: cached={self.cached.version} "
f"server={err_version} tool={name!r} code={err.get('code')}"
)
if err.get("code") in (-32601, -32602):
# Capability-shaped error with no version token: must re-list
raise CapabilityDivergenceError(
f"capability-shaped error {err.get('code')} on {name!r}; "
"renegotiate before retry"
)
raise RuntimeError(f"transient error on {name!r}: {err}")
if idempotency_key:
self._idempotency_log[idempotency_key] = result
return result
def _transport(self, name, args, key):
# Placeholder for HTTP POST /mcp; in production this hits a replica
# chosen by the load balancer and may return a different manifest_version.
return {"ok": True}, None