Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The MCP tooling

The mcp tooling (tooling::mcp, kind mcp) is a client for the Model Context Protocol, built on the official rmcp Rust SDK. It owns the wire protocol and the initialize lifecycle itself, mapping rmcp’s typed results onto omw’s tool / resource-info types and joining text tool results.

Transports

transportconfig keysspeaks over
stdiocommand, args, enva server subprocess, JSON-RPC
httpurl, auth_tokena streamable-HTTP MCP endpoint

Configuration

keytypetransportmeaning
transportstringbothstdio or http
commandstringstdiothe server executable
argsliststdioextra arguments
envattrsstdioextra server environment
urlstringhttpthe endpoint URL
auth_tokenstringhttpsent as a Bearer token

The auth_token and env values are never logged: they are Secrets (locked with mlock, zeroized on drop) that redact on Debug and serialize, and omw fails at startup if the lock cannot be taken.

[tooling.mcp]
kind = "mcp"
transport = "stdio"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-everything"]

Connecting

The build only parses and validates config; the server is dialed lazily on the first tool or resource use. The first use retries with exponential backoff (doubling from tooling_connect_backoff_start_ms up to tooling_connect_backoff_cap_secs, see tunables). A failed first use surfaces as Err for blocking callers and as the error event variant for event-driven callers; dropping the call (pump cancel, reload, or shutdown) cancels the wait. Tool results keep only their text content blocks, joined with newlines; binary content is dropped.

Resources

mcp surfaces every resource the peer advertises via list-resources. The two subscription modes map onto rmcp subscription filters:

  • subscribe-resource-list() subscribes to list-changed notifications and delivers resource-list-updated events carrying the freshly fetched list;
  • subscribe-resource(uri) subscribes to a single resource and, at each update, the host reads the resource back (resources/read) and delivers a resource-updated event carrying the content. Textual resource content is passed through as-is; binary content arrives base64-encoded, so match on the content’s mime-type to decide whether to decode it.

Both return BoxStreams; the host’s resource pump drains them and pushes tagged events into the agent inbox, and dropping the stream cancels the subscription.