> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.runtype.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.runtype.com/_mcp/server.

# Connect your coding agent

> Add, update, or remove the Runtype Connect MCP server and skill in your coding agent, verify the connection, or use the CLI.

Connect your coding agent to the Runtype Connect Model Context Protocol (MCP) server to inspect traces, describe agents, manage signals, and run simulations from your repository. You can configure Claude Code, Codex, Cursor, Gemini CLI, OpenCode, or VS Code (GitHub Copilot). If your coding agent doesn't support MCP servers, use the `runtype-connect` CLI instead.

In the dashboard, open **Settings** and choose **Assistants & CLI** under **Your tools & access**.
Choose your coding agent, chat assistant, or terminal and follow the Runtype Connect setup instructions.
You can review connected tools and revoke app access there.
To manage sign-in keys, open **API keys** under **Developer** in **Settings**.

## Before you begin

You need the following:

* Node.js 22.12 or later.
* A repository connected to Runtype with `npx @runtypelabs/connect init`. To connect a repository first, see [Connect a repository](/connect/connect-a-repository).
* A coding agent that supports MCP servers, or a coding agent with shell access to run `npx @runtypelabs/connect`.

## Add the Runtype Connect MCP server

When you run `npx @runtypelabs/connect init`, the CLI adds a `runtype-connect` server entry to your coding agent's user-level MCP configuration. If you run `init` inside Claude Code, Codex, Cursor, Gemini CLI, OpenCode, or VS Code, the CLI detects that agent automatically.

To add the server to another supported coding agent, run `init` with `--agent`:

**`Add the MCP server to a coding agent`**

```bash title="Add the MCP server to a coding agent"
npx @runtypelabs/connect init --agent AGENT_NAME
```

