Skip to content

Use Skeg from a coding agent

Skeg exposes its tools over MCP. A coding agent such as Claude Code or Codex can then check its own changes on a device before it calls the work done. The agent uses a project token: the token names the project, and holding it is the permission.

Want the files ready-made?

The agent kit packages the MCP config, a verification skill and a first-run prompt.

Set up

  1. In Skeg, open the project, then Settings → Agent tokens. Create a named token. The secret shows once.
  2. Find the runner on the agent's machine. Open Skeg Runner once: it creates a launcher at <home>/.config/skeg/skeg-runner (Windows: <home>\.config\skeg\skeg-runner.bat).
  3. Save a device target in Setup, ideally as the project default. The agent drives that target.
  4. Add the skeg MCP server. The setup panel next to the token generates the entry for Codex (TOML) and for MCP JSON clients.
  5. Restart the client's MCP server. Ask the agent: "Call Skeg's check_setup, then list_plans, and tell me which project you are connected to."

No pairing is needed. start_inspector starts a local runner on the agent's machine with the project token.

Share the config with your team, not the secret

Claude Code expands environment variables in a project's .mcp.json (docs). Commit the entry and let each developer export their own SKEG_TOKEN:

{
  "mcpServers": {
    "skeg": {
      "type": "stdio",
      "command": "${SKEG_RUNNER_BIN}",
      "args": ["--mode", "mcp", "--server", "https://api.getskeg.dev"],
      "env": { "SKEG_TOKEN": "${SKEG_TOKEN:-}" }
    }
  }
}

Each developer sets SKEG_RUNNER_BIN to their launcher path and SKEG_TOKEN to their token.

Never commit a token

Revoke a leaked token in Settings → Agent tokens. Its inspectors close as well.

Tell the agent when to verify

Put the loop into your repository's agent instructions (AGENTS.md or CLAUDE.md), so every change gets checked:

## Verify on device with Skeg

After a change with visible app behavior, verify it with the `skeg` MCP server:

1. Build and install the app on the default Skeg target. Call `check_setup` first.
2. Behavior should be unchanged: `list_plans`, then `execute_plan` (include_screenshots: false)
   on each plan that visits the changed screens. A failed step is a regression unless the change
   was intended.
3. Behavior changed on purpose: `start_inspector`, then `start_goal` with the goal and one
   observable fact per criterion. Wait with `goal_result`. On `passed`, `promote_goal_run`
   (reset_app: true for Android and iOS targets only: macOS cannot reset, so a reset step there
   fails every replay) and tell me the plan name to review. Then `stop_inspector`.
4. Report the verdict, failed steps or criteria, and the run id. Treat `inconclusive` and
   `infrastructure-error` as "not verified", never as a pass.

Write good criteria

  • criteria: facts that must hold where the run ends. "The cart badge shows 1."
  • intermediate_criteria: facts seen only during the run. "A 'Saved' toast appears." Putting these in criteria fails a correct run.
  • One observable fact per criterion. Describe the goal in user terms, not in code terms.
  • Reference test data as ${NAME} from an environment (list_environments). The agent never sees the values.

Tools

Tool Needs a model? Use
check_setup No Reports server, token, project, targets, runner and model key status.
list_plans, list_targets, list_environments No Read the project.
execute_plan, execute_tag No Replay one stored plan, or every enabled plan with a tag.
start_inspector, screenshot, stop_inspector No Start a local runner on a saved target and look at the screen.
tap, type_text, clear_text, swipe, assert_visible No Drive the device. Actions on the agent's own inspector are recorded.
save_recorded_plan, discard_recording No Keep or drop a hand recording.
start_goal, goal_status, goal_result, promote_goal_run Yes Verify new behavior with the goal agent, then keep it as a plan.
port_plan, port_result Yes Port a plan to the platform of the running inspector.

Goal runs and ports need a model key in the MCP server's own environment, for example ANTHROPIC_API_KEY (SKEG_LLM_PROVIDER and SKEG_LLM_MODEL change the provider and model). A model set in Skeg's chat does not reach an external agent.

Fixes

Symptom Fix
No tools, or executable not found Check the full runner path. The tray app does not add skeg-runner to PATH.
spawn '${SKEG_RUNNER_BIN}' ENOENT The variable is unset where the agent runs. Apps started from the Dock or Start menu do not read your shell profile. Start the agent from a terminal, or use the absolute path.
Missing token or HTTP 401 Create a token in the right project, replace it in the config, reconnect. Re-pairing the runner does not replace a project token.
"The local MCP runner is not connected yet" Retry start_inspector once, then check the MCP server's stderr log and server URL.
Wrong project Use a token from that project. For two projects at once, add two named MCP entries.
Replay drives the wrong device Check list_targets. Pass target to execute_plan, or change the project's default target.