Showing posts with label MCP. Show all posts
Showing posts with label MCP. Show all posts

Friday, 16 October 2026

The New AI Stack in 2026

Standard


In 2023, the stack was simple: pick a Large Language Model (LLM), wrap it in a chat User Interface (UI), ship. In 2026, production artificial intelligence (AI) looks like a five-layer cake:

Model → Agent → MCP → Tools → Infrastructure

The model reasons. The agent plans, remembers, and enforces policy. Model Context Protocol (MCP) standardizes how the agent reaches the outside world. Tools are the actual systems of record: GitHub, Jira, Customer Relationship Management (CRM), databases, browsers. Infrastructure is where it all runs: gateways, identity, sandboxes, Kubernetes (K8s), observability, and horizontally scaled MCP servers (Model Context Protocol, n.d.; TrueFoundry, 2026; Microsoft, 2026).

Teams that treat "we use GPT" as the whole architecture build demos. Teams that map all five layers build systems that survive contact with enterprise reality.

Key Abbreviations in This Post

  • LLM (Large Language Model): A neural network trained on text for language understanding and generation.
  • SLM (Small Language Model): A compact model optimized for on-device or low-cost inference.
  • MCP (Model Context Protocol): Open standard connecting AI hosts to tools, resources, and prompts (Model Context Protocol, n.d.).
  • API (Application Programming Interface): Programmatic access to software systems.
  • JSON-RPC (JSON Remote Procedure Call): Protocol MCP uses for host-server communication.
  • A2A (Agent-to-Agent): Google's protocol for agent discovery and delegation (Google, n.d.).
  • CRM (Customer Relationship Management): Software for customer records and sales workflows.
  • IAM (Identity and Access Management): Systems governing who or what can access resources.
  • NHI (Non-Human Identity): Credentials used by service accounts, agents, and automation.
  • K8s (Kubernetes): Container orchestration platform for scaling services.
  • SEP (Specification Enhancement Proposal): Formal MCP spec change document.

The One-Minute Version

  • Model: The reasoning engine. Increasingly swappable and partially commoditized.
  • Agent: The product layer. Harness, memory, orchestration, discovery, governance.
  • MCP: The standard wire format between agents and capabilities. Stateless as of July 2026 (Model Context Protocol, 2026).
  • Tools: Real integrations that mutate state in your organization.
  • Infrastructure: Identity, scaling, audit, sandboxes, and policy enforcement outside the model.
  • Moat in 2026: Layers 2 through 5, not layer 1 (TrueFoundry, 2026; Knowlee, 2026).

Old Stack vs New Stack

Era Stack What broke
2023 chatbot Model + UI Human copy-paste integration, no memory, no audit
2024 copilot Model + plugins/RAG Custom glue per integration, tool sprawl in prompt
2026 agent platform Model + Agent + MCP + Tools + Infra Complex, but composable and governable
The New AI Stack (2026) Model → Agent → MCP → Tools → Infrastructure 5. Infrastructure K8s, gateways, identity, sandboxes, observability, stateless MCP scale-out You own this 4. Tools GitHub, Jira, CRM, databases, browsers, file systems, internal APIs Your systems 3. MCP Host / client / server, JSON-RPC, discovery, auth, tool schemas Standard wire 2. Agent Harness, memory, orchestration, discovery, policy, human gates Your product 1. Model GPT, Claude, Gemini, Phi, local SLMs: reasoning engine, swappable Commodity ↓ ↓ ↓ ↓ ↓ Value and risk accumulate as you move down the stack

Layer 1: Model (The Engine, Not the Product)

The model is where most conversations start and where least durable advantage lives in 2026. GPT-6 Astra, Claude Opus-class, Gemini, Phi-4-reasoning, local Small Language Models (SLMs) on laptop Neural Processing Units (NPUs): all are interchangeable inputs to the same agent harness (OpenAI, 2026; Microsoft Research, 2025; Chandra & Krishnamoorthi, 2026).