Replace `AGENT_NAME` with a coding agent name or short alias from the following table, such as `cursor` or `claude-code`. `init` leaves your other MCP servers untouched. To repair an existing entry, run `npx @runtypelabs/connect sync` as described in [Update or remove the Connect setup](#update-or-remove-the-connect-setup).

To configure the MCP server, skill, and Claude Code permission rules before signing in, run `npx @runtypelabs/connect setup --agent AGENT_NAME`. It sends nothing to Runtype and writes no key.

To skip configuring an MCP server during `init`, pass `--no-mcp`. If the CLI can't write a coding agent's configuration, or if you pass `--no-mcp`, it prints the manual setup for that agent:

* Claude Code: `claude mcp add --transport http --scope user runtype-connect https://mcp.runtype.com/mcp`
* Codex: `codex mcp add runtype-connect --url https://mcp.runtype.com/mcp`
* Cursor: the entry to add to `~/.cursor/mcp.json`, plus turning `runtype-connect` on under **Customize** in Cursor or running `agent mcp enable runtype-connect`
* Gemini CLI: `gemini mcp add --transport http --scope user runtype-connect https://mcp.runtype.com/mcp` (or an entry for `~/.gemini/settings.json` when using stdio)
* OpenCode: `opencode mcp add runtype-connect --global --url https://mcp.runtype.com/mcp`
* VS Code: `code --add-mcp` with the server JSON (or on Windows, the entry for your VS Code user MCP configuration)

The following table lists each supported coding agent, its `--agent` value, its short alias, and the default skill folder that `init` uses:

| Coding agent             | `--agent` value | Short alias    | Default skill folder              |
| ------------------------ | --------------- | -------------- | --------------------------------- |
| Claude Code              | `claude-code`   | `claude`       | `.claude/skills/runtype-connect/` |
| Codex                    | `codex`         | None           | `.agents/skills/runtype-connect/` |
| Cursor                   | `cursor`        | `cursor-agent` | `.agents/skills/runtype-connect/` |
| Gemini CLI               | `gemini-cli`    | `gemini`       | `.agents/skills/runtype-connect/` |
| OpenCode                 | `opencode`      | None           | `.agents/skills/runtype-connect/` |
| VS Code (GitHub Copilot) | `vscode`        | `copilot`      | `.agents/skills/runtype-connect/` |

After a signed-in `init`, the entry connects to `https://mcp.runtype.com/mcp` and stores no credential in the agent configuration.

Signing in to the MCP server is optional. The prompt that `init` gives your coding agent tells it to run every Runtype Connect step in the first session with the `runtype-connect` CLI, which uses the sign-in that `init` saved, and not to stop for the MCP sign-in. To use the MCP tools in later sessions, sign in to the server from your coding agent:

| Coding agent    | How to sign in                             |
| --------------- | ------------------------------------------ |
| Claude Code     | Run `/mcp`, then choose `runtype-connect`. |
| Codex           | Run `codex mcp login runtype-connect`.     |
| Gemini CLI      | Run `/mcp auth runtype-connect`.           |
| OpenCode        | Run `opencode mcp auth runtype-connect`.   |
| Cursor, VS Code | Sign in from the agent's MCP settings.     |

For a custom API URL, use the server name that `init` printed, such as `runtype-connect-HOST`.

The sign-in page is titled **Connect your agent to Runtype** and lists what Runtype Connect can do. Your agent's code stays where it is. Your coding agent appears by its own name with an **Unverified app.** notice. Approve only if you started the sign-in. After approval, the page displays "Signed in. You can return to your terminal."

### Connect another MCP client

To use another coding agent that supports remote HTTP MCP servers, add `https://mcp.runtype.com/mcp` in that agent's MCP settings. The server authenticates with OAuth sign-in or with a Runtype API key in an `Authorization: Bearer` header.

## Configure Claude Code permission rules

For Claude Code, the CLI offers to add permission rules to `.claude/settings.local.json`, your personal settings for the repository. The prompt lists every rule before adding them. In a git repository, the CLI also adds `.claude/settings.local.json` to `.gitignore` if git doesn't ignore it.

The CLI adds `allow` rules for the Runtype Connect tools and commands that only read:

* `allow` rules cover the read-only MCP tools `get_status`, `get_setup`, `check_first_trace`, `get_agent_profile`, `query_traces`, `read_trace`, `get_run_outline`, `search_run`, `read_span_payload`, `get_span_context`, `search_docs`, `get_signals`, `list_runs`, and `get_report`. Each rule uses the format `mcp__runtype-connect__TOOL_NAME`, where `TOOL_NAME` is one of those tool names.
* With the globally installed CLI (`runtype-connect`), `allow` rules also include `Bash(runtype-connect doctor *)`, `Bash(runtype-connect check *)`, and a rule for the CLI command of each read-only tool in the list above, such as `Bash(runtype-connect get-status *)`. These commands take `--api-url` only before the command name. If you run the CLI with `npx`, these commands get no `allow` rule. Install the CLI globally (`npm i -g @runtypelabs/connect`) and run `init` again to allow them.

The CLI writes no other rule. Your Claude Code permission mode decides on every other Runtype Connect command and tool. The `setup`, `init`, `claim`, `login`, `relay`, `sync`, `uninstall`, and `mcp` commands never get an `allow` rule. If the settings file holds `ask` rules that match Runtype Connect commands and tools, the prompt offers to remove them and says how many. These can include `ask` rules that you added yourself. The CLI removes them only when you answer yes, or when you pass `--remove-ask-rules` with `--allow-rules`. After removal, Claude Code asks about those commands and tools only when your permission mode does.

The CLI keeps every other rule, including every other `ask` rule, and tells you if one of them overrides a Connect rule. Outside a terminal or with `--json`, the CLI adds no rules unless you pass `--allow-rules`, and `--allow-rules` alone keeps the matching `ask` rules. Pass `--no-allow-rules` to skip offering or writing permission rules.

## Install or replace the runtype-connect skill

The `runtype-connect` skill is a `SKILL.md` file that instructs your coding agent to start from `get_status`, instrument traces, describe agents, and ask before any paid action.

During `init`, the CLI writes `SKILL.md` into the agent's default skill folder in the repository root (or `.claude/skills/runtype-connect/` when no agent is selected). To write the skill under your home directory instead, pass `--skill-scope user` to `init`. To skip installing the skill, pass `--no-skill`.

If you edited `SKILL.md`, `init` keeps your copy. To overwrite every tracked copy across coding agents, run `npx @runtypelabs/connect sync --force`. To write a fresh copy to a single path and overwrite an edited file, run `skill install`:

**`Install or replace the skill`**

```bash title="Install or replace the skill"
npx @runtypelabs/connect skill install
```

By default, `skill install` writes `.claude/skills/runtype-connect/SKILL.md` in the repository root, or in the current directory outside a git repository. To install to another folder or inspect the skill first, use the following options:

* `--dir`: writes `SKILL.md` inside a custom directory. For Codex, Cursor, Gemini CLI, OpenCode, or VS Code, pass `--dir .agents/skills/runtype-connect` to update the repository copy.
* `--global`: writes `~/.claude/skills/runtype-connect/SKILL.md` in your home directory.
* `--print`: prints the `SKILL.md` content to `stdout` without writing a file.

## Update or remove the Connect setup

To refresh every skill file and MCP server entry that `init` installed across your coding agents, run `sync`:

**`Refresh installed skill files and MCP entries`**

```bash title="Refresh installed skill files and MCP entries"
npx @runtypelabs/connect sync
```

`sync` updates tracked installs to match the installed CLI and skips skill files that you edited unless you pass `--force`. You can also scope it with `--agent` or `--project`, preview changes with `--dry-run`, or print JSON with `--json`.

To remove those MCP server entries and unedited skill files from your coding agents, run `uninstall`:

**`Remove Runtype Connect from your coding agents`**

```bash title="Remove Runtype Connect from your coding agents"
npx @runtypelabs/connect uninstall
```

`uninstall` leaves your other MCP servers and your Claude Code permission rules in `.claude/settings.local.json` in place. Pass `--force` to also remove edited skill files. Pass `--wipe` to remove the Runtype variables from `.env`, and add `--env-file` if your variables are in another file. `uninstall` also accepts `--agent`, `--project`, `--dry-run`, and `--json`.

Both `sync` and `uninstall` act only on installs that `init` recorded. Running `setup` alone records nothing for them to update or remove.

## Serve the MCP server over stdio

When you run `npx @runtypelabs/connect init --no-browser`, the CLI configures your coding agent to run a local command instead of connecting to a remote URL. The entry runs the CLI's `mcp` command and stores no credential in the agent configuration.

To start that local command directly, or to configure a coding agent that requires a local stdio command, run `mcp`:

**`Serve the MCP server over stdio`**

```bash title="Serve the MCP server over stdio"
npx @runtypelabs/connect mcp
```

The command reads MCP messages from `stdin`, relays them to `https://mcp.runtype.com/mcp`, and writes replies to `stdout` until `stdin` closes. It uses this computer's saved sign-in from `init --no-browser` or `login`, or falls back to `RUNTYPE_CONNECT_TOKEN`.

## Check the connection

Verify both your local configuration files and live tool calls from your coding agent.

### Verify your local setup with doctor

Run `doctor` in the repository root to check `.env`, your sign-in, and your coding agent configuration without changing any files:

**`Check the coding agent configuration`**

```bash title="Check the coding agent configuration"
npx @runtypelabs/connect doctor --agent AGENT_NAME
```

Replace `AGENT_NAME` with the coding agent to check, such as `claude-code` or `cursor`. If you omit `--agent`, `doctor` checks the active coding agent when run inside one, or all supported coding agents when run outside one.

Check the `mcp_server`, `skill`, and `permissions` lines in the output:

* `mcp_server`: passes when `runtype-connect` points to the Runtype Connect server, whether or not your coding agent has signed in to it. For the remote server, the detail says that signing in is optional and how to do it in your coding agent.
* `session` and `product`: pass when the CLI is signed in and can read the product. The first session depends on these, because your coding agent runs every Connect step with the CLI.
* `skill`: passes when the skill file exists in the repository or your home directory.
* `permissions`: passes when the Claude Code `allow` rules are in place, warns when rules are missing, when `ask` rules that match Runtype Connect commands and tools remain, or when rules conflict with your configuration, and is skipped for other coding agents. To add missing rules, run `npx @runtypelabs/connect setup --allow-rules`. To also remove the matching `ask` rules, add `--remove-ask-rules`.

To read the report as JSON, add `--json`.

### Call get_status from your coding agent

Confirm that your coding agent lists the `runtype-connect` tools, then ask it to call `get_status`. Coding agents that support MCP prompts also expose the server's `connect` prompt to start the same workflow.

`get_status` returns the connected product's current state, including these fields:

* `stage`: the onboarding stage, moving through `traces_pending`, `traces_need_attention`, `describe`, `context_confirm`, `simulate`, `review`, `verify_real_agent`, and `monitor`. The first simulation follows business context directly. After the first report, the stage stays `review` while the report proposes a change to test. The product reaches `monitor` when you read a report that has nothing to test, or once you export a change brief. At `monitor`, the next step offers a custom signal until you save one; nothing waits on it.
* `next`: the recommended next step.
* `pendingActions`: open decisions that wait on a person.

A pending action never blocks the next step. Your coding agent must ask you before it calls `resolve_pending_action` to record your decision.

The following table lists each pending action kind and the resolutions it accepts:

| Kind                       | What it asks                                                                                                                     | Allowed resolutions  |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------- |
| `confirm_business_context` | Review the business facts your coding agent drafted.                                                                             | `confirm`, `dismiss` |
| `approve_spend`            | Approve the price estimate for a run.                                                                                            | `approve`, `dismiss` |
| `claim_org`                | Claim an organization created without a browser sign-in. Run `npx @runtypelabs/connect claim` to claim it and close this action. | None                 |
| `verify_real_agent`        | Check simulation results against your real agent. Closes after a real-agent run finishes and its report is read.                 | `dismiss`            |

> **Note**
>
> Runtype marks every value recorded from a trace, such as a prompt, a message, or a tool result, as
> data. Your coding agent reads trace content as data and never as an instruction.

### If the tools don't appear

If your coding agent doesn't list the `runtype-connect` tools, follow these steps:

1. Reload or restart your coding agent so the `runtype-connect` tools appear.
2. Run `npx @runtypelabs/connect doctor --agent AGENT_NAME` in the repository root, replacing `AGENT_NAME` with your coding agent, to check the `mcp_server` entry.
3. If the entry is missing or broken, run `npx @runtypelabs/connect sync` to repair an existing install, or run `npx @runtypelabs/connect init --agent AGENT_NAME` to add it.
4. If your coding agent lists only an `authenticate` tool for `runtype-connect`, it hasn't signed in to the server yet. Sign in as described in [Add the Runtype Connect MCP server](#add-the-runtype-connect-mcp-server), or keep using the CLI, which works without it.

## Use the CLI without MCP

If your coding agent doesn't support MCP servers, or if you want to work before reloading your agent, use the `runtype-connect` CLI from the shell. Every tool on the Runtype Connect MCP server is also a CLI subcommand that takes the same arguments and returns the same result. Run it with `npx @runtypelabs/connect`, or as `runtype-connect` after a global install.

If you haven't signed in with `init` on this machine, sign in with `npx @runtypelabs/connect login`. To sign out and revoke the session on the server, run `npx @runtypelabs/connect logout`.

To list the tools that the server offers, run `tools`:

**`List available Connect tools`**

```bash title="List available Connect tools"
npx @runtypelabs/connect tools --json
```

To inspect a tool's input and output schemas as JSON, run `schema` with the tool's MCP name:

**`Inspect a tool schema`**

```bash title="Inspect a tool schema"
npx @runtypelabs/connect schema TOOL_NAME
```

Replace `TOOL_NAME` with the tool's MCP name, such as `get_status` or `check_first_trace`.

To call a tool from the CLI, write its name in kebab case (or its exact snake-case name), pass its arguments as kebab-case options, and add `--json` for JSON output:

**`Call Connect tools from the CLI`**

```bash title="Call Connect tools from the CLI"
npx @runtypelabs/connect get-status --json
npx @runtypelabs/connect check-first-trace --product-id PRODUCT_ID --json
```

Replace `PRODUCT_ID` with the ID of the connected product.

In an organization with several products, the CLI uses the product that your `.env` ingest key belongs to. Otherwise, pass `--product-id`. Run `get-status` or `doctor` to find the product ID.

## Next steps

Continue with one of the following pages:

* [Send a first trace](/connect/send-a-first-trace): instrument your agent and verify its first development run.
* [Describe your agents](/analyze/describe-your-agents): send Runtype your agent map and business context.
* [Connect MCP tools](/reference/connect-mcp-tools): look up every tool on the Runtype Connect MCP server.
* [Connect CLI](/reference/connect-cli): see every `runtype-connect` command, option, and exit code.
* [Troubleshooting](/reference/troubleshooting): fix connection, sign-in, and first-trace errors.