Connect CLI
The runtype-connect CLI (@runtypelabs/connect) connects an existing AI agent repository to Runtype and calls tools on the Runtype Connect MCP server. It requires Node.js 22.12.0 or later and targets https://mcp.runtype.com/mcp (https://api.runtype.com) by default.
Run the CLI
Run commands with npx, or install @runtypelabs/connect globally (npm install -g @runtypelabs/connect) and call runtype-connect directly:
Replace COMMAND with a Connect command, a built-in command, or a server tool name.
In an interactive TTY (without --no-input or RUNTYPE_CONNECT_NO_INPUT), running with no command or only init flags starts init. Outside an interactive terminal, running with no command prints top-level help.
Command overview
The following table lists the Connect and built-in commands. Every tool on the Runtype Connect MCP server also runs as a kebab-case command (see Tool commands).
Global flags and environment variables
Global flags apply to every command and can appear anywhere before --, except --api-url and --api must appear before doctor, check, and the commands of read-only tools such as get-status. Don’t place a global flag right after a command flag that expects a value.
The following table lists the global flags:
-V and --version work only as the first argument. -h and --help work as the first argument for top-level help or after any command for that command’s help.
The following table lists the environment variables that configure the CLI:
Inside Claude Code, Codex, Cursor, Gemini CLI, OpenCode, or VS Code, init and setup configure that coding agent and doctor checks it by default. Inside Claude Code, Codex, Cursor Agent, Gemini CLI, or OpenCode, --max-output defaults to 30000 characters. Set AI_AGENT to use the same output default in another coding agent.
The CLI resolves credentials in the following order:
--token.RUNTYPE_CONNECT_TOKEN(fails with exit code2if--tokensets a different value).- This computer’s no-browser session from
init --no-browser, unless you signed in withloginafter it. - The stored sign-in from
loginfor the target server and profile.
Connect commands
Connect commands manage repository setup, no-browser sign-up claims, local checks, local relays, and updating or removing what init installed. Run setup when you want your coding agent to handle sign-in later; run init to sign in and connect the repository now. Connect commands take precedence over server tools with the same name and accept -h, --help, --FLAG VALUE, and --FLAG=VALUE.
setup
Installs the Runtype Connect MCP server, the repository runtype-connect skill, and optional Claude Code permission rules without signing in, making network requests, or touching .env. It’s safe to run again and prints the commands that sign in and connect the repository (init and init --no-browser). Run setup with the following syntax:
Replace FLAGS with any flags from the following table:
init
Connects the repository in the current directory to Runtype. init signs you in, finds or creates a product, creates an ingest key, and writes RUNTYPE_INGEST_KEY, RUNTYPE_OTLP_URL, and RUNTYPE_ENVIRONMENT to .env (creating new env files with 0600 permissions on Unix). It updates .gitignore if needed, installs the MCP server (runtype-connect, or runtype-connect-HOST for a custom API URL) and runtype-connect skill, and prints or opens the setup prompt. The MCP entry is the remote HTTP server, and signing in to it from the coding agent is optional. The setup prompt tells the coding agent to run every Connect step in its first session as runtype-connect COMMAND --json, and not to stop for the MCP sign-in.
init records the MCP entries and skill files it installs in the CLI configuration directory so sync and uninstall can update or remove them. If saving that record fails, init still succeeds and prints a warning (also returned in warnings under --json). Running init again checks the existing key without creating a new one and never prints the ingest key secret. Run init with the following syntax:
Replace FLAGS with any flags from the following table:
For the full repository setup workflow, see Connect a repository.
simulate
Prepares a simulation for the exact product you select. It signs you in or reuses your session, reads saved product context, and offers to open your coding agent. It keeps the existing product and its saved targets, authentication and traces. It doesn’t run repository setup or start a simulation.
Run simulate with the following syntax:
Replace PRODUCT_ID with the product ID from its Simulations page. Replace FLAGS with any flags from this table:
The agent prepares a draft plan and estimate for you to review in the dashboard. You start the run there. simulate requires explicit starts for the product’s baseline and proposed changes. Starting a run yourself keeps that requirement in place. Runs already queued or running continue. See Run a baseline simulation.
claim
Claims the temporary organization created by init --no-browser, checks whether it is claimed, or deletes the saved no-browser session. With no flags in an interactive terminal, claim checks status and prompts through email verification. Run claim with the following syntax:
Replace FLAGS with any flags from the following table:
mcp
Serves the Runtype Connect MCP server over stdio until stdin closes, relaying JSON-RPC messages with this computer’s init --no-browser session or a stored sign-in. Start the stdio relay with the following command:
mcp takes no command flags; global flags apply. For coding agent setup details, see Connect your coding agent.
check
Calls check_first_trace for the repository’s product and reports whether recent development runs carry required attributes and content. When a required check fails, check prints a fix prompt. It makes no changes and requires a sign-in or no-browser session. Run check with the following syntax:
Replace FLAGS with any flags from the following table:
check exits 0 for healthy, 1 for needs_attention, 5 for degraded (the output says what is missing and what it costs), and 6 for processing or no_traces. For what each check inspects, see Send a first trace.
doctor
Checks the repository’s Connect setup without changing anything. doctor runs env_file, otlp_endpoint, session, product, ingest_key, mcp_server, skill, and permissions, plus content when .env sets RUNTYPE_CONTENT, reporting pass, warn, fail, or skip for each. It shows only the ingest key prefix and prints no other values from .env. Run doctor with the following syntax:
Replace FLAGS with any flags from the following table:
mcp_server passes when the entry points to the Runtype Connect server, whether or not the 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 the coding agent. session and product check the CLI’s own sign-in and access to the product, which the coding agent’s first session uses.
permissions checks the Claude Code rules for Runtype Connect, warns when rules are missing, a deny rule blocks Connect, or .mcp.json defines another runtype-connect server, and skips for other agents. It never fails doctor.
After setup and before init (when the MCP server or skill is in place without .env), doctor fails env_file, names init as the next step, and sets prepared to true. doctor exits 0 with no failed checks, 1 on a failed check, 2 when the server can’t report the setup status, 3 when sign-in is refused, and 4 when a URL is unreachable or returns an unexpected HTTP status.
relay
Pairs this computer with your Runtype account and forwards simulation calls from Runtype to one local loopback address until you stop it with Ctrl-C. Requires a claimed organization (signed in with login or claimed with claim). When the repository has .runtype/agents.yaml (or .runtype/agents.yml), relay reads defaults from it and can start and stop your local server automatically. Start the relay with one of the following forms:
Replace the following:
NAME: the entry name in.runtype/agents.yamlwhen the manifest defines multiple entries.PATH: the path to a manifest file.AGENT_ID: the agent ID (agents[].idfromnpx @runtypelabs/connect get-status; required fora2aandchatunless set in the manifest).LOOPBACK_URL: the local address the agent or MCP server listens on.FLAGS: any optional flags from the following table.
The following table lists the flags for relay:
With --protocol a2a, relay forwards only POST requests to LOOPBACK_URL and GET requests to A2A card paths (/.well-known/agent-card.json and /.well-known/agent.json) on that origin. With --protocol chat, it forwards only POST requests to LOOPBACK_URL and serves a generated A2A card itself.
When a manifest entry sets command and the local server isn’t ready (a 2xx from healthPath when set, otherwise any HTTP response from forwardTo), relay starts command in cwd unless you pass --no-start. relay waits up to readyTimeoutMs (default 15 seconds) for that same check to pass and stops the process when relay exits. An already running server is left alone.
For the .runtype/agents.yaml schema and manifest errors, see Agent manifest. For the local relay workflow, see Test against your real agent.
sync
Refreshes the Runtype Connect skill files and MCP server entries that init installed on this computer, without network requests or sign-in. Run sync after upgrading the CLI to update tracked skill files to the installed version. It rewrites each tracked skill file (keeping files you edited after installation unless you pass --force), recreates deleted tracked skill files, and restores tracked MCP entries.
sync acts only on installations recorded by init; entries from setup or skill install aren’t tracked until you run init. Run sync with the following syntax:
Replace FLAGS with any flags from the following table:
MCP statuses are unchanged, updated, installed, and failed. Skill statuses are unchanged, updated, recreated, missing (--dry-run only), modified_by_user, and failed. sync exits 0 when no item fails and 1 when any item fails.
uninstall
Removes the Runtype Connect MCP server entries and skill files that init installed on this computer, leaving other MCP servers and edited skill files (unless you pass --force) untouched. Makes no network requests.
uninstall acts only on installations recorded by init. It doesn’t remove the product or ingest key in Runtype, your sign-in (logout), a no-browser session (claim --forget), Claude Code permission rules, .gitignore entries, .runtype/agents.yaml, or files created by setup or skill install. Run uninstall with the following syntax:
Replace FLAGS with any flags from the following table:
MCP statuses are removed, already_absent, and failed. Skill statuses are removed, already_absent, modified_by_user, kept_shared (used by another tracked agent), and failed. Env file statuses are cleaned, unchanged, not_found, and failed (with removed listing removed variables). uninstall exits 0 when nothing fails and 1 when any item or the env file fails.
Claude Code permission rules
For Claude Code, setup and init offer rules that let read-only Connect tools run without asking (plus doctor, check, and the CLI commands of those read-only tools, such as get-status, when installed globally as runtype-connect; these commands take --api-url only before the command name). They write no rule for any other Connect command or tool, so your Claude Code permission mode decides on those, including init, claim, setup, login, relay, sync, and uninstall. When .claude/settings.local.json holds ask rules that match Connect commands and tools, both commands offer to remove them, and remove them only when you confirm or pass --remove-ask-rules with --allow-rules. Every other ask rule stays. Without --allow-rules or --no-allow-rules, both commands ask in an interactive terminal and write no rules outside one or with --json.
Built-in commands
Built-in commands handle authentication, tool discovery, skill installation, and shell completion. All built-in commands except call and version accept -h or --help and accept --FLAG VALUE or --FLAG=VALUE. For call, run call TOOL_NAME --help to print that tool’s help.
login
Signs in to the Runtype Connect MCP server and saves the credential in the configured credential store. Run login with the following syntax:
Replace FLAGS with any flags from the following table:
logout
Revokes a stored OAuth session on the server and deletes the stored credential locally. If RUNTYPE_CONNECT_TOKEN is still set, logout notes it on stdout (or in envTokenStillSet in JSON output). Takes no command flags. Run logout with the following command:
auth status and whoami
Shows the active server, profile, credential source, identity claims, and OAuth expiry or refreshability without a network request. whoami is an alias for auth status. Exits 0 when signed in and 3 when signed out or expired. Check sign-in status with either command:
Pass --json to print JSON in a terminal; non-TTY stdout prints JSON automatically.
auth token
Prints the active bearer token to stdout, refreshing an expiring OAuth token first, and exits 3 when no credential is available. Takes no command flags. Print the token with the following command:
tools
Lists the tools offered by the Runtype Connect MCP server. Run tools with the following syntax:
Replace FLAGS with any flags from the following table:
schema
Prints a tool’s name, command, inputSchema, outputSchema, and annotations as JSON. Pass the server tool name (for example, get_status):
Replace TOOL_NAME with the server tool name.
call
Calls a server tool by its exact name with the same argument and output flags as any tool command. Use call for tools that aren’t cached or share a name with a built-in command:
Replace the following:
TOOL_NAME: the exact tool name on the server.FLAGS: the tool’s argument and output flags.
skill install
Writes the runtype-connect SKILL.md file, overwriting any existing file at the target path. Defaults to .claude/skills/runtype-connect/SKILL.md in the repository root (or the current directory outside git). Run skill install with the following syntax:
Replace FLAGS with any flags from the following table:
completion
Prints a shell completion script to stdout for the shell you name:
Replace SHELL with bash, zsh, or fish.
version and help
version, --version, and -V print the CLI version as the first argument. help, --help, and -h print top-level help as the first argument, and help COMMAND (or COMMAND --help) prints help for COMMAND. Check the version or print help with these commands:
Replace COMMAND with a Connect, built-in, or tool command name.
Tool commands
Every tool on the Runtype Connect MCP server runs as a CLI command, including the run-inspection commands get-run-outline, search-run, read-span-payload, and get-span-context (see Investigate a large run). The CLI caches the server’s tool list and refreshes it on an unknown command or flag, so new server tools work without upgrading the CLI. For the full catalog, see Connect MCP tools.
How tools and arguments map
Tool names and input schema properties map to commands and flags by the following rules:
- Command names: both the exact server name (
get_status) and its kebab-case alias (get-status) invoke the tool. - Flag names: every top-level input property becomes a kebab-case flag (
productIdbecomes--product-id). - Name collisions: a property matching a reserved flag becomes
--arg-NAME. RunTOOL_NAME --helpto see final flag names. - Schema defaults: a required property with a schema default isn’t required on the command line. Run
TOOL_NAME --helpto see each tool’s flags. - Single positional argument: if a tool has one required
stringproperty, pass it positionally or as a flag. - Non-object schemas: pass non-object inputs with
--json-body,--input, or piped stdin. - Booleans: pass
--FLAGfortrue,--no-FLAGforfalse, or--FLAG=trueand--FLAG=false. - Arrays and maps: repeat flags (
--FLAG VALUE_1 --FLAG VALUE_2). Scalar arrays also accept a JSON array string. Map flags takeKEY=VALUEpairs (duplicate keys exit2). - Objects and JSON files: accept inline JSON,
@PATHfor a UTF-8 file, or@-for stdin. Escape a leading@as@@. - Body and field input: pass full arguments with
--input FILE,--json-body JSON, or stdin, and set nested fields with-F(--field) and-f(--raw-field). Precedence from lowest to highest: body input,-fand-F, then typed flags and positional arguments. Objects deep-merge; arrays and scalars replace.
Call a tool by its kebab-case name and flags, or pass --json-body when you need an explicit null value:
Replace PRODUCT_ID with the product ID printed by init.
A result’s next.cli field starts with the command you used (npx @runtypelabs/connect or runtype-connect, or npx @runtypelabs/connect when a coding agent calls MCP tools directly) and adds --api-url when you target another API.
Common tool flags
Every tool command accepts the following flags in addition to its schema-derived flags:
Repeating a non-repeatable reserved flag, or combining --json, --jsonl, and --output with conflicting modes, fails with exit code 2.
JSON output and errors
Output formatting depends on --json (or --output) and whether stdout is a TTY:
- Connect commands (
setup,init,claim,check,doctor,relay,sync,uninstall): print text by default and JSON with--json.init --jsonomits the ingest key secret and opens no coding agent;claim --jsondisables prompts. - Built-in commands:
schemaalways prints JSON.tools,auth status(whoami),login,logout, andskill install(without--print) emit JSON automatically off a TTY. - Tool commands on a TTY (
--output auto):get-status,get-agent-profile,get-report, andlist-runsrender terminal summaries. Other tools print pretty-printed JSON ofstructuredContent(or text blocks). - Tool commands off a TTY (
--output auto): print compact single-line JSON ofstructuredContent. - Tool commands with
--json: print the full MCP tool result envelope (content,structuredContent,isError) as JSON even on a TTY.
Errors print to stderr as plain text (Error: ...) with a hint on a TTY, or as a single JSON line off a TTY:
How commands resolve the product
When looking for a local ingest key, commands read .env, or .env.local if git tracks .env and an untracked .env.local exists (or if only .env.local sets RUNTYPE_INGEST_KEY). The CLI uses that key only when RUNTYPE_OTLP_URL matches API_URL/v1/otel/v1/traces and the key has the Runtype ingest key format.
Product resolution works as follows:
- Product-scoped tool commands (tools accepting
productId, other thanget-status): when you omit--product-id, the CLI resolves the product from the local.envingest key. Otherwise the server uses your organization’s only product, or lists your products if you have more than one. get-status: when you omit--product-idin a multi-product organization, the CLI matches the local.envingest key to one product, callsget_statusagain for it, and addsproductFrom: "ingest_key_in_env"andproductNoteto the result.check: uses--product, then the local.envingest key, then the organization’s only product or the product named after the repository. Exits2and lists products if none matches.doctor: uses--product, then (when signed in) the local.envingest key, the organization’s only product, or the product named after the repository.relay --connect: uses--product-id(--product), then the local.envingest key, then the organization’s only product.
Exit codes
The CLI uses fixed exit codes so scripts and coding agents can branch on outcomes. The following table lists every exit code:
Next steps
Continue with one of the following pages:
- Quickstart: run through connecting an agent from
initto a first simulation report. - Trace attributes: look up the span and resource attributes Runtype reads from traces.
- Limits and pricing: check span, retention, and signal allowances by plan.
- Troubleshooting: resolve ingest errors, first-trace failures, and connection problems.