What the model provides:

  • Language understanding and generation.
  • Reasoning over context (quality varies by tier).
  • Tool-call intent: which function to invoke with what arguments.

What the model does not provide:

  • Persistent memory across sessions (unless the agent layer adds it).
  • Reliable multi-step workflow execution.
  • Authentication, authorization, or audit trails.
  • Guaranteed correct tool selection from 400 similar schemas.

Smart teams pick models by task routing: frontier cloud for hard reasoning, local SLM for high-volume classification, mid-tier for cost-sensitive agent loops (Chandra & Krishnamoorthi, 2026). The model is the engine. You do not sell the engine. You sell the car.

Layer 2: Agent (Where the Product Lives)

An agent is not a model with a system prompt. It is a runtime that wraps the model in a loop:

  1. Observe context (user message, memory, tool results).
  2. Reason and plan next action.
  3. Call tools or delegate to sub-agents.
  4. Update state, retry on failure, escalate to humans.
  5. Repeat until done or bounded.

The agent layer includes components that separate demos from production (MindStudio, n.d.; Agent Operating System, 2026):

  • Harness: Retry logic, context management, subagent spawning, evaluators (OpenAI, 2026).
  • Memory: Session, user, and org knowledge that survives turns and tabs.
  • Orchestration: LangGraph-style workflows with explicit state, not hidden prompt chains (TrueFoundry, 2026).
  • Tool discovery: Progressive loading, semantic routing, MCP-Zero-style catalogs instead of dumping 2,800 schemas into context (Xu et al., 2025; Spring AI, n.d.).
  • Governance: Human approval gates, policy checks, misalignment monitoring (OpenAI, 2026; OWASP GenAI Security Project, 2025).

Microsoft's Windows agent runtime, OpenAI Codex, and Amazon Bedrock AgentCore all sit at this layer. The model inside can change. The harness is what users and enterprises actually depend on (Microsoft, 2026; Eluna, 2026).

Layer 3: MCP (The Standard Wire)

Before MCP, every agent platform invented its own plugin format. Salesforce had one shape. GitHub Copilot another. Internal platforms a third. MCP replaces that fragmentation with a shared protocol (Model Context Protocol, n.d.).

Three roles:

  • Host: The AI application (Cursor, Claude Desktop, Copilot, your agent platform).
  • Client: One JSON-RPC client per server connection, inside the host.
  • Server: Your integration exposing tools, resources, and prompts.

MCP servers expose:

  • Tools: Callable functions (create_ticket, run_query).
  • Resources: Readable data (files, database views).
  • Prompts: Reusable templates.

The July 2026 spec made remote MCP stateless: no session handshake, no sticky pods. Each HTTP request carries client identity in _meta. Gateways read Mcp-Method and Mcp-Name headers for routing (Model Context Protocol, 2026). That turns MCP from a local dev trick into production infrastructure behind load balancers.

MCP is not the only protocol. Google's Agent-to-Agent (A2A) handles delegation between agents. Many teams use both: MCP for tools, A2A for multi-agent handoffs (Google, n.d.). Think of MCP as USB-C for capabilities. A2A is the office phone system between departments.

Layer 4: Tools (Where State Actually Changes)

Tools are the reason agents matter. A tool call creates a Jira ticket, charges a card, deletes a file, merges a pull request. This is where blast radius lives (Cloud Security Alliance, 2026).

Tools arrive through several patterns in 2026:

  • MCP servers: Packaged integrations (official GitHub MCP, internal CRM MCP).
  • Agent Connectors: Microsoft Windows on-device registry for File Explorer, Settings, and third-party connectors (Dave R, 2026).
  • Native computer use: GPT-6 Astra driving browser and desktop directly, bypassing formal tool schemas for some tasks (OpenAI, 2026).
  • Legacy APIs: Wrapped behind MCP servers so agents never touch raw REST (Representational State Transfer) diversity.

