PromptisePromptise
PlatformSoonEnterprise
DocsGitHub
Talk to usGet started
Promptise - AI Framework LogoPromptise

The full-stack framework for agentic systems. Build with the framework. Run it on the platform. Launch it with our engineers.

pip install promptise

[01] Product

  • Framework
  • Platform (coming soon)
  • Enterprise
  • How it works
  • Contact

[02] Framework

  • The Agent
  • The Interface
  • The Harness

[03] Resources

  • Documentation
  • GitHub
  • Why Promptise
  • Use cases
  • Roadmap
  • Guides
  • Learning Paths
  • Questions

[04] Company

  • About
  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Subprocessors

© 2026 Promptise by Manser Ventures. All rights reserved.

hello@promptise.com
← Learning paths> Agentic Engineering with Promptise Foundry
Lesson 22 / 100
22%

MCP 2026-07-28 Migration: Make Your MCP Server Stateless

Migrate an MCP server to the stateless 2026-07-28 spec: what changed, how to replace sessions and elicitation, and a runnable before and after in Python.

Advanced22 minModel Context Protocol (MCP)DeploymentHuman-in-the-Loop
All 100 lessons↓
  1. ✓What Is an AI Agent? Definition, How It Works, Examples
  2. ✓How to Build an AI Agent in Python (2026 Guide)
  3. ✓Build a Personal AI Agent: Memory, Reminders, Chat
  4. ✓What Is an Agent Harness? Parts and How to Build One
  5. ✓System Prompt Best Practices for AI Agents in Python
  6. ✓Best LLM for AI Agents (2026): Picks, Prices, How to Test
  7. ✓AI Agent YAML: Define and Run an Agent From a Config File
  8. ✓Streaming LLM Responses with FastAPI: Tokens and Tool Calls
  9. ✓Best Local LLM for AI Agents: Ollama Models by GPU (2026)
  10. ✓Claude AI Agent with MCP: Use Anthropic Models in Promptise
  11. ✓Gemini AI Agent with MCP: Use Google Models in Promptise
  12. ✓Azure OpenAI Agent with MCP: Use Deployments in Promptise
  13. ✓OpenRouter AI Agent with MCP: Many Models in Promptise
  14. ✓Ollama AI Agent with MCP: Run Local Models in Promptise
  15. ✓LLM Semantic Cache and Model Fallback in Python
  16. ✓What Is MCP (Model Context Protocol)? A Developer's Guide
  17. ✓What Is Tool Calling? LLM Function Calling Explained
  18. ✓MCP Tools vs Resources vs Prompts (With Python Examples)
  19. ✓How to Connect MCP Servers to Your AI Agent in Python
  20. ✓Build a Production MCP Server in Python (Step by Step)
  21. ✓MCP Transports: stdio vs Streamable HTTP vs SSE (Python)
  22. 22MCP 2026-07-28 Migration: Make Your MCP Server Stateless
  23. 23OpenAPI to MCP: Turn Any REST API into an MCP Server
  24. 24MCP Authentication in Python: API Keys, JWT and OAuth
  25. 25Build an Authenticated MCP Server for Your AI Agent (Python)
  26. 26MCP Security Best Practices: A Checklist for MCP Servers
  27. 27Testing MCP Servers in Python: pytest Without a Live Server
  28. 28Too Many MCP Tools? How to Fix LLM Tool Selection in Python
  29. 29Idempotent Tool Calls: Make AI Agent Retries Safe
  30. 30AI Agent Tool Failures: Stop Unsafe Workarounds
  31. 31MCP Server Caching, Timeouts and Circuit Breakers in Python
  32. 32MCP Middleware for Servers: Auth, Logging, Rate Limits
  33. 33MCP vs CLI for AI Agents: Tokens, Security, When to Use Each
  34. 34LangChain vs MCP: Differences and How They Work Together
  35. 35FastMCP Alternatives for Production MCP Servers (2026)
  36. 36AI Agent Audit Logging: Tamper-Evident Logs in Python
  37. 37AI Agent Human in the Loop: Approve Tool Calls in Python
  38. 38AI Agent Prompt Injection: How to Defend Against It
  39. 39Hidden Text Prompt Injection: Sanitize Pages for AI Agents
  40. 40Build a Multi-Agent System in Python (and When Not To)
  41. 41Context Engineering for AI Agents: Context Window Management
  42. 42Context Compaction for AI Agents: Trim vs Summarize
  43. 43How to Deploy an AI Agent with Docker (2026 Guide)
  44. 44LLM Tool Rate Limiting: Per-Client Limits for MCP Servers
  45. 45MCP Long-Running Tasks: Background Jobs in Python
  46. 46MCP Server Monitoring: Prometheus, OpenTelemetry and Logs
  47. 47Best AI Agent Frameworks (2026): Python Options Compared
  48. 48Self-Improving AI Agent: Learn From Tool Failures in Python
  49. 49AI Agent Identity: Authenticate Agents to MCP Servers
  50. 50Code-Action Agents in Python: One Program vs 37 Tool Calls
  51. 51Multi-Tenant AI Agents: Keep Each Customer's Data Apart
  52. 52What Is Agentic RAG? How It Differs from Classic RAG
  53. 53AI Agent Memory in Python: Short-Term and Long-Term
  54. 54Per-User Agent Memory Isolation: Stop Leaks Between Users
  55. 55Agentic RAG in Python: Give Your AI Agent a Search Tool
  56. 56AI Agent Reasoning Patterns in Python: From ReAct to Debate
  57. 57Plan-and-Execute Agents in Python: Beyond the ReAct Loop
  58. 58Self-Modifying AI Agent in Python: Open Mode & Limits
  59. 59CrewAI Alternatives: 7 Options and How to Migrate (2026)
  60. 60Migrate from AutoGen: Agent Framework, AG2 and More
  61. 61What Is an LLM Guardrail? Types, Examples and Limits
  62. 62Best LLM Guardrails Tools (2026): 9 Platforms Compared
  63. 63AI Agent Guardrails in Python: Block Injection, Redact PII
  64. 64NeMo Guardrails vs Guardrails AI: Which to Choose (2026)
  65. 65AI-Based PII Detection and Redaction Tools for LLM Apps
  66. 66Stop Secrets Leaking Into LLM Logs and Traces
  67. 67AI Agent Code Execution Sandbox: Run LLM Code Safely
  68. 68AI Agent Network Egress: Limit Where Agents Can Connect
  69. 69AutoGen Docker Task Isolation: Secure the Code Executor
  70. 70SPIFFE for AI Agents: Workload Identity Without API Keys
  71. 71On-Behalf-Of Auth for AI Agents: Act as Each User
  72. 72AI Agent Production Checklist: What to Check Before Launch
  73. 73Approval Fatigue: Auto-Approve Safe AI Agent Actions
  74. 74What Is Human in the Loop AI? Approvals for AI Agents
  75. 75AI Agent Notifications: Webhook and Slack Alerts in Python
  76. 76AI Agent Observability: Trace Tool Calls, Tokens and Cost
  77. 77Best AI Agent Observability Tools (2026), Compared
  78. 78AI Agent Stuck in a Loop? How to Detect and Stop It
  79. 79How to Run, Debug and Deploy an AI Agent in Python
  80. 80AI Agent Cost Tracking: Tokens and Cost per Run and User
  81. 81How to Evaluate AI Agents: Evals, LLM Judges and pass^k
  82. 82AI Agent Cost Control: Budgets That Stop Runaway Spend
  83. 83How to Test LLM Prompts and AI Agents in Python
  84. 84AI Agent Evals in CI: Run Them on Every Pull Request
  85. 85What Is an Agentic Runtime? AI Agent Runtimes Explained
  86. 86Autonomous AI Agent Runtime: Budgets, Crash Recovery, API
  87. 87Event-Driven AI Agents: Webhook, Cron and File Triggers
  88. 88AI Agent Cron Jobs: Run an Agent on a Schedule
  89. 89AI Agent Webhook Trigger: Run an Agent on HTTP Events
  90. 90AI Agent File Watcher: Process New Files Automatically
  91. 91Custom AI Agent Triggers: Wake an Agent From Any Source
  92. 92AI Agent Event Filters: Skip Runs Before the LLM
  93. 93AI Agent Retries and a Dead Letter Queue for Failed Runs
  94. 94Run Multiple AI Agents: One Runtime, Many Processes
  95. 95AI Agent Manifest: Declare a Long-Running Agent in YAML
  96. 96AI Agent CLI: Start, Stop and Inspect Running Agents
  97. 97AI Agent Monitoring Dashboard in the Terminal
  98. 98Multi-Agent Event Bus: Chain Agents With Events
  99. 99Distributed AI Agents: Run Agents Across Many Machines
  100. 100Pause and Resume an AI Agent: Lifecycle States Explained

