# MCP guide
Connects configured servers, discovers tools, and routes cancellable calls.
## Where to look
| Initialize and request lifecycle | `client.rs`, `protocol.rs`, `jsonrpc.rs` |
| Server isolation and registry | `manager.rs` |
| Qualified names and schema conversion | `names.rs`, `tool_schema.rs` |
| Child transport | `stdio.rs` |
| HTTP requests and notification streams | `http.rs`, `sse.rs` |
| Literal header validation and redaction | `headers.rs` |
| OAuth facade and helpers | `oauth.rs`, `oauth/discovery.rs`, `oauth/login.rs`, `oauth/storage.rs`, `oauth/tokens.rs` |
## Local rules
- Initialization uses protocol `2025-03-26`; validation belongs at the protocol/client boundary.
- Use `QualifiedMcpToolName` for `mcp__server__tool`: at most 64 bytes, nonempty ASCII components without `__`. Server names cannot end in `_`, which makes routing ambiguous.
- Manager owns bad-server isolation and duplicate-route detection; never advertise ambiguous names.
- Stdio is newline JSON-RPC, not LSP Content-Length framing. Preserve the 1 MiB frame cap and fail pending requests on EOF.
- POST accepts JSON/SSE and carries the HTTP session id. GET notification SSE is best effort; unsupported GET cannot break POST calls.
- GET-SSE owns isolated runtime shutdown/cancellation; preserve HTTP-session DELETE teardown.
- A request timeout terminates the connection; do not leave it usable for later calls.
- Settings own structural parsing, one-time expansion and approval (see `../config/AGENTS.md`). Runtime accepts resulting literal headers, including sensitive ones, without expanding again. Redact every header value in all output paths.
- OAuth storage stays behind its private facade with token locks and protected files under configured home.