Tool design principles that survive production:

  • Small surface area. Prefer search_issues and update_issue over one mega-tool that does everything.
  • Explicit schemas. Clear names reduce wrong-tool errors when catalogs grow (Spring AI, n.d.).
  • Idempotent where possible. Agents retry. Non-idempotent tools need guardrails.
  • Backend enforcement. Never rely on the model to respect "do not delete" in the system prompt (Cloud Security Alliance, 2026).

MCPTox showed 72.8% success poisoning tool metadata on real MCP servers. Tool definitions are part of your attack surface, not documentation (MCPTox, 2026).

Layer 5: Infrastructure (Where Trust Is Enforced)

Infrastructure is everything that must work even when the model is wrong. It sits below MCP and tools and enforces reality (Agent Operating System, 2026; Microsoft, 2026):

  • Identity and access. Dedicated Non-Human Identity (NHI) per agent, just-in-time credentials, tested revocation (Cloud Security Alliance, 2026; IDC, 2026).
  • API gateways. Rate limits, auth, routing for stateless MCP replicas on Kubernetes, Cloud Run, or Lambda.
  • Sandboxing. Microsoft Execution Containers (MXC), agent workspaces, cloud PCs for isolated execution (Microsoft, 2026).
  • Observability. Tool-call logging with principal, arguments, and outcome to a sink the agent cannot modify (Cloud Security Alliance, 2026).
  • Policy engines. Block destructive actions outside declared scope regardless of model intent.
  • Data plane. Databases, queues, and secrets stores where tool side effects land.

Eluna runs production warehouse agents on Amazon Bedrock AgentCore with graph-guided Standard Operating Procedure (SOP) execution. The model reasons. The infrastructure guarantees procedural compliance and auditability (Eluna, 2026). That split is the whole point of the five-layer model.

How a Request Flows Through the Stack

Example: "Refund order 4821 and notify the customer."

  1. Model parses intent and proposes a plan: lookup order, validate policy, issue refund, send email.
  2. Agent loads memory (prior interactions with this customer), checks approval policy (refunds over $500 need human gate), selects tools via discovery (not all 200 schemas).
  3. MCP routes tools/call to the Stripe MCP server and the email MCP server with authenticated client identity in _meta.
  4. Tools execute: Stripe API refund, CRM status update, SendGrid message.
  5. Infrastructure logs each call, enforces OAuth scopes, rate-limits the agent identity, and stores audit records for compliance.

If the model hallucinates a refund amount, infrastructure and tool backends catch it. If MCP metadata is poisoned, gateway inspection and schema pinning catch it. If the agent loops, orchestration checkpoints and budgets stop it. No single layer carries the full burden.

What Breaks When You Skip a Layer

Missing layer Symptom
No agent layer Chatbot that cannot sustain multi-step work or recover from failures
No MCP (ad-hoc plugins) N integrations = N custom wire formats, no shared discovery or audit
No real tools Agent generates text about actions but nothing in systems of record changes
No infrastructure Prompt injection becomes data breach; no identity, scale, or kill switch
Model-only focus Benchmark wins, production losses when tool catalog exceeds context

Real-World Use Cases (Problem → Cause → Effect)

1. IDE assistant that only swapped models

Problem: Team upgraded from GPT-5.6 Sol to GPT-6 Astra expecting 2x productivity. Gains were marginal.

Cause: Harness was unchanged: no parallel sessions, no git worktree isolation, no context notes across windows. Model swap without agent layer investment (OpenAI, 2026; Microsoft, 2026).

Effect: GitHub Copilot app with agent-native harness (parallel sessions, CI babysitting) captured the value. Model was necessary; harness was sufficient.

2. Enterprise MCP behind a load balancer

Problem: Remote MCP worked on localhost, failed in Kubernetes with session errors on the second request.

Cause: Pre-2026 stateful MCP pinned clients to pods. Sticky sessions were fragile (Model Context Protocol, 2026).

