MCP
Servers are configured in .oi/mcp.json or ~/.config/oi/mcp.json. A server with command speaks stdio; a server with url speaks streamable HTTP (MCP 2025-06-18; servers answering 2025-03-26 are accepted too):
{ "servers": {
"github": { "command": "github-mcp", "args": ["stdio"],
"env": { "GITHUB_TOKEN": { "keychain": "github" }, "GH_HOST": "github.com" } },
"docs": { "url": "https://mcp.example.com/mcp",
"headers": { "X-Api-Key": { "env": "DOCS_KEY" }, "X-Tenant": "acme" } },
"tracker": { "url": "https://tracker.example.com/mcp",
"oauth": { "scopes": ["issues:read"] } } } }- Credentials: plaintext credentials are rejected at load time. Env values and HTTP headers must be
{"keychain": name}(stored withoi secret set name) or{"env": "VAR"}, optionally with a"prefix"such as"Bearer ". Injected values are tracked and redacted from all output. - Lazy start: a server starts only when
tool_searchneeds its catalog (then cached in SQLite) or when one of its tools, resources or prompts is used. A server'snotifications/tools/list_changeddrops its cached catalog. - Sandbox: stdio servers run under the same OS sandbox as
bash. HTTP servers are reached in-process, only overhttps(plainhttpfor localhost), and not at all while network access is off (--no-net). - Sessions: oi sends
MCP-Protocol-Versionand the server'sMcp-Session-Id, reads plain JSON and event-stream replies, re-initializes once when a session expires (404), and ends the session withDELETEon exit. - Server requests: oi answers
pingandroots/list(the workspace as afile://root) and declines sampling and elicitation. - Tool results: text blocks are joined; images (PNG, JPEG, GIF, WebP) are passed to the model as images; audio, binary resources and resource links become short text placeholders.
- OAuth: a remote server that answers 401 is authorized with
oi mcp login <server>. oi discovers the authorization server from the server's protected-resource metadata (RFC 9728, RFC 8414 / OpenID discovery), registers itself dynamically (RFC 7591) unlessoauth.client_idis set (with an optionalclient_secretref), and runs the authorization-code flow with PKCE (S256),stateand theresourceindicator through a loopback redirect (http://127.0.0.1:<port>/callback;oauth.redirect_portpins the port). It opens the browser and always prints the URL;OI_NO_BROWSER=1only prints it. Tokens are stored in the OS keychain asmcp-oauth:<server>, redacted from output, and refreshed when they expire or the server answers 401. When refreshing is not enough, the tool call fails with a message to runoi mcp loginagain.
oi mcp list servers, transport, catalog cache, auth status
oi mcp login <server> OAuth browser flow
oi mcp logout <server> forget stored tokens
oi mcp resources [server] list resources (JSON)
oi mcp read <server> <uri> read a resource
oi mcp prompts list prompts
oi mcp prompt <server> <name> [arg=value ...]OI_KEYCHAIN_FILE=<path> replaces the OS keychain with a private JSON file, for tests and machines without a secret service.