Lessons in this path

  1. ✓What Is an AI Agent? Definition, How It Works, Examples
  2. ✓How to Build an AI Agent in Python (2026 Guide)
  3. ✓Build a Personal AI Agent: Memory, Reminders, Chat
  4. ✓What Is an Agent Harness? Parts and How to Build One
  5. ✓System Prompt Best Practices for AI Agents in Python
  6. ✓Best LLM for AI Agents (2026): Picks, Prices, How to Test
  7. ✓AI Agent YAML: Define and Run an Agent From a Config File
  8. ✓Streaming LLM Responses with FastAPI: Tokens and Tool Calls
  9. ✓Best Local LLM for AI Agents: Ollama Models by GPU (2026)
  10. ✓Claude AI Agent with MCP: Use Anthropic Models in Promptise
  11. ✓Gemini AI Agent with MCP: Use Google Models in Promptise
  12. ✓Azure OpenAI Agent with MCP: Use Deployments in Promptise
  13. ✓OpenRouter AI Agent with MCP: Many Models in Promptise
  14. ✓Ollama AI Agent with MCP: Run Local Models in Promptise
  15. ✓LLM Semantic Cache and Model Fallback in Python
  16. ✓What Is MCP (Model Context Protocol)? A Developer's Guide
  17. ✓What Is Tool Calling? LLM Function Calling Explained
  18. ✓MCP Tools vs Resources vs Prompts (With Python Examples)
  19. ✓How to Connect MCP Servers to Your AI Agent in Python
  20. ✓Build a Production MCP Server in Python (Step by Step)
  21. ✓MCP Transports: stdio vs Streamable HTTP vs SSE (Python)
  22. 22MCP 2026-07-28 Migration: Make Your MCP Server Stateless
  23. 23OpenAPI to MCP: Turn Any REST API into an MCP Server
  24. 24MCP Authentication in Python: API Keys, JWT and OAuth
  25. 25Build an Authenticated MCP Server for Your AI Agent (Python)
  26. 26MCP Security Best Practices: A Checklist for MCP Servers
  27. 27Testing MCP Servers in Python: pytest Without a Live Server
  28. 28Too Many MCP Tools? How to Fix LLM Tool Selection in Python
  29. 29Idempotent Tool Calls: Make AI Agent Retries Safe
  30. 30AI Agent Tool Failures: Stop Unsafe Workarounds
  31. 31MCP Server Caching, Timeouts and Circuit Breakers in Python
  32. 32MCP Middleware for Servers: Auth, Logging, Rate Limits
  33. 33MCP vs CLI for AI Agents: Tokens, Security, When to Use Each
  34. 34LangChain vs MCP: Differences and How They Work Together
  35. 35FastMCP Alternatives for Production MCP Servers (2026)
  36. 36AI Agent Audit Logging: Tamper-Evident Logs in Python
  37. 37AI Agent Human in the Loop: Approve Tool Calls in Python
  38. 38AI Agent Prompt Injection: How to Defend Against It
  39. 39Hidden Text Prompt Injection: Sanitize Pages for AI Agents
  40. 40Build a Multi-Agent System in Python (and When Not To)
  41. 41Context Engineering for AI Agents: Context Window Management
  42. 42Context Compaction for AI Agents: Trim vs Summarize
  43. 43How to Deploy an AI Agent with Docker (2026 Guide)
  44. 44LLM Tool Rate Limiting: Per-Client Limits for MCP Servers
  45. 45MCP Long-Running Tasks: Background Jobs in Python
  46. 46MCP Server Monitoring: Prometheus, OpenTelemetry and Logs
  47. 47Best AI Agent Frameworks (2026): Python Options Compared
  48. 48Self-Improving AI Agent: Learn From Tool Failures in Python
  49. 49AI Agent Identity: Authenticate Agents to MCP Servers
  50. 50Code-Action Agents in Python: One Program vs 37 Tool Calls
  51. 51Multi-Tenant AI Agents: Keep Each Customer's Data Apart
  52. 52What Is Agentic RAG? How It Differs from Classic RAG
  53. 53AI Agent Memory in Python: Short-Term and Long-Term
  54. 54Per-User Agent Memory Isolation: Stop Leaks Between Users
  55. 55Agentic RAG in Python: Give Your AI Agent a Search Tool
  56. 56AI Agent Reasoning Patterns in Python: From ReAct to Debate
  57. 57Plan-and-Execute Agents in Python: Beyond the ReAct Loop
  58. 58Self-Modifying AI Agent in Python: Open Mode & Limits
  59. 59CrewAI Alternatives: 7 Options and How to Migrate (2026)
  60. 60Migrate from AutoGen: Agent Framework, AG2 and More
  61. 61What Is an LLM Guardrail? Types, Examples and Limits
  62. 62Best LLM Guardrails Tools (2026): 9 Platforms Compared
  63. 63AI Agent Guardrails in Python: Block Injection, Redact PII
  64. 64NeMo Guardrails vs Guardrails AI: Which to Choose (2026)
  65. 65AI-Based PII Detection and Redaction Tools for LLM Apps
  66. 66Stop Secrets Leaking Into LLM Logs and Traces
  67. 67AI Agent Code Execution Sandbox: Run LLM Code Safely
  68. 68AI Agent Network Egress: Limit Where Agents Can Connect
  69. 69AutoGen Docker Task Isolation: Secure the Code Executor
  70. 70SPIFFE for AI Agents: Workload Identity Without API Keys
  71. 71On-Behalf-Of Auth for AI Agents: Act as Each User
  72. 72AI Agent Production Checklist: What to Check Before Launch
  73. 73Approval Fatigue: Auto-Approve Safe AI Agent Actions
  74. 74What Is Human in the Loop AI? Approvals for AI Agents
  75. 75AI Agent Notifications: Webhook and Slack Alerts in Python
  76. 76AI Agent Observability: Trace Tool Calls, Tokens and Cost
  77. 77Best AI Agent Observability Tools (2026), Compared
  78. 78AI Agent Stuck in a Loop? How to Detect and Stop It
  79. 79How to Run, Debug and Deploy an AI Agent in Python
  80. 80AI Agent Cost Tracking: Tokens and Cost per Run and User
  81. 81How to Evaluate AI Agents: Evals, LLM Judges and pass^k
  82. 82AI Agent Cost Control: Budgets That Stop Runaway Spend
  83. 83How to Test LLM Prompts and AI Agents in Python
  84. 84AI Agent Evals in CI: Run Them on Every Pull Request
  85. 85What Is an Agentic Runtime? AI Agent Runtimes Explained
  86. 86Autonomous AI Agent Runtime: Budgets, Crash Recovery, API
  87. 87Event-Driven AI Agents: Webhook, Cron and File Triggers
  88. 88AI Agent Cron Jobs: Run an Agent on a Schedule
  89. 89AI Agent Webhook Trigger: Run an Agent on HTTP Events
  90. 90AI Agent File Watcher: Process New Files Automatically
  91. 91Custom AI Agent Triggers: Wake an Agent From Any Source
  92. 92AI Agent Event Filters: Skip Runs Before the LLM
  93. 93AI Agent Retries and a Dead Letter Queue for Failed Runs
  94. 94Run Multiple AI Agents: One Runtime, Many Processes
  95. 95AI Agent Manifest: Declare a Long-Running Agent in YAML
  96. 96AI Agent CLI: Start, Stop and Inspect Running Agents
  97. 97AI Agent Monitoring Dashboard in the Terminal
  98. 98Multi-Agent Event Bus: Chain Agents With Events
  99. 99Distributed AI Agents: Run Agents Across Many Machines
  100. 100Pause and Resume an AI Agent: Lifecycle States Explained