Effect: Stateless MCP (July 2026 spec) let any replica serve any request. Infrastructure layer finally matched REST-style deployment patterns.

3. Support agent with 400 tools in prompt

Problem: Agent picked wrong Jira action 30% of the time. Context window half-consumed before user spoke.

Cause: No discovery layer. Model layer alone cannot navigate large catalogs (Spring AI, n.d.; Xu et al., 2025).

Effect: Progressive MCP discovery cut initial context 70 to 90% and improved selection accuracy. Agent layer fix, not model fix.

4. "Local AI" app that synced everything to cloud

Problem: Marketing claimed on-device inference. Security review found customer data leaving the device.

Cause: Model ran locally; agent layer still posted outputs to a cloud analytics endpoint (Beagle, 2026).

Effect: Stack audit required tracing all five layers. Privacy lives in infrastructure and agent design, not model location alone.

Build Order for Teams Starting Today

  1. Pick one bounded workflow. Refund processing, ticket triage, code review. Not "general assistant."
  2. Wrap it in an agent harness. Explicit state, retries, human gates, memory scope.
  3. Expose tools via MCP. One server per domain (billing, CRM, email). Stateless HTTP for production.
  4. Implement backend enforcement on tools. Scopes, idempotency keys, rate limits.
  5. Add infrastructure before scale. Agent identity, gateway, logging, sandbox. OWASP ASI Top 10 as checklist (OWASP GenAI Security Project, 2025).
  6. Choose model last and route by task. Swap freely once layers 2 through 5 are solid.

The new AI stack is not a model picker. It is an architecture:

Model → Agent → MCP → Tools → Infrastructure

The model thinks. The agent acts with memory and policy. MCP connects. Tools mutate real state. Infrastructure enforces trust when the model is wrong, the tool is poisoned, or the agent loops too far.

In 2023, buying GPT access was the strategy. In 2026, the strategy is building layers 2 through 5 so well that the model becomes a replaceable part. The teams winning on agents are not winning on parameters. They are winning on stack discipline.

Map your system against all five layers. Fix the missing floor before you upgrade the engine.

References

  • Agent Operating System. (2026). The agent operating system (AOS): A reference operating architecture for distributed agentic systems. arXiv. https://arxiv.org/abs/2608.03214
  • Beagle. (2026). Understand Microsoft Aion 1.0 before you plan your deployment. https://www.heybeagle.com/blog/understand-microsoft-aion-1-0-before-you-plan-your-deployment
  • Chandra, V., & Krishnamoorthi, R. (2026). On-device LLMs: State of the union, 2026. Meta. https://v-chandra.github.io/on-device-llms/
  • Cloud Security Alliance. (2026). Autonomous by design, uncontrolled by default. https://labs.cloudsecurityalliance.org/wp-content/uploads/2026/09/CSA_whitepaper_agentic_ai_loss_of_control_20260908-csa-styled.pdf
  • Dave R. (2026). Inside the Windows agent platform. ITNEXT. https://itnext.io/inside-the-windows-agent-platform-how-microsoft-turned-the-os-into-a-secure-runtime-for-1-3-a980ac1d58b0
  • Eluna. (2026). Eluna: An agentic LLM system for automating warehouse operations. arXiv. https://arxiv.org/html/2607.08960v2
  • Google. (n.d.). Agent2Agent (A2A) protocol. https://google.github.io/A2A/
  • IDC. (2026). IDC research finds AI agents outpacing security teams. https://ittech-pulse.com/news/idc-research-finds-ai-agents-outpacing-security-teams-sponsored-by-guidepoint-security/
  • Knowlee. (2026). The agentic operating system. https://www.knowlee.ai/blog/agentic-operating-system-business
  • MCPTox. (2026). MCPTox: A benchmark for tool poisoning on real-world MCP servers. AAAI. https://ojs.aaai.org/index.php/AAAI/article/view/40895
  • Microsoft. (2026). Microsoft Build 2026: Be yourself at work. https://blogs.microsoft.com/blog/2026/06/02/microsoft-build-2026-be-yourself-at-work/
  • MindStudio. (n.d.). What is an agentic operating system? https://www.mindstudio.ai/blog/what-is-agentic-operating-system
  • Model Context Protocol. (2026). Specification (2026-07-28 stateless update). https://modelcontextprotocol.io/
  • Model Context Protocol. (n.d.). Architecture overview. https://modelcontextprotocol.io/docs/concepts/architecture
  • OpenAI. (2026). GPT-6 Astra: A new generation of intelligence. https://openai.com/index/gpt-6-astra/
  • OWASP GenAI Security Project. (2025). OWASP Top 10 for agentic applications 2026. https://genai.owasp.org/download/52117
  • Microsoft Research. (2025). Phi-4-reasoning technical report. https://www.microsoft.com/en-us/research/publication/phi-4-reasoning-technical-report/
  • Spring AI. (n.d.). Tool calling and MCP integration. https://docs.spring.io/spring-ai/reference/api/tools.html
  • TrueFoundry. (2026). Agent orchestration in production. Referenced via industry deployment patterns.
  • Xu, Y., et al. (2025). MCP-Zero: Proactive tool discovery for LLM agents. arXiv. https://arxiv.org/abs/2505.07874

