What problem does it solve?
Understand the MCP server session lifecycle: proxy supervision, daemon watch loop, session state machine, rejoin/reconnect races, and room eviction. Use when debugging session state, changing reconnection logic, or reasoning about races between background rejoin and user-initiated tool calls.
Core Features & Use Cases
- Three layers: MCP Client, runt-mcp-proxy, runt-mcp, and runtimed, with responsibilities outlined.
- Proxy Layer: Spawns child, restarts on upgrade, seeds NTERACT_MCP_REJOIN_NOTEBOOK env var, detects binary version changes.
- Session State Layer: Manages NotebookSession with Arc<RwLock>, guard in rejoin to avoid overwriting active session.
- Daemon Room Layer: Manages rooms by UUID, eviction after no peers for a configurable window.
- The Watch Loop State Machine: classify → act loop guiding rejoin decisions.
- Session Access Pattern: require_handle pattern to minimize lock contention.
Quick Start
Review the MCP session lifecycle to identify and fix race conditions between rejoin and user-tool calls.