← Path overview

The MCP 2026-07-28 spec makes the protocol stateless: no initialize handshake, no Mcp-Session-Id, and no requests from the server back to the client. This guide shows what changed, which parts of a typical server break, and how to fix each one: session state, elicitation, sampling and load balancing. Every step has a runnable before and after server in Python with real output, built with Promptise Foundry and the MCP Python SDK 2.3.0.

[01]

How do you migrate an MCP server to the 2026-07-28 spec?

Upgrade to an SDK that speaks 2026-07-28 (the MCP Python SDK 2.x does, and serves older clients from the same endpoint). Then remove everything that relies on a session: keep cross-call state in a shared store behind a handle the server returns, and ask the user through multi round-trip requests instead of calling the client mid-request. Finally, serve the app without sticky sessions and test it with a 2026-07-28 client and a 2025-11-25 client.

  • The protocol is stateless, your app may not be. Each request carries its protocol version, client info and capabilities in _meta, so any replica can answer it. Data your tools need across calls still has to live somewhere every replica can reach.

  • Sessions become handles. A tool returns an ID such as cart_id, and the model passes it to the next tool as an ordinary argument.

  • The server asks by returning. A tool that needs user input returns an input_required result, and the client retries the call with the answers. Since Foundry 1.7.0, Elicitor.ask() does this for you.

  • Sampling, roots and logging are deprecated, not removed. They keep working for at least twelve months under the new deprecation policy.

  • Old clients keep working if your SDK serves both eras. The MCP Python SDK 2.x does, and so does a Promptise Foundry server (1.7.0 or later) installed with it.


[02]

What changed in MCP 2026-07-28?

The 2026-07-28 changelog lists nine major changes. These are the ones that affect a server, with what to do about each:

Change

What breaks

What to do

initialize handshake removed; version and capabilities sent in every request's _meta

Code that reads client capabilities once per session

Read them per request (the SDK does this)

Mcp-Session-Id and protocol sessions removed

Anything keyed by session: carts, logins, scratch data

Server-minted handles in a shared store

server/discover added, and servers must implement it

Nothing, if your SDK provides it

Upgrade the SDK

Server-to-client requests replaced by multi round-trip requests

elicitation/create, sampling/createMessage and roots/list sent mid-call