Sunday, 30 August 2026

Stateless MCP: What Changed, Why It Matters, and How to Build for Scale

Standard

 


If you deployed a remote MCP server in 2025, you probably hit the same wall I did: it worked fine on localhost, then fell apart behind a load balancer. Request two landed on a different pod and came back with a session error. The fix was always some combination of sticky sessions, Redis, or a custom gateway. That was not a bug in your code. It was the protocol.

The 2026-07-28 Model Context Protocol (MCP) specification changes that. MCP is now stateless at the transport layer. Each Hypertext Transfer Protocol (HTTP) request carries everything the server needs. Any replica can answer it. For teams treating MCP as production infrastructure, not a local dev trick, this is the biggest shift since remote MCP launched.

Key abbreviations in this post

  • API — Application Programming Interface
  • AWS — Amazon Web Services
  • HTTP — Hypertext Transfer Protocol
  • JSON — JavaScript Object Notation
  • JSON-RPC — JSON Remote Procedure Call
  • K8s — Kubernetes
  • LLM — Large Language Model
  • MCP — Model Context Protocol
  • MRTR — Multi Round-Trip Requests
  • OAuth — Open Authorization
  • OpenTelemetry — open standard for traces, metrics, and logs
  • PEP — Python Enhancement Proposal
  • REST — Representational State Transfer
  • RFC — Request for Comments
  • RPC — Remote Procedure Call
  • SaaS — Software as a Service
  • SDK — Software Development Kit
  • SEP — Specification Enhancement Proposal
  • SSE — Server-Sent Events
  • SKU — Stock Keeping Unit
  • stdio — standard input/output

MCP in 60 Seconds

The Model Context Protocol (MCP) is an open standard for connecting AI applications to external tools, data, and prompts. Think of it as a structured Application Programming Interface (API) layer built for Large Language Model (LLM) hosts rather than generic Representational State Transfer (REST) clients.

The architecture has three roles (Model Context Protocol, n.d.):

  • Host — the AI app you actually use (Cursor, Claude Desktop, an internal agent platform).
  • Client — one client per server connection, living inside the host. It speaks JSON Remote Procedure Call (JSON-RPC) 2.0 on behalf of the host.
  • Server — your integration. It exposes tools (callable functions), resources (readable data), and prompts (templates).

Local servers usually run over stdio (standard input/output): the host spawns a subprocess and talks over stdin/stdout. Remote servers use Streamable HTTP (Hypertext Transfer Protocol) on a real port. That is the deployment path that needed statelessness.

