Skip to main content

Protocol Topology & 2026-07-28 Stateless Shift

Learn how AI apps send messages to Python servers—and why modern "stateless" requests survive cloud autoscaling without dropping conversations.

Contrast legacy sticky SSE sessions against the 2026-07-28 stateless request model where Mcp-Method, Mcp-Name, and W3C traceparent headers unlock zero-affinity horizontal scaling across Azure Container Apps or Google Cloud Run.

Key Terms in This Lab:ProtocolModel Context Protocol (MCP)In plain English: Before MCP, every AI app needed custom glue code for each database or API. MCP defines one shared language so any AI host can discover and call tools, read reference resources, and use workflow prompts from any compliant server.Analogy: Like USB-C for AI models: one standard plug connects any AI host to any compliant tool server.On Azure Stack: Microsoft Agent Framework calling a FastMCP 4 server hosted on Azure Container Apps.Protocol2026-07-28 Stateless HTTPIn plain English: Instead of keeping a long-lived connection open to one specific server process, each HTTP POST carries everything the server needs (protocol version, target tool, auth, and trace context). Any replica can answer any turn.Analogy: A numbered restaurant order ticket that any kitchen line cook can fulfill without remembering your table.On Azure Stack: Azure APIM load-balances stateless POST /mcp/v2026-07-28 across scaling Container Apps replicas.ProtocolLegacy Stateful SSEIn plain English: In stateful SSE, the client opened a long-lived stream to Replica A and sent follow-up POSTs tied to an in-memory session ID. When serverless autoscaling drains or restarts Replica A, the session breaks immediately.Analogy: A waiter who memorizes your order in their head—if their shift ends mid-meal, your order disappears.On Azure Stack: Fails with 410 Gone during Azure Container Apps revision scale-in behind APIM.ProtocolMcp-Session-Id (Sticky Pinning)In plain English: Stateful servers issue an Mcp-Session-Id header so the load balancer keeps sending you back to the same container. Stateless 2026-07-28 eliminates this header so containers can scale to zero and roll over safely.Analogy: Being forced to wait in the exact same grocery checkout lane even after that lane closes.On Azure Stack: Eliminated by setting stateless_http=True in FastMCP 4 behind Azure APIM.ProtocolMcp-Method & Mcp-Name HeadersIn plain English: API Gateways need to rate-limit, authorize, and route thousands of requests per second cheaply. Putting Mcp-Method (e.g. tools/call) and Mcp-Name (e.g. grade_submission) in HTTP headers lets gateways enforce rules at the edge.Analogy: Printing "FRAGILE · KITCHEN" on the outside of a box so sorters route it without opening the tape.On Azure Stack: Azure APIM XML uses context.Request.Headers.GetValueOrDefault("Mcp-Name") for rate-limit-by-key.ProtocolMCP Primitives (Tool, Resource, Prompt)In plain English: Tools are functions the AI model decides to run (tools/call). Resources are read-only documents addressed by URI that the host app fetches (resources/read). Prompts are reusable workflow templates that a user clicks in the UI (prompts/get).Analogy: Tools = kitchen appliances the chef operates; Resources = pantry reference binder; Prompts = saved recipe cards the customer picks.On Azure Stack: FastMCP 4 exposes @mcp.tool(), @mcp.resource(), and @mcp.prompt() identically on ACA.
Microsoft Azure Stack:
Azure Container Apps (KEDA)Azure API Management (APIM) AI Gateway
Details
Stateless MCP Compute
Azure Container Apps (KEDA)

Scale-to-zero stateless Python FastMCP 4 workers with HTTP concurrency triggers.

GCP equivalent: Cloud Run
AI Gateway & Policy Edge
Azure API Management (APIM) AI Gateway

Declarative XML inbound/outbound policies for Mcp-Method routing and token/tool quotas.

GCP equivalent: Apigee / API Gateway
Concept Escalator

1. Visual Analogy · Stateless Order Ticket vs. Waiter Memorizing Faces

Intuition First
Start Here · Plain-English Concept Brief
~4 min

How does an AI app talk to a Python server that scales to zero and restarts anytime?

Imagine an AI assistant running on cloud servers that automatically spin up during morning class and shut down at night. If your server remembers conversations only in its own RAM, every scale-down erases active users. Stateless HTTP solves this by putting all context inside each individual request.

How this fits: This is Piece 1 (Transport). Before writing Python code or securing student data, your servers need a network transport that never drops requests when cloud containers scale up or down.

  • Legacy Stateful SSE relies on Mcp-Session-Id sticky routing—one server restart breaks the session.
  • 2026-07-28 Stateless HTTP sends Mcp-Method and Mcp-Name headers plus a _meta envelope on every POST.
  • Zero sticky affinity lets Azure Container Apps and Google Cloud Run route around draining containers seamlessly.

Legacy stateful SSE was like a waiter memorizing your whole table in their head—if their shift ends mid-meal, your order vanishes. MCP 2026-07-28 puts every instruction on a self-contained order ticket stamped with Mcp-Method, Mcp-Name, and _meta capabilities so any available serverless replica can fulfill it instantly.

Engineering Takeaway: Zero Mcp-Session-Id pinning means your Python fleet survives revision drains with zero session loss and scales cleanly across Azure Container Apps or Google Cloud Run.
Quick Concept Check (Optional)

Why does Legacy Stateful SSE fail during serverless revision scale-in?

Step 1 of 3 ready? Move on to see how the pieces connect visually.

Engineering Scratchpad

Auto-saved per lab in mcp_foundry_v1_scratchpads

0 chars saved