Skip to main content
The Claude Agent SDK builds agents on Claude. Mirage exposes any Workspace to the SDK as an in-process MCP server, so every file and shell operation the agent runs is routed through Mirage instead of the host filesystem. This is distinct from Claude Code, the claude CLI run as it is on a workspace. Use this SDK integration when you build your own agent with claude_agent_sdk.query() and want Mirage tools rather than the built-in file tools.

Install

Usage

build_options wires a workspace into a ready-to-use ClaudeAgentOptions: it registers the Mirage MCP server, restricts the agent to Mirage’s tools, and injects a system prompt describing the mounted paths.

Composing with other MCP servers

Inside main, use MirageServer directly to combine Mirage with other servers:

Shell

To keep Claude’s own Bash tool and run it in a workspace, point the SDK at mirage-bash, as for Claude Code, and give it Mirage’s other tools over mirage mcp in place of Claude’s file tools. Both reach one workspace that the Mirage daemon serves:
  • Bash runs in the workspace, and Mirage’s read, write, edit, ls, grep and glob take the place of Claude’s Read, Edit, Write, Glob and Grep, so every file the agent touches goes through Mirage.
  • Mount the project and /tmp at their own paths, as the Claude Code page shows, so cd carries over.
  • To run under a profile, create a session with mirage session create demo --id agent -p reviewer, then set MIRAGE_SESSION to agent and add -s agent to the mirage mcp arguments.

Tools

The server serves the session’s seven tools, session.tools: shell, read, write, edit, ls, grep and glob, named mcp__mirage__<tool> in the SDK. It carries the ones the session’s profile leaves it (session.tools.names()).

Exports