That is the whole stack in brief. The rest of this post is about what changed when MCP stopped pretending every HTTP (Hypertext Transfer Protocol) deployment was a single long-lived conversation.

What "Stateless MCP" Actually Means

Before spec version 2026-07-28, a remote MCP client had to:

  1. Send an initialize request with protocol version and capabilities.
  2. Receive an Mcp-Session-Id header from the server.
  3. Include that session ID on every later call, often over a held-open Server-Sent Events (SSE) stream.

The server kept session state in memory (or Redis). The client was pinned to whichever instance created that session. Scale-out required sticky routing and shared session stores (Model Context Protocol, 2026; Van Gent & Blount, 2026).

Stateless MCP removes that contract entirely. Each change below is tracked as a numbered Specification Enhancement Proposal (SEP), MCP's formal design document for spec changes (similar to a Python Enhancement Proposal (PEP) in Python or a Request for Comments (RFC) on the web):

  • SEP-2575 (Specification Enhancement Proposal) retires the initialize / initialized handshake.
  • SEP-2567 (Specification Enhancement Proposal) removes the Mcp-Session-Id header.
  • Every request includes client identity and capabilities in a _meta object.
  • Optional server/discover Remote Procedure Call (RPC) replaces "connect first, then ask what you can do."
  • SEP-2243 (Specification Enhancement Proposal) puts Mcp-Method and Mcp-Name in HTTP (Hypertext Transfer Protocol) headers so gateways can route without parsing JSON (JavaScript Object Notation) bodies.
Stateless MCP Request Flow (2026-07-28) MCP Client Inside AI host Load Balancer Round-robin Pod A Pod B Pod C Any pod handles any request Self-contained POST /mcp HTTP headers: MCP-Protocol-Version: 2026-07-28 Mcp-Method: tools/call Mcp-Name: search_inventory JSON body includes: method, params, arguments, _meta (clientInfo, capabilities) No initialize handshake. No Mcp-Session-Id.

Working process step by step

  1. The host decides to call a tool (for example, search_inventory with a Stock Keeping Unit (SKU)).
  2. The MCP client builds a JSON Remote Procedure Call (JSON-RPC) tools/call payload and attaches _meta with protocol version, client name, and capabilities.
  3. The client POSTs to /mcp with headers MCP-Protocol-Version, Mcp-Method, and Mcp-Name.
  4. A load balancer forwards the request to any healthy server instance.
  5. The server validates headers against the body, runs the tool handler, and returns a JSON response. No session lookup.
  6. If the tool needs user input mid-flight, the server returns a Multi Round-Trip Requests (MRTR) inputRequired result with a requestState blob. The client retries on any instance with answers attached (Model Context Protocol, 2026).

One nuance worth stating clearly: stateless protocol does not forbid application state. If your workflow spans multiple tool calls, mint an explicit handle (a task ID, a draft ID) from the first tool and pass it back as an argument. That is visible to the model and survives load balancing. Hidden session state in the transport was the part that had to go.

Why We Needed This

MCP exploded as the default way to wire agents to Software as a Service (SaaS) APIs, databases, and internal services. Downloads across Tier 1 Software Development Kits (SDKs) crossed into the hundreds of millions per month (Model Context Protocol, 2026). Most of that growth pointed at remote HTTP (Hypertext Transfer Protocol) servers, not local stdio (standard input/output) subprocesses.

The old session model created real production pain (Van Gent & Blount, 2026; New Relic, 2026):

  • Broken round-robin. Standard load balancers sent the second request to a pod that never saw the session.
  • Sticky session tax. Affinity rules skew traffic and fight autoscaling.
  • Fragile deploys. Rolling updates dropped in-memory sessions and surfaced transient 400 errors to active chats.
  • Extra infrastructure. Teams bolted on Redis or gateway packet inspection just to keep MCP alive at scale.
  • Gateway blind spots. Rate limits and audit rules could not key off method or tool name without parsing JSON (JavaScript Object Notation) bodies.

