[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3

Managing Sessions

🚄 Transport Layers7 min60 BASE XP

Session Identifiers

When using HTTP transports, the connection is typically stateless. However, MCP requires a stateful session to keep track of capabilities, roots, and subscriptions.

To solve this, the server assigns a unique Session Identifier upon initialization. In the 2025 HTTP transport spec, this is often implemented as a sessionId query parameter or HTTP header.

Capabilities Negotiation

Upon connection, the Client and Server perform a handshake:

  1. The Client sends its capabilities (e.g., "I support roots and sampling").
  2. The Server replies with its capabilities (e.g., "I support tools and prompts").
💡 Key Insight: If the Server disconnects, the Host must automatically re-run the initialization handshake upon reconnecting to rebuild the session state.
SYNAPSE VERIFICATION
QUERY 1 // 3
Why do remote MCP connections require session management?
Because HTTP is stateless but MCP relies on stateful handshakes and subscriptions.
To bill users automatically.
To encrypt the payload.
Because stdio requires it.
Watch: 139x Rust Speedup
Managing Sessions | Transport Layers — MCP Academy