MCP tools

Spaces ships an MCP server so a coding agent can inspect and drive your projects, workspaces, and terminals as tools.

What it is

spaces mcp starts a Model Context Protocol server: an MCP client (a coding agent such as Claude Code, Codex, opencode, GitHub Copilot CLI, pi, or Amp) launches it as a subprocess and calls its tools directly, over standard input and output. Every call runs against the same Spaces service on this machine that the app and the CLI use, so an agent sees the same projects, workspaces, and terminals you do.

Setup

Settings → MCP → "MCP Client Setup" shows a ready-to-paste snippet per agent, including the resolved path to the spaces binary. The examples below use spaces on your PATH; substitute the absolute path from Settings if the CLI is not on it.

Claude Code

Register the server once at user scope, and Claude Code spawns it when it needs the tools.

claude mcp add spaces -s user -- spaces mcp

Codex CLI

Installing Codex's hooks from Settings → Coding Agents adds this entry for you. To add it by hand, put an mcp_servers table in ~/.codex/config.toml. Codex passes a server only the environment variables listed in env_vars, and these two are how the server knows which terminal is calling.

[mcp_servers.spaces]
command = "spaces"
args = ["mcp"]
env_vars = ["SPACES_TERMINAL_TRACKING_ID", "SPACES_AUTOMATION_RUN_ID"]

opencode

Add a spaces entry to the mcp block in ~/.config/opencode/opencode.json.

{
  "mcp": {
    "spaces": {
      "type": "local",
      "command": ["spaces", "mcp"],
      "enabled": true
    }
  }
}

GitHub Copilot CLI

Run once in your terminal.

copilot mcp add spaces -- spaces mcp

pi

Run once in your terminal.

pi mcp add spaces -- spaces mcp

Amp

Run once in your terminal.

amp mcp add spaces -- spaces mcp

Tools

The server exposes project, workspace, terminal, paired-device, and coding-agent tools. There is no stop tool for a workspace and no signal tool: an agent reports its own lifecycle only through the CLI hook spaces agent signal, which is intentionally left off the tool surface, so an agent can read another agent's status but never forge it.

ToolWhat it does
spaces_project_listList projects on this or a paired device.
spaces_project_createAdd a project from a folder (an absolute or ~ path) or a Git URL, with an optional device. Imports any spaces.yaml and returns the project and its default workspace, not started.
spaces_workspace_listList workspaces, optionally filtered by project.
spaces_workspace_createCreate a workspace: project and branch required, plus a base branch or existingBranch to reuse a branch, and an optional device. Not started automatically.
spaces_workspace_startEnsure a workspace is running.
spaces_workspace_restartRelaunch a workspace's configured processes.
spaces_terminal_listList available terminal sessions.
spaces_terminal_tailRead a session's recent output, defaulting to the last 20 lines.
spaces_terminal_sendSend text or raw bytes to a terminal session, optionally submitting it as a paste plus a separate Enter keystroke.
spaces_agent_listList coding-agent sessions, optionally filtered by workspace.
spaces_agent_statusRead one agent session's status, brief summary, and context.
spaces_agent_spawnStart a supported agent (claude, codex, opencode, copilot, pi, or amp) in a workspace and wait until it is ready for input.
spaces_agent_killEnd a coding-agent session and its terminal.
spaces_agent_subscribeWatch an agent from this terminal; get told when it goes blocked, done, or exits.
spaces_agent_unsubscribeStop watching an agent.
spaces_agent_brief_writeReplace an agent's brief, the short status page Spaces shows beside its terminal. An empty string clears it.
spaces_agent_brief_readRead an agent's brief in full, with when it was last updated.
spaces_agent_brief_clearRemove an agent's brief.
spaces_device_listList the paired devices this machine can reach.

The brief tools act on the calling terminal's own agent unless given a session, so an agent connected to this server keeps its own brief with no extra setup. See agent briefs for what a brief is and where it shows, and briefs for the matching CLI commands. The rest of the agent tools are covered in full at Orchestrate agents.