Stateless MCP makes remote servers behave like normal HTTP (Hypertext Transfer Protocol) microservices. That sounds obvious. For a protocol born on stdio (standard input/output), it is a necessary maturation step.

Stateful vs Stateless MCP

Aspect Stateful MCP (pre-2026-07-28) Stateless MCP (2026-07-28)
Connection setup initialize handshake required No handshake; optional server/discover
Session tracking Mcp-Session-Id on every request No protocol-level session ID
Client context Sent once at connect time Sent in _meta on every request
Load balancing Sticky sessions or shared session store Plain round-robin across replicas
Serverless / scale-to-zero Poor fit; sessions die on cold start Natural fit (Cloud Run, Lambda, Workers)
Gateway routing Often requires JSON (JavaScript Object Notation) body inspection Mcp-Method and Mcp-Name headers
Mid-call user prompts Open bidirectional Server-Sent Events (SSE) stream Multi Round-Trip Requests (MRTR) with requestState retry
Long-running work Block connection or custom hacks Tasks extension with poll-based status
Payload size trade-off Smaller per-call payloads after handshake Slightly larger requests (metadata repeated)
Best transport locally stdio (standard input/output) still fine either way stdio (standard input/output) unchanged; HTTP (Hypertext Transfer Protocol) gains the most

Real Use Cases

Stateless MCP is not academic. It unlocks patterns teams were already hacking together:

  • Enterprise tool gateways. One MCP endpoint fronting dozens of internal APIs (Application Programming Interfaces), rate-limited per tool name at the edge (Microsoft Foundry, Amazon Web Services (AWS) Bedrock AgentCore, and others ship variations of this).
  • Multi-tenant SaaS (Software as a Service) MCP. GitHub and similar providers removed Redis session stores after upgrading, cutting latency on every call (Van Gent & Blount, 2026).
  • Global deployment. Any region, any replica, same request shape. No cross-region session replication.
  • Agent fleets at scale. Thousands of concurrent agent sessions hitting the same tool server without affinity tuning.
  • Serverless MCP. Spin down to zero between bursts; the next request is self-contained.
  • Compliance-friendly auditing. Log Mcp-Name and auth subject per request without holding connection state.

Deployment Architecture

A production layout looks familiar if you have shipped REST (Representational State Transfer) APIs before. The protocol no longer fights you.

Stateless MCP Deployment Architecture AI Hosts Cursor, Claude, agents API Gateway Auth, rate limit, route Reads Mcp-Method / Mcp-Name Horizontally scaled MCP servers Replica 1 Replica 2 Replica N Kubernetes (K8s), Cloud Run, Lambda, App Service Backend services (state lives here if needed) Database Task store External APIs Protocol layer: stateless. Application layer: state in database (DB) or explicit handles.

Benefits in this layout:

  • Horizontal pod autoscaling on Central Processing Unit (CPU) or request rate, not session count.
  • Zero-downtime deploys without draining sessions.
  • Open Authorization (OAuth) at the gateway with Request for Comments (RFC) 9207 issuer validation (SEP-2468 (Specification Enhancement Proposal)).
  • OpenTelemetry traces correlated per request, not per opaque session.
  • ttlMs (time-to-live in milliseconds) and cacheScope on list responses (SEP-2549 (Specification Enhancement Proposal)) so clients cache tool catalogs safely.

Example: Stateless MCP Server in Python

The v2 Python Software Development Kit (SDK) targets spec 2026-07-28. The high-level Application Programming Interface (API) is MCPServer. Transport options belong on run(), not the constructor (Model Context Protocol, n.d.-b).

# server.py — stateless inventory MCP server
from mcp.server import MCPServer

mcp = MCPServer(
    "InventoryTools",
    instructions="Look up product stock by SKU.",
)

