Skip to main content
An MCP server’s tools become one CLI: each tool is a subcommand that takes the tool’s arguments as one JSON object. Profiles, network rules and snapshots apply to it as to any CLI.

Register a server

mcp_cli reads the server’s tool list and returns a CLI; install it with register_cli, passing the same config:
A tool named search_issues becomes the subcommand search-issues; its --help prints the tool’s description and the JSON schema of its arguments. mcp_cli raises MCPToolsError when the server cannot be listed or its tools cannot all become distinct subcommands. The tool list is read once, at registration. To pick up tools the server added later, list them again, then remove the CLI and register the new one:

Authentication

auth sets the one header every request carries. Leave it out for a server that needs none. The token is redacted in snapshots. The URL is saved as written, so keep credentials in auth, not in the URL. A token must be printable ASCII with no leading or trailing space; any other is refused at registration.

Register from YAML

An MCP server is a clis: entry with cli: mcp. The token can come from ${VAR} or a credential pointer:
workspace.yaml
mirage workspace create workspace.yaml builds it on the server. A program that loads the file itself passes the listed servers to to_workspace_kwargs, which raises ValueError without them:

Call a tool

Text content prints as text; any other content prints as one line of JSON. A failed call is not retried. Cancelling the line cancels the call. A pre_network policy or a network: setting that excludes the server’s host refuses the call before anything is sent; a config’s network: also refuses listing its servers when it loads.

Profiles

A profile names a tool the way it names any CLI subcommand:
A tool the server marks readOnlyHint runs as a read; every other tool counts as a write.

On a server

The server takes cli: mcp entries in a workspace’s create body. PUT /v1/workspaces/{id}/clis/{name} installs one on a live workspace, and DELETE removes it. ${VAR} is expanded only in files; over HTTP, send the token or a pointer.

Snapshots

A snapshot keeps the tool list, so loading one rebuilds the CLI without contacting the server. The token is redacted, so pass the config again: