Raw: https://promptreports.ai/docs/build-with-agents.md

# Build workflows from your coding agent

Each builder action has an API route on api.promptreports.ai and a tool on the PromptReports MCP server, so a coding agent can build a workflow for its person the way the person would in the app.

The agent signs in with a PromptReports ID agent token under its person's grant Switching on. Its writes go through the same PromptCompute approvals as the person's, and it can ask for an approval but never decide one. When it connects a service that signs in with OAuth, the person finishes consent in their own browser. Drafting, validating, diffing, step tests and dry runs count nothing; a run counts one workflow request at its first connector action.

## Claude Code

Add the server once from a terminal, then run `/mcp` inside Claude Code and sign in through the browser:

```
claude mcp add --transport http promptreports https://mcp.promptreports.ai/mcp
```

Or check it in for the whole team in `.mcp.json` at the project root. An entry needs `"type": "http"`; without it Claude Code reads the entry as a local server and skips it.

```
{
  "mcpServers": {
    "promptreports": { "type": "http", "url": "https://mcp.promptreports.ai/mcp" }
  }
}
```

Checked on 2026-11-12 against Claude Code's MCP docs: https://code.claude.com/docs/en/mcp

## OpenAI Codex

Add a table to `~/.codex/config.toml` (or `.codex/config.toml` in a trusted project), then sign in through the browser:

```
[mcp_servers.promptreports]
url = "https://mcp.promptreports.ai/mcp"
```

```
codex mcp login promptreports --scopes promptreports:read,promptreports:write
```

Name the two scopes. On 2026-11-18 a live Codex install (codex-cli 0.144.5) without `--scopes` asked to register for every scope the ID lists, and PromptReports ID refused it: a client that registers itself may ask only for `promptreports:read` and `promptreports:write`. With `--scopes` it registered and printed the sign-in link.

Checked on 2026-11-12 against the Codex MCP docs: https://learn.chatgpt.com/docs/extend/mcp?surface=cli

## Cursor

Add the server to `.cursor/mcp.json` in the project, or `~/.cursor/mcp.json` for every project. Cursor's docs say it signs in with OAuth when the server asks for it; that sign-in has not been tried from a live Cursor install.

```
{
  "mcpServers": {
    "promptreports": { "url": "https://mcp.promptreports.ai/mcp" }
  }
}
```

Checked on 2026-11-12 against Cursor's MCP docs: https://cursor.com/docs/context/mcp

## The builder tools

Each tool calls the same handler as its API route. The run tools answer today Switching on; the rest will answer as their pull requests merge.

| Tool | API route | Effect | State |
|---|---|---|---|
| `list_connectors` | `GET /v1/connectors` | read | Planned |
| `list_tools` | `GET /v1/connections/{id}/tools` | read | Planned |
| `connect_service` | `POST /v1/connections` | write | Planned |
| `set_tools` | `PATCH /v1/connections/{id}/tools` | write | Planned |
| `refresh_tools` | `POST /v1/connections/{id}/refresh` | write | Planned |
| `create_workflow` | `POST /v1/workflows/drafts` | write | Planned |
| `get_draft` | `GET /v1/workflows/{id}/draft` | read | Planned |
| `update_workflow` | `PUT /v1/workflows/{id}/draft` | write | Planned |
| `validate_workflow` | `POST /v1/workflows/validate` | read | Planned |
| `diff_workflow` | `GET /v1/workflows/{id}/diff` | read | Planned |
| `test_step` | `POST /v1/workflows/{id}/steps/{step}/test` | write | Planned |
| `save_workflow` | `POST /v1/workflows` | write | Planned |
| `list_versions` | `GET /v1/workflows/{id}/versions` | read | Planned |
| `list_triggers` | `GET /v1/workflows/{id}/triggers` | read | Planned |
| `set_trigger` | `POST /v1/workflows/{id}/triggers` | write | Planned |
| `remove_trigger` | `DELETE /v1/workflows/{id}/triggers/{trigger}` | destructive | Planned |
| `list_workflows` | `GET /v1/workflows` | read | Switching on |
| `get_workflow` | `GET /v1/workflows/{id}` | read | Switching on |
| `start_run` | `POST /v1/runs (dry_run for a dry run)` | write | Switching on |
| `get_run` | `GET /v1/runs/{id}` | read | Switching on |
| `list_runs` | `GET /v1/runs` | read | Switching on |
| `cancel_run` | `POST /v1/runs/{id}/cancel` | destructive | Switching on |
| `get_record` | `GET /v1/runs/{id}/record` | read | Switching on |
| `get_usage` | `GET /v1/usage` | read | Switching on |

`update_workflow` takes the digest of the draft the agent read. If the person changed the draft since, the update is refused with `stale_draft` and the new digest, and the person's change stays.

## SDKs and the CLI Built

Both SDKs are generated from the same OpenAPI document as the API, one method per builder action. They are built, not yet published; they will publish once the owner sets the package names. Until then they ship inside the existing PromptCompute packages.

```
import { PromptReports } from "@promptcompute/sdk/workflows";

const pr = new PromptReports(); // PROMPTREPORTS_TOKEN
await pr.validateWorkflow({ manifest });
await pr.dryRun("weekly-digest");
await pr.setTrigger({ id: "weekly-digest" }, { kind: "timer", settings: { every: "PT15M" }, overlap: "skip" });
```

```
from promptreports import PromptReports

pr = PromptReports()  # PROMPTREPORTS_TOKEN
run = pr.dry_run("weekly-digest")
print(pr.get_run(run["id"])["status"])
```

```
export PROMPTREPORTS_TOKEN=...
promptreports workflows validate wf.json
promptreports workflows dry-run weekly-digest
promptreports workflows triggers set weekly-digest --kind timer --every PT15M --overlap skip
```

The SDKs send `PromptReports-Client: sdk-js/<version>` or `sdk-python/<version>`, and the CLI `cli/<version>`, so each run records how it started. The CLI reads `PROMPTREPORTS_TOKEN`; signing in through the browser will follow.