@mcp.tool()
def search_inventory(sku: str) -> str:
    """Return stock level for a warehouse SKU."""
    # Replace with a real DB/API call in production.
    catalog = {"SKU-1001": 42, "SKU-2002": 0}
    qty = catalog.get(sku.upper())
    if qty is None:
        return f"No product found for {sku!r}."
    return f"{sku.upper()}: {qty} units in stock."

if __name__ == "__main__":
    mcp.run(
        transport="streamable-http",
        host="0.0.0.0",
        port=8000,
        stateless_http=True,
        json_response=True,
    )

Install and run:

pip install "mcp[cli]>=2.0.0"
python server.py
# or: uv run mcp dev server.py

What each piece does:

  • @mcp.tool() registers a callable the host can invoke. Docstrings become tool descriptions for the model.
  • transport="streamable-http" exposes the server on a port at /mcp for remote clients over Hypertext Transfer Protocol (HTTP).
  • stateless_http=True creates a fresh transport per request with no session tracking. This aligns the SDK (Software Development Kit) with the stateless protocol core.
  • json_response=True returns one JSON body per POST instead of a Server-Sent Events (SSE) stream. Good default for simple tool servers behind load balancers.

A client call (from the same Software Development Kit (SDK)) looks like this:

import asyncio
from mcp import Client

async def main() -> None:
    async with Client("http://localhost:8000/mcp") as client:
        result = await client.call_tool(
            "search_inventory",
            {"sku": "SKU-1001"},
        )
        print(result.structured_content)

asyncio.run(main())

Each call_tool is an independent HTTP (Hypertext Transfer Protocol) round trip. Hit the server from three terminals at once and any replica can serve any call. That is the behavior you want in staging before you trust it in production.

Migration Checklist

If you are upgrading from MCP v1 SDKs (Software Development Kits) or pre-2026 HTTP (Hypertext Transfer Protocol) servers:

  1. Bump to Software Development Kit (SDK) v2 (Python mcp>=2.0, TypeScript @modelcontextprotocol/server@beta or later).
  2. Replace FastMCP imports with MCPServer.
  3. Move stateless_http and port settings from the constructor to run().
  4. Delete sticky-session config and shared Redis session stores used only for MCP transport.
  5. Replace session-keyed application state with explicit IDs returned from tools.
  6. Rewrite elicitation flows around Multi Round-Trip Requests (MRTR) instead of open back-channels.
  7. Add ttlMs (time-to-live in milliseconds) / cacheScope to list handlers where catalog caching helps.

Important Links and Repositories

Bottom Line

MCP started as a clean way to plug tools into a local AI assistant. Stateless HTTP (Hypertext Transfer Protocol) turns it into something you can run the way you run the rest of your stack: behind a load balancer, across regions, on serverless, with ordinary observability.

The trade is slightly larger requests and a migration sprint if you built on sessions. The payoff is boring scaling, which is exactly what you want once agents stop being a demo and start being a product surface.

If you are starting fresh, build on 2026-07-28 and skip the session workarounds entirely. If you are maintaining an existing remote server, treat this like any other protocol upgrade: staged rollout, benchmark your payload sizes, delete the Redis session layer when receipts prove you do not need it.

Bibliography

  • Model Context Protocol. (2026, July 28). The 2026-07-28 specification. Model Context Protocol Blog. https://blog.modelcontextprotocol.io/posts/2026-07-28/
  • Model Context Protocol. (n.d.). Architecture. https://modelcontextprotocol.org/docs/learn/architecture
  • Model Context Protocol. (n.d.-b). Running your server. MCP Python SDK. https://py.sdk.modelcontextprotocol.io/v2/run/
  • New Relic. (2026). MCP is going stateless: What the new spec means for AI agents. https://newrelic.com/blog/ai/mcp-is-going-stateless
  • Van Gent, K., & Blount, A. (2026, August 5). Scaling AI agent infrastructure with the MCP stateless updates. Google Developers Blog. https://developers.googleblog.com/scaling-ai-agent-infrastructure-with-the-mcp-stateless-updates/