-
Notifications
You must be signed in to change notification settings - Fork 189
Description
MCP Apps: AppBridge and Model get separate session IDs — no way to correlate them
I'm building an MCP server with an MCP App (AppBridge iframe). The App UI needs to know what the Model is doing - e.g. when the Model kicks off a tool call, the App should show live progress.
The problem: Claude Desktop calls initialize twice, once for the AppBridge and once for the Model - so they end up with different Mcp-Session-Id values. My server generates a session ID on each initialize:
const headerSessionId = request.headers.get("Mcp-Session-Id");
const mcpSessionId =
headerSessionId ||
(jsonRpcRequest.method === "initialize" ? crypto.randomUUID() : null);Since initialize fires twice, I get two UUIDs. Here's what the request log looks like:
| # | Method | Session ID | Origin |
|---|---|---|---|
| 1 | initialize |
eceb9a34… |
AppBridge |
| 2–6 | resources/list, tools/list, etc. |
eceb9a34… |
AppBridge |
| 7 | initialize |
913a52df… |
Model |
| 8 | tools/call |
913a52df… |
Model |
So when the Model calls a tool, the server stores state under 913a52df…. But the AppBridge queries using eceb9a34… - it never finds it.
I don't see a way in the spec to link these two sessions together. Is the dual-initialize intentional? If so, is there a planned way to share a conversation-level or connection-level ID across both sub-connections?
A previously working prototype also broke with this behavior, so this might be a recent change in Claude Desktop.
Environment: Claude Desktop/Claude Web