# Developer documentation

## Install with an AI agent

An AI agent can set up workerfuse for you. Give it this prompt:

```text
Read https://workerfuse.com/install.md and set up workerfuse for my Cloudflare account.
```

You do two steps in the browser: you sign in and approve the agent, and you create a scoped Cloudflare token from a pre-filled link. The agent finds your account ID, connects the account with the `connect_cloudflare_account` tool, and checks the first report. The 14-day trial starts when the account connects. Read the full steps in [install.md](/install.md).

## Connect over MCP

The MCP endpoint is `https://workerfuse.com/mcp`. Add it with no key. Your client signs you in with OAuth:

```bash
claude mcp add --transport http workerfuse https://workerfuse.com/mcp
```

Then run `/mcp` in Claude Code and choose Authenticate. Codex, Cursor and OpenCode also find OAuth from the URL alone. Supported protocol versions are `2026-07-28`, `2025-11-25`, `2025-06-18`, and `2025-03-26`.

Only `server/discover` is public. `initialize`, `tools/list` and `tools/call` need credentials. Tool calls also need a trial or an active subscription.

## Tools

Tools take `accountId`, the 32-character hexadecimal Cloudflare account ID, not your workerfuse login ID. Call `list_accounts` to get it. You can omit it when your login has one account.

Tool

Action

Access

`list_accounts`

Read the Cloudflare accounts connected to your login, their mode and their last report time.

Read-only

`get_spend`

Read the latest report time and each script's hourly and daily spend estimates.

Read-only

`list_events`

Read the latest 100 reports with pauses or alerts.

Read-only

`pause_script`

Queue a pause for the named script.

Destructive

`resume_script`

Queue restoration of the script's latest recorded resumable pause.

Destructive

`set_limits`

Replace all hosted limits, skipped scripts, dry-run mode, and optional D1 row caps.

Destructive

`connect_cloudflare_account`

Check a scoped Cloudflare token, store it encrypted, and start managed guarding and the trial for that account.

Destructive

The four write tools are destructive. Ask the user before you call one. A queued command is not proof that it ran. Check later reports with `list_events`. Delivery and execution can take two checks, or about 10 minutes.

## Authentication

MCP clients use OAuth 2.1 with PKCE and dynamic client registration. The first request without credentials gets HTTP 401 with a `WWW-Authenticate` header that points to the [protected resource metadata](/.well-known/oauth-protected-resource/mcp). You sign in and approve the client in the browser.

Scopes: `spend:read` allows reads, `guard:write` allows pauses, resumes, limit changes and account connection, and `offline_access` keeps the client connected. Untick `guard:write` on the approval page to give an agent read-only access. Revoke a client in Settings under Connected agents; it stops at once.

Clients that cannot do OAuth can send your `wf_` API key as `Authorization: Bearer YOUR_API_KEY`. The key is shown once at signup and has full access. Rotate it in Settings if it is exposed, then update the guard's `CONTROL_KEY` secret. Read [auth.md](/auth.md) for details.

## Guard pairing API

A self-hosted guard sends run reports to `POST /api/report` with its Bearer key. A report identifies the Cloudflare account and includes script spend estimates, pauses, and alerts. The response carries hosted settings and pending commands for that account.

Read the [OpenAPI specification](/openapi.json) for the request and response formats. Do not send a Cloudflare API token to this endpoint.

## Agent files

Start with [llms.txt](/llms.txt) and [AGENTS.md](/AGENTS.md). Read [install.md](/install.md) to set up an account, and [authentication](/auth.md) and [pricing](/pricing.md) before making tool calls.

Machine-readable discovery is available in the [MCP server card](/.well-known/mcp/server-card.json), [API catalog](/.well-known/api-catalog), and [AI catalog](/.well-known/ai-catalog.json). The [agent skills index](/.well-known/agent-skills/index.json) lists available skills. The [OpenAPI specification](/openapi.json) describes the guard pairing API.

## Markdown

Every public page has a Markdown version. Add `.md` to the page path, such as [/developers.md](/developers.md). Use [/index.md](/index.md) for the home page.

You can also request the page with `Accept: text/markdown`:

```bash
curl -H "Accept: text/markdown" https://workerfuse.com/developers
```
