# tabcap over MCP

For hosts that speak the Model Context Protocol instead of running commands (Cursor, Codex, Gemini CLI, Windsurf, Claude Desktop; Claude Code works either way), `tabcap mcp` serves tabcap as MCP tools on stdin / stdout and returns the same JSON envelopes as the CLI.

- Default tool set: 24 tools, the 21 everyday commands (sessions, navigate, snapshot, outline, click, fill, type, press-key, hover, wait, screenshot, evaluate, net start / stop / list / show / body, status, handoff continue) plus `tabcap_handoff_wait` (one `handoff wait` of up to 300 s; `untilUrl` / `untilText` / `untilSelector` / `untilCookie` end the handoff once that becomes true after it began), `tabcap_run` (`{argv}`: any other command, same validation) and `tabcap_help` (`{command?}`: the help of one command on demand; `{guide?}`: the task guides of `tabcap guide`, `""` lists them, an id gives one). `tabcap mcp --all-tools` exposes one tool per command instead (99 tools, about 88 KB of definitions; use only when the host can afford it).
- `browser start`'s `--chrome-arg`, `--drop-chrome-arg` and `--executable-path` are for the human: they are not tool arguments and `tabcap_run` refuses them. Ask the user to pass them in a shell or to put them in `config.json` (`chrome.args`, `chrome.dropArgs`, `chrome.executablePath`); `browser start` without them works.
- `waiting` (handoff) is never blocking: the envelope comes back with the `waiting` error and its `next`; call `tabcap_handoff_wait` or ask the human.
- `tabcap_handoff_wait` waits 30 s by default and at most 300 s, while the CLI `tabcap handoff wait --timeout` defaults to 60 s and allows up to 600 s. The difference is on purpose: an MCP host gives one tool call a short timeout, so the tool waits briefly and you call it again to wait longer; a shell has no such limit.
- Not exposed as tools (and refused by `tabcap_run`): `site add`, `account add`, `proxy add` (they read a password from stdin, which is the MCP channel — the human runs them in a shell), the three foreground servers (`replay serve`, `wire serve`, `fingerprint serve`), `update` (an agent must not upgrade its own tool mid-session), `bundle prune` (it deletes recordings; the human runs it), `daemon run`, `handoff wait` (use `tabcap_handoff_wait`) and `mcp` itself.
- Host config: `tabcap mcp --print-config <claude-code|cursor|codex|gemini-cli|windsurf|claude-desktop>` prints the file, the entry and the host's own add command (Claude Code: `claude mcp add tabcap -- tabcap mcp`).
- The output filters (`--select`, `--grep`, `--fields`) and `--full` are ordinary arguments, so they work through `tabcap_run` too.
