pub fn run() -> Result<()>Expand description
Run the MCP server until stdin closes.
Threading model (Goal 2.1):
- Main thread: reads stdin line-by-line, parses JSON-RPC, calls
handle_requestto compute a response, hands it to the writer via the mpsc channel. - Writer thread: single owner of stdout. Drains responses + push notifications from the channel, writes each as one line + flush. Single writer = no interleaving between responses and notifications.
- Watcher thread: holds an
InboxWatcher::from_head(starts at EOF — each MCP session only sees fresh events). Polls every 2s. For each new inbox event, checks the shared subscription set; if any matchingwire://inbox/<peer>orwire://inbox/allURI is subscribed, pushes anotifications/resources/updatedmessage into the channel.