Return the question as input_required (your SDK's elicitation helper may do it)

HTTP GET stream and resources/subscribe replaced by subscriptions/listen

List-changed and resource-updated notifications

Send them on the listen stream (the SDK does this)

ping and logging/setLevel removed

Log level set once per session

The level comes per request in _meta

SSE resumability (Last-Event-ID) removed

Clients that resumed broken streams

A broken stream loses the request; the client sends it again

Every result has a resultType

Hand-built JSON results

"complete" or "input_required"

Tasks moved to the io.modelcontextprotocol/tasks extension

Experimental task support

Use the extension where your SDK has it

The spec also deprecates Roots, Sampling, Logging, the old HTTP+SSE transport and OAuth Dynamic Client Registration. Deprecated features stay in the spec for at least twelve months under the new feature lifecycle policy. The Streamable HTTP transport now requires MCP-Protocol-Version, Mcp-Method and, for tool calls, Mcp-Name headers on every POST, so gateways can route requests without parsing the body.


[03]

How does a stateless MCP request work?

Under 2025-11-25, a client opened a session with initialize, and every later call had to reach the process that held it: sticky routing, and a restart cost every session. Under 2026-07-28, each POST is complete on its own:

Two panels. Left, 2025-11-25: a client with an Mcp-Session-Id goes through a sticky load balancer to Replica A, which holds the session in memory; Replica B answers 404 for it, and the server calls the client back with elicitation/create. Right, 2026-07-28: each request carries its version in _meta, any replica can answer, and state lives in a shared store behind a cart_id handle.
FigureMCP before and after 2026-07-28: from pinned sessions to self-contained requests

This is the whole client side of a 2026-07-28 tool call. There is no handshake before it and nothing to clean up after it:

Pythonmodern_call.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""Send 2026-07-28 requests by hand: no initialize, no session, one POST each."""
import itertools
import json
import sys

import httpx

VERSION = "2026-07-28"
CAPABILITIES: dict = {}  # {"elicitation": {}} for a client that can ask its user
_ids = itertools.count(1)


def rpc(url: str, method: str, params: dict | None = None) -> dict:
    params = dict(params or {})
    params["_meta"] = {
        "io.modelcontextprotocol/protocolVersion": VERSION,
        "io.modelcontextprotocol/clientInfo": {"name": "probe", "version": "1.0"},
        "io.modelcontextprotocol/clientCapabilities": CAPABILITIES,
    }
    headers = {
        "Accept": "application/json, text/event-stream",
        "MCP-Protocol-Version": VERSION,
        "Mcp-Method": method,
    }
    if "name" in params:
        headers["Mcp-Name"] = params["name"]
    body = {"jsonrpc": "2.0", "id": next(_ids), "method": method, "params": params}
    resp = httpx.post(url, json=body, headers=headers, timeout=10)
    if resp.headers.get("content-type", "").startswith("text/event-stream"):
        data = [l[5:] for l in resp.text.splitlines() if l.startswith("data:")]
        return json.loads(data[-1])
    return {"http": resp.status_code, "session": resp.headers.get("mcp-session-id"), **resp.json()}


def call(url: str, tool: str, **arguments) -> str:
    reply = rpc(url, "tools/call", {"name": tool, "arguments": arguments})
    if "error" in reply:  # a JSON-RPC error
        return f"error {reply['error']['code']}: {reply['error']['message']}"
    text = reply["result"]["content"][0]["text"]
    if reply["result"].get("isError"):  # a tool error
        error = json.loads(text)["error"]
        return f"tool error {error['code']}: {error['message']}"
    return text


if __name__ == "__main__":
    url = sys.argv[1]
    print(json.dumps(rpc(url, "server/discover"), indent=2)[:900])

Run against a server, it calls server/discover, the new method every server must implement. It returns what initialize used to: versions, capabilities and identity. ttlMs and cacheScope say how long results may be cached.

Output
{
  "http": 200,
  "session": null,
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "cacheScope": "private",
    "capabilities": {
      "prompts": {
        "listChanged": false
      },
      "resources": {
        "listChanged": false,
        "subscribe": false
      },
      "tools": {
        "listChanged": false
      }
    },
    "resultType": "complete",
    "supportedVersions": [
      "2026-07-28"
    ],
    "ttlMs": 0,
    "_meta": {
      "io.modelcontextprotocol/serverInfo": {
        "name": "cart",
        "version": "0.1.0"
      }
    }
  }
}

"session": null is the Mcp-Session-Id response header. There isn't one.


[04]

When do you need to migrate, and when not?

Clients move to 2026-07-28 on their own schedule. The MCP Python SDK 2.x Client uses mode="auto" by default: it tries 2026-07-28 first and falls back to initialize if the server answers with an old-style error. So the question isn't whether your server will see 2026-07-28 traffic, but when.

Migrate now if:

  • you run more than one replica and pay for sticky sessions;

  • you deploy on serverless platforms, where a process rarely sees two requests from the same client;

  • your tools ask the user questions or call sampling mid-request, because those calls need input rounds on 2026-07-28 connections;

  • your server is public and you can't control which client versions connect.

You can wait if your server runs locally over stdio for one client, uses no session state and never calls the client back: upgrading the SDK covers you. Keep the legacy path either way.


[05]

What you need

  • An MCP server you can change, and Python 3.10 or later for the examples.

  • The MCP Python SDK 2.x. Version 2.0.0 shipped on 2026-07-28 with support for both protocol eras; the examples use 2.3.0.

  • For the Foundry examples, Promptise Foundry 1.7.0 or later, which accepts mcp>=1.9,<3. Its 2026-07-28 support (input rounds, protocol="auto") needs mcp 2.x.

  • An OpenAI API key, only for the agent at the end.

>_Terminal
uv venv && uv pip install "promptise>=1.7.0" "mcp==2.3.0" uvicorn httpx python-dotenv

If your lock file pins mcp<2, the server answers a 2026-07-28 request with 400 Bad Request: Unsupported protocol version: 2026-07-28, and an auto-mode client falls back to initialize. That works, but the server isn't migrated.


[06]

Step 1: Find the session state in your server

Most servers hold more session state than their authors think. Search your code for these first:

  • Per-session storage. Foundry's SessionState, dictionaries keyed by session ID, objects created when a session opens.

  • Things learned at initialize. Client capabilities, client name or a protocol version cached for the session.

  • Calls back to the client. ctx.elicit(), Foundry's Elicitor.ask(), create_message (sampling), list_roots.

  • Server-pushed notifications. tools/list_changed, resource subscriptions, log messages sent outside a request.

  • Long-running work tied to a stream, such as a job whose progress the client resumes with Last-Event-ID.

Here is a typical 2025-era server. It keeps the cart in the session and confirms checkout with elicitation:

Pythonserver_before.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""Before: a 2025-era MCP server that keeps state in the session."""
from promptise.mcp.server import Depends, Elicitor, MCPServer, SessionState

server = MCPServer(name="cart")


@server.tool()
async def add_item(sku: str, session: SessionState = Depends(SessionState)) -> dict:
    """Add a product to the cart."""
    items = session.get("items", [])
    items.append(sku)
    session.set("items", items)
    return {"items": items}


@server.tool()
async def checkout(
    session: SessionState = Depends(SessionState),
    elicit: Elicitor = Depends(Elicitor),
) -> str:
    """Place the order for everything in the cart."""
    items = session.get("items", [])
    answer = await elicit.ask(
        f"Place an order for {len(items)} item(s)?",
        {"type": "object", "properties": {"confirm": {"type": "boolean"}}},
    )
    if not answer or not answer.get("confirm"):
        return "Cancelled: not confirmed."
    session.set("items", [])
    return f"Ordered {items}."


app = server.asgi_app()  # uvicorn server_before:app --port 8001

[07]

Step 2: Upgrade the SDK and check that both eras answer

With mcp 2.x installed, the SDK routes each request by protocol version before your code sees it: 2026-07-28 requests take the new path, initialize the legacy one. Check it with the official 2.x client, which picks the version itself:

Pythonsdk_client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
"""The official MCP Python SDK 2.x client picks the protocol version itself."""
import asyncio

from mcp import Client


async def main() -> None:
    for name, port in (("before", 8001), ("after", 8002)):
        async with Client(f"http://127.0.0.1:{port}/mcp") as client:
            tools = await client.list_tools()
            print(f"{name}: protocol {client.protocol_version}, tools {[t.name for t in tools.tools]}")


asyncio.run(main())
Output
before: protocol 2026-07-28, tools ['add_item', 'checkout']
after: protocol 2026-07-28, tools ['create_cart', 'add_item', 'checkout']

Both servers negotiated 2026-07-28, including the unchanged before server. That is the trap: the protocol upgrade succeeds, and the session-based tools break. Call the before server the 2026-07-28 way, one request at a time, and look at the first block of output:

Pythonprobe.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""Call both servers the 2026-07-28 way: every request on its own."""
import json

from modern_call import call, rpc

BEFORE = "http://127.0.0.1:8001/mcp"
AFTER = "http://127.0.0.1:8002/mcp"

print("== before: session state and elicitation")
print("add_item ->", call(BEFORE, "add_item", sku="mug"))
print("add_item ->", call(BEFORE, "add_item", sku="tea"))
print("checkout ->", call(BEFORE, "checkout"))

print("\n== after: a handle the server minted")
cart = json.loads(call(AFTER, "create_cart"))["cart_id"]
print("create_cart ->", cart)
print("add_item ->", call(AFTER, "add_item", cart_id=cart, sku="mug"))
print("add_item ->", call(AFTER, "add_item", cart_id=cart, sku="tea"))
print("checkout ->", call(AFTER, "checkout", cart_id=cart))
print("checkout ->", call(AFTER, "checkout", cart_id=cart, confirmed=True))
Output
== before: session state and elicitation
add_item -> tool error SESSION_REQUIRED: Tool 'add_item' keeps per-session state, but this request uses MCP protocol 2026-07-28, which has no sessions (each request stands alone). Connect with the initialize handshake to use it (Promptise's MCPClient does by default, protocol='handshake'; the MCP Python SDK client with mode='legacy').
add_item -> tool error SESSION_REQUIRED: Tool 'add_item' keeps per-session state, but this request uses MCP protocol 2026-07-28, which has no sessions (each request stands alone). Connect with the initialize handshake to use it (Promptise's MCPClient does by default, protocol='handshake'; the MCP Python SDK client with mode='legacy').
checkout -> tool error SESSION_REQUIRED: Tool 'checkout' keeps per-session state, but this request uses MCP protocol 2026-07-28, which has no sessions (each request stands alone). Connect with the initialize handshake to use it (Promptise's MCPClient does by default, protocol='handshake'; the MCP Python SDK client with mode='legacy').

== after: a handle the server minted
create_cart -> cart_61b69494
add_item -> {"cart_id": "cart_61b69494", "items": ["mug"]}
add_item -> {"cart_id": "cart_61b69494", "items": ["mug", "tea"]}
checkout -> Not placed (the client did not declare the elicitation capability). If the user confirms, call checkout again with confirmed=true.
checkout -> Ordered ['mug', 'tea'].

In the before block, every call fails with SESSION_REQUIRED. A 2026-07-28 request has no session, so Foundry (since 1.7.0) refuses to run a SessionState tool on empty state and says how to connect instead. Earlier releases ran it with fresh state, and the cart silently kept one item; session dictionaries of your own still fail that way. The after block is what the next steps build. Its first checkout didn't place the order, because this probe can't answer a question. Step 4 fixes that.


[08]

Step 3: Replace session state with server-minted handles

The spec's answer to session state is the handle: an ID the server creates, returns as a tool result and receives back as an ordinary argument. The state goes into a store every replica can reach: SQLite here, Postgres, Redis or your own API in production.

Pythonserver_after.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""After: a stateless MCP server. State lives in a shared store, behind a handle."""
import json
import os
import sqlite3
import uuid

from mcp.server.request_state import RequestStateSecurity

from promptise.mcp.server import Depends, Elicitor, MCPServer, ToolError

server = MCPServer(
    name="cart",
    # Every worker and replica must open the requestState the others seal.
    request_state_security=RequestStateSecurity(keys=[os.environ["MCP_STATE_KEY"]]),
)
DB = "carts.db"  # any store every replica can reach: Postgres, Redis, ...
CONFIRM = {"type": "object", "properties": {"confirm": {"type": "boolean"}}, "required": ["confirm"]}


def store() -> sqlite3.Connection:
    conn = sqlite3.connect(DB, timeout=5)
    conn.execute("CREATE TABLE IF NOT EXISTS carts (id TEXT PRIMARY KEY, items TEXT)")
    return conn


def load(cart_id: str) -> list[str]:
    with store() as conn:
        row = conn.execute("SELECT items FROM carts WHERE id = ?", (cart_id,)).fetchone()
    if row is None:
        raise ToolError(f"Unknown cart_id {cart_id!r}. Call create_cart first.")
    return json.loads(row[0])


@server.tool()
async def create_cart() -> dict:
    """Start a new cart. Pass the returned cart_id to the other cart tools."""
    cart_id = f"cart_{uuid.uuid4().hex[:8]}"
    with store() as conn:
        conn.execute("INSERT INTO carts VALUES (?, '[]')", (cart_id,))
    return {"cart_id": cart_id}


@server.tool()
async def add_item(cart_id: str, sku: str) -> dict:
    """Add a product to a cart."""
    items = load(cart_id) + [sku]
    with store() as conn:
        conn.execute("UPDATE carts SET items = ? WHERE id = ?", (json.dumps(items), cart_id))
    return {"cart_id": cart_id, "items": items}


@server.tool(destructive_hint=True)
async def checkout(cart_id: str, confirmed: bool = False, elicit: Elicitor = Depends(Elicitor)) -> str:
    """Place the order for a cart. The user is asked to confirm it."""
    items = load(cart_id)  # read-only: on 2026-07-28 this runs again in every input round
    if not confirmed:
        answer = await elicit.ask(f"Place an order for {len(items)} item(s): {items}?", CONFIRM)
        if not answer or not answer.get("confirm"):
            return (f"Not placed ({elicit.last_failure or 'not confirmed'}). "
                    "If the user confirms, call checkout again with confirmed=true.")
    with store() as conn:  # the side effect comes after the answer
        conn.execute("DELETE FROM carts WHERE id = ?", (cart_id,))
    return f"Ordered {items}."


app = server.asgi_app(stateless=True)  # uvicorn server_after:app --port 8002 --workers 4

checkout and the request_state_security argument are explained in Steps 4 and 6. Three details about the handles matter:

  • The tool description tells the model what to do with the handle: "Pass the returned cart_id to the other cart tools." That was enough in the complete example below.

  • An unknown handle is a tool error the model can act on: "Call create_cart first" tells it how to recover.

  • Handles are not credentials. When a handle points at private data, check on every call that it belongs to the authenticated caller, as you would for an order ID in a REST API.


[09]

Step 4: Ask the user with input rounds

Under 2025-11-25, a tool could pause and send elicitation/create over the open stream. Under 2026-07-28 the server returns its question, and the client retries the call with the answer. The spec calls this pattern multi round-trip requests (MRTR):

A sequence diagram. The client sends tools/call checkout with id 1. The server answers input_required with an elicitation in inputRequests, and optionally a requestState. The client asks the user, then sends tools/call checkout again with id 2, adding inputResponses, and the requestState unchanged if the server sent one. The server answers with a complete result.
FigureMulti round-trip requests: at 2026-07-28 the server returns its question instead of sending one

The retry is a new request with a new JSON-RPC ID, so any replica can handle it. Anything the server needs to remember between rounds goes into requestState, an opaque string the client must echo back unchanged. The spec says to treat it as attacker-controlled input: if it affects authorization or business logic, protect it with an HMAC or AEAD and include the caller, a short expiry and the original request in it.

Foundry builds these results for you. On a 2026-07-28 connection, Elicitor.ask() in checkout ends the call with an input_required result. When the call comes back with the answer, the tool runs again from the start and ask() returns it. One round by hand, from a client that declares the elicitation capability:

Pythoninput_round.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""One input round by hand: the server asks, the client sends the call again with the answer."""
import json

import modern_call
from modern_call import call, rpc

URL = "http://127.0.0.1:8002/mcp"
modern_call.CAPABILITIES = {"elicitation": {}}  # this client can ask its user

cart = json.loads(call(URL, "create_cart"))["cart_id"]
call(URL, "add_item", cart_id=cart, sku="mug")

params = {"name": "checkout", "arguments": {"cart_id": cart}}
first = rpc(URL, "tools/call", params)["result"]
print("resultType:", first["resultType"])
print("inputRequests:", json.dumps(first["inputRequests"], indent=2))
print("requestState:", first.get("requestState"))  # none yet: nothing to carry over

# The user said yes. Same call again, with the answer under the question's key.
key = next(iter(first["inputRequests"]))
answer = {key: {"action": "accept", "content": {"confirm": True}}}
retry = rpc(URL, "tools/call", {**params, "inputResponses": answer})
print("retry:", retry["result"]["resultType"], "->", retry["result"]["content"][0]["text"])
Output
resultType: input_required
inputRequests: {
  "promptise.elicit.01d96e9fa82f7d61.1": {
    "method": "elicitation/create",
    "params": {
      "message": "Place an order for 1 item(s): ['mug']?",
      "mode": "form",
      "requestedSchema": {
        "properties": {
          "confirm": {
            "type": "boolean"
          }
        },
        "required": [
          "confirm"
        ],
        "type": "object"
      }
    }
  }
}
requestState: None
retry: complete -> Ordered ['mug'].

There is no requestState yet, because there is nothing to carry over. The retry adds inputResponses, keyed like the question. Normally the client does this. MCPClient(protocol="auto") checks server/discover, uses 2026-07-28 when offered, and answers each question with your elicitation_callback:

Pythonelicit_client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""Promptise's MCPClient on the 2026-07-28 protocol: questions arrive as input rounds."""
import asyncio
import json

from mcp import types

from promptise.mcp.client import MCPClient


async def ask_user(context, params: types.ElicitRequestParams) -> types.ElicitResult:
    print("question for the user:", params.message)
    return types.ElicitResult(action="accept", content={"confirm": True})  # the user said yes


async def main() -> None:
    async with MCPClient(url="http://127.0.0.1:8002/mcp", protocol="auto",
                         elicitation_callback=ask_user) as client:
        print("protocol:", client.protocol_version)
        cart = json.loads((await client.call_tool("create_cart", {})).content[0].text)["cart_id"]
        await client.call_tool("add_item", {"cart_id": cart, "sku": "mug"})
        result = await client.call_tool("checkout", {"cart_id": cart})
        print("checkout ->", result.content[0].text)


asyncio.run(main())
Output
protocol: 2026-07-28
question for the user: Place an order for 1 item(s): ['mug']?
checkout -> Ordered ['mug'].

What to watch for:

  • Code before ask() runs once per round. Keep it read-only and put side effects after the answer.

  • Each question is one round. Earlier answers travel in requestState, sealed with AES-GCM by the SDK and bound to the tool, its arguments and the server.

  • Share the key across replicas. Otherwise each process seals with its own key, and a round that reaches another worker fails with -32602 Invalid or expired requestState. Hence RequestStateSecurity(keys=[...]) in server_after.py.

  • Some clients can't answer. Without the elicitation capability, or as a handshake client on a stateless server, ask() returns None and elicit.last_failure says why.

So checkout keeps a fallback: if it can't ask, it tells the model to confirm with the user and call again with confirmed=true. That trusts the model; drop it if the client's user must confirm. Other ways to port a confirmation step:

  1. A two-step tool only. Works with every client, with the same trust tradeoff.

  2. Approval in the agent. The complete example uses Promptise's ApprovalPolicy.

  3. A server-side approval gate. Foundry's ElicitationApprover also asks in input rounds. PendingApprover queues the call for a reviewer, but its store is process-local.

  4. The SDK's resolver. In the MCP Python SDK's own MCPServer, a Resolve(fn) parameter that returns Elicit(...) covers both eras; see the SDK migration guide.


[10]

Step 5: Replace sampling, roots and logging

These three features are deprecated, not removed. New code shouldn't use them. The spec suggests these replacements:

  • Sampling: call an LLM provider's API from the server with your own key, and put the cost in your budget rather than the client's. Foundry's Sampler returns None on 2026-07-28 connections.

  • Roots: pass directories or files as tool parameters, resource URIs or server configuration.

  • Logging: write to stderr on stdio, or use OpenTelemetry. On 2026-07-28 the client opts into log messages per request with io.modelcontextprotocol/logLevel in _meta, and the server must not send notifications/message for requests without it.


[11]

Step 6: Serve it stateless behind a load balancer

For 2026-07-28 clients, the server is already sessionless. Older clients still open sessions, which live in one process. Foundry's asgi_app(stateless=True) turns that off for them too: no Mcp-Session-Id, every request served on its own. It exists on asgi_app() only, for Streamable HTTP.

>_Terminal
export MCP_STATE_KEY=$(python -c "import secrets; print(secrets.token_hex(32))")  # the same on every replica
uvicorn server_after:app --host 0.0.0.0 --port 8002 --workers 4

The outputs in Steps 2 and 4 came from this: four workers, no sticky routing, and the cart survived because it lives in the database. Keep MCP_STATE_KEY in your secret store. RequestStateSecurity(keys=[new, old]) seals with the first key and opens with all of them, so you can rotate it.

The price of stateless=True is the legacy back-channel. A handshake client gets no elicitation (checkout answers Not placed (the elicitation request failed (NoBackChannelError))), and SessionState tools answer SESSION_REQUIRED: the same rules 2026-07-28 applies to everyone. The MCP Python SDK docs describe its stateless_http flag the same way.


[12]

Step 7: Test both protocol eras

Test what each kind of client actually does. First the legacy handshake, raw and through Promptise's own client:

Pythonprobe_legacy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""The same servers from a 2025-era client: the initialize handshake."""
import asyncio

import httpx

from promptise.mcp.client import MCPClient

INIT = {
    "jsonrpc": "2.0", "id": 1, "method": "initialize",
    "params": {"protocolVersion": "2025-11-25", "capabilities": {},
               "clientInfo": {"name": "probe", "version": "1.0"}},
}
HEADERS = {"Accept": "application/json, text/event-stream"}


async def main() -> None:
    for name, port in (("before", 8001), ("after", 8002)):
        url = f"http://127.0.0.1:{port}/mcp"
        resp = httpx.post(url, json=INIT, headers=HEADERS)
        print(f"{name}: initialize -> {resp.status_code}, mcp-session-id: {resp.headers.get('mcp-session-id')}")

    # On a handshake connection the session, and SessionState with it, still works.
    async with MCPClient(url="http://127.0.0.1:8001/mcp") as client:
        await client.call_tool("add_item", {"sku": "mug"})
        items = await client.call_tool("add_item", {"sku": "tea"})
        print(f"before, MCPClient ({client.protocol_version}): add_item -> {items.content[0].text}")

    # MCPClient uses the handshake unless you pass protocol="auto".
    for protocol in ("handshake", "auto"):
        async with MCPClient(url="http://127.0.0.1:8002/mcp", protocol=protocol) as client:
            cart = await client.call_tool("create_cart", {})
            print(f"after, MCPClient(protocol={protocol!r}): {client.protocol_version}, "
                  f"create_cart -> {cart.content[0].text}")


asyncio.run(main())
Output
before: initialize -> 200, mcp-session-id: b5b76258fefe4c2dad7b443df63a2bca
after: initialize -> 200, mcp-session-id: None
before, MCPClient (2025-11-25): add_item -> {"items": ["mug", "tea"]}
after, MCPClient(protocol='handshake'): 2025-11-25, create_cart -> {"cart_id": "cart_7243c21e"}
after, MCPClient(protocol='auto'): 2026-07-28, create_cart -> {"cart_id": "cart_b1b9978d"}

Both servers answered initialize; only before issued a session ID, and over the handshake its session still keeps the cart. MCPClient uses the handshake unless you pass protocol="auto". build_agent and the Agent Runtime always use it.

Then a version the server doesn't speak. A modern server must answer with UnsupportedProtocolVersionError and list what it supports, so the client can retry:

Output
{'http': 400, 'session': None, 'jsonrpc': '2.0', 'id': 1, 'error': {'code': -32022, 'message': 'Unsupported protocol version', 'data': {'supported': ['2026-07-28'], 'requested': '2099-01-01'}}}

Before a release, also run a round-robin test with at least two replicas, a test that uses a handle created on another replica, and the official MCP conformance suite. Testing MCP servers in Python covers unit tests without a live server.


[13]

The complete example

Here is a Promptise agent using server_after.py. build_agent connects with the handshake to a stateless server, so the server can't ask it to confirm. A person approves every checkout through the agent's approval policy instead:

Pythonagent_after.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""A Promptise agent shops through the stateless server; checkout needs a yes."""
import asyncio

from dotenv import load_dotenv

from promptise import ApprovalDecision, ApprovalPolicy, CallbackApprovalHandler, HTTPServerSpec, build_agent

load_dotenv()  # OPENAI_API_KEY from .env


async def approve(request) -> ApprovalDecision:
    print(f"approval asked: {request.tool_name}({request.arguments}) -> yes")
    return ApprovalDecision(approved=True)


async def main() -> None:
    agent = await build_agent(
        model="openai:gpt-5-mini",
        servers={"cart": HTTPServerSpec(url="http://127.0.0.1:8002/mcp")},
        approval=ApprovalPolicy(tools=["checkout"], handler=CallbackApprovalHandler(approve)),
    )
    result = await agent.ainvoke({"messages": [{
        "role": "user",
        "content": "Order SKUs mug-01 and tea-02 for me. I confirm the order.",
    }]})
    for message in result["messages"]:
        for call in getattr(message, "tool_calls", None) or []:
            print("tool call:", call["name"], call["args"])
    print("answer:", result["messages"][-1].content)
    await agent.shutdown()


asyncio.run(main())
Output
approval asked: checkout({'cart_id': 'cart_86746f0a', 'confirmed': True}) -> yes
tool call: create_cart {}
tool call: add_item {'cart_id': 'cart_86746f0a', 'sku': 'mug-01'}
tool call: add_item {'cart_id': 'cart_86746f0a', 'sku': 'tea-02'}
tool call: checkout {'cart_id': 'cart_86746f0a', 'confirmed': True}
answer: Done — I created a cart, added mug-01 and tea-02, and placed the order with your confirmation. The order contains: mug-01, tea-02.

The model passed cart_86746f0a along with only the tool descriptions to go on. The user had confirmed, so it called checkout with confirmed=true, after the approval handler said yes.


[14]

Running a stateless MCP server in production

  • Authenticate every request. There is no session to authenticate once. Foundry already reads the credential from the HTTP request that carries each call; see MCP authentication with API keys, JWT and OAuth.

  • Let gateways use the new headers. Mcp-Method and Mcp-Name let a proxy rate-limit or route by tool without reading the body.

  • Use the cache hints. List results carry ttlMs and cacheScope; return tools in a stable order so caches can reuse them.

  • Expire handles. A cart nobody checks out stays in the store forever unless you add a TTL.

  • Share the requestState key across replicas. Sealed state expires after 600 seconds by default; a later retry fails with -32602 and starts over.

  • Plan for lost requests. Streams can't resume; a client resends the request with a new ID, so make tools with side effects idempotent; idempotent tool calls shows how. MCP long-running tasks covers jobs that outlive a request.

  • Keep the legacy path tested until your logs show no initialize requests, then decide whether to keep it.

  • Roll out behind a flag. Ship the handle-based tools next to the old ones, move clients over, then remove the session-based tools.

Build a production MCP server in Python covers health checks, middleware and Docker, and MCP security best practices the rest of the checklist.


[15]

Common problems and fixes

Symptom

Cause

Fix

Tool error SESSION_REQUIRED

A SessionState tool on a 2026-07-28 request or a stateless server

A handle and a shared store, or the handshake for that client

Data from the previous call is gone

Your own state keyed by session

A handle and a shared store

A confirmation step always cancels

The client can't answer elicitation

Pass an elicitation_callback, or offer a two-step confirm

-32602 Invalid or expired requestState

Another worker's key, a restart, or expiry

One shared RequestStateSecurity(keys=[...])

Cannot send 'elicitation/create': ... no back-channel

SDK ctx.elicit() on 2026-07-28, or a handshake client on a stateless server

Return the question as input_required, or serve with sessions

MCPClient stays on 2025-11-25

Its default is protocol="handshake"

Pass protocol="auto"

400 Unsupported protocol version: 2026-07-28

Server runs on mcp 1.x

Upgrade to mcp 2.x

Browser client gets 400 Disallowed CORS headers on the preflight

A custom CORSConfig(allow_headers=...) without mcp-method and mcp-name, which 2026-07-28 clients send on every request

Keep both in the list, with mcp-session-id and mcp-protocol-version; Foundry's default list has all four

-32020 HeaderMismatch

Client or proxy sent Mcp-Method or Mcp-Name that don't match the body

Fix the client or the proxy rewrite

Legacy clients get 404 Session not found behind a load balancer

Sessions live in one process

asgi_app(stateless=True) or sticky routing on mcp-session-id

Unknown handle after a deploy

Store was in process memory

Move the store out of the process

tools/list_changed never arrives

Change notifications travel only on subscriptions/listen at 2026-07-28

Client opens a listen stream, or polls with the ttlMs hint


[16]

Limitations

  • Foundry's input rounds cover elicitation only. Elicitor and ElicitationApprover ask in input rounds; Sampler returns None on 2026-07-28 connections, and Foundry doesn't request roots.

  • Foundry's agents stay on the handshake. build_agent and the Agent Runtime connect with initialize, which works with servers that serve both eras.

  • The tasks extension isn't in the Python SDK yet. The MCP Python SDK 2.3.0 doesn't implement io.modelcontextprotocol/tasks, so long-running work still needs your own job pattern.

  • Statelessness doesn't remove state, it moves it. You now operate a store, its expiry and its access checks.

  • Some clients will stay on 2025-11-25 for a long time, so the legacy path and its tests stay with you.


[17]

FAQ

What is the MCP 2026-07-28 spec?

It is the MCP revision released on July 28, 2026. It removes the initialize handshake and protocol sessions, adds server/discover, replaces server-to-client requests with multi round-trip requests, and moves change notifications to subscriptions/listen.

Is Mcp-Session-Id removed from MCP?

Yes, from the 2026-07-28 Streamable HTTP transport. Every request carries its protocol version and capabilities in _meta. Servers that also serve 2025-11-25 clients still issue session IDs on that legacy path unless they run stateless.

Do old MCP clients still work after the migration?

Yes, if your SDK serves both eras. The MCP Python SDK 2.x routes each request by version on the same endpoint, so initialize from a 2025 client and a 2026-07-28 call both work.

What replaces elicitation in MCP 2026-07-28?

Elicitation still exists, but the server no longer sends it as its own request. It returns an input_required result listing its questions, and the client retries the original call with inputResponses. The same pattern carries sampling and roots requests.

Does stateless MCP mean my server can't keep state?

No. Only the protocol is stateless. Your tools can keep any state they want in a database, a cache or an API, referenced by IDs the server returns and the model passes back as arguments.

Does Promptise Foundry support MCP 2026-07-28?

Mostly. Since 1.7.0, a Foundry server with mcp 2.x answers 2026-07-28 requests, asks questions in input rounds through Elicitor and ElicitationApprover, and answers SESSION_REQUIRED for session-state tools. MCPClient(protocol="auto") speaks 2026-07-28. Sampling isn't available on 2026-07-28, and build_agent agents still connect with the handshake.


[18]

Next steps

  • MCP transports: stdio vs Streamable HTTP vs SSE explains the transport this migration changes.

  • AI agent approval goes deeper on the agent-side confirmation used above.

  • Connect MCP servers to an AI agent shows the client side in Promptise.

  • Make your SaaS agent-ready covers what to expose in an MCP server and how users connect to it.

  • The Foundry deployment docs cover workers, sticky sessions and stateless=True.

← PreviousMCP Transports: stdio vs Streamable HTTP vs SSE (Python)Next lesson →OpenAPI to MCP: Turn Any REST API into an MCP Server