Register a server
mcpCli reads the server’s tool list and returns a CLI; install it
with registerCli, passing the same config:
search_issues becomes the subcommand search-issues; its
--help prints the tool’s description and the JSON schema of its
arguments. mcpCli rejects with 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 aclis: 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, and
configToWorkspaceArgs lists each server as it loads the file.
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
preNetwork 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:readOnlyHint runs as a read; every other tool
counts as a write.
On a server
The server takescli: 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.