# Use AppliFlo from a coding agent

> Connect Claude Code, Cursor or VS Code to the AppliFlo MCP server with a key, choose its scopes, and understand the confirm step before anything is sent.

The AppliFlo MCP server gives a coding agent the same actions as the REST API, as tools. It is at `https://appliflo.com/api/mcp` and takes your API key in the `Authorization` header. Signing in from Claude.ai and ChatGPT is coming soon; today you connect with a key.

## 1. Make a key with the right scopes

Make a key in [Settings, API keys](https://appliflo.com/settings/api-keys). Give the agent only what it needs:

| The agent should | Tick |
| --- | --- |
| Look at documents, envelopes and templates | Read |
| Upload, detect and fill | Read, Create drafts |
| Also send, remind and void | Read, Create drafts, Send and void |

A tool outside the key's scopes answers with an error starting `403: insufficient_scope`, and does nothing. See [API keys and scopes](https://dev.appliflo.com/guides/api-keys).

## 2. Connect your client

For Claude Code, run this with your key in place of `aflo_live_...`:

```bash
claude mcp add appliflo --transport http https://appliflo.com/api/mcp --header "Authorization: Bearer aflo_live_..."
```

Setup for Cursor, VS Code and other clients is on [Connect a client](https://dev.appliflo.com/mcp/connect). Then ask the agent to list your envelopes: it calls `list_envelopes`, which only reads.

## 3. The confirm step

Four tools email people or cancel a send, so they take two calls: `send_envelope`, `void_envelope`, `send_template` and `send_template_bulk`.

1. The agent calls the tool without `confirm: true`. Nothing is sent. AppliFlo runs every real check first, then answers with an error result that says what would happen, such as who would be emailed, with the details in `structuredContent`.
2. The agent shows that to you. Once you agree, it calls the tool again with the same arguments and `confirm: true`.

The raw calls look like this:

```json
{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "tools/call",
  "params": {
    "name": "send_template",
    "arguments": {
      "template_id": "tpl_lease",
      "people": { "r1": { "name": "Lan Nguyen", "email": "lan@example.com" } },
      "prefill": { "3": "12 Rose St, Parramatta NSW 2150" },
      "idempotency_key": "lease-send-7731"
    }
  }
}
```

```json
{
  "jsonrpc": "2.0",
  "id": 8,
  "method": "tools/call",
  "params": {
    "name": "send_template",
    "arguments": {
      "template_id": "tpl_lease",
      "people": { "r1": { "name": "Lan Nguyen", "email": "lan@example.com" } },
      "prefill": { "3": "12 Rose St, Parramatta NSW 2150" },
      "idempotency_key": "lease-send-7731",
      "confirm": true
    }
  }
}
```

Pass the same `idempotency_key` on both calls, so a retry never emails anyone twice.

Only those four tools have a `confirm` input. `remind_envelope`, `cancel_bulk_batch` and `fix_bulk_row` act on the first call, so your client asks you before it runs them, as it does for every tool that changes something.

A refused send, such as a form that must be signed by hand, is refused on the first call, so you are never asked to confirm something that can't be sent.

## What each tool does

Every tool has a page under [MCP tools](https://dev.appliflo.com/mcp/tools) with its inputs. Tools are marked by what a client does before running them:

- **read** tools only look, such as `list_envelopes` and `get_envelope`.
- **asks first** tools change your workspace without emailing anyone, such as `upload_document`, `detect_fields` and `fill_document`.
- **destructive** tools email people or cancel a send, such as `send_envelope` and `remind_envelope`.

## Official forms and contracts

- Forms that must be signed by hand are refused with `esign_not_allowed`. Ask the agent to fill the form and download it instead.
- A form whose agency may reject an electronic signature needs `esign_risk_acknowledged: true`, which the agent should set only after you agree. See [official agency forms](https://dev.appliflo.com/guides/send-for-signature#official-agency-forms).
- `send_template` and `send_template_bulk` on an AppliFlo library contract our lawyer has not reviewed are refused with `contract_risk_required` until they are sent with `risk_accepted: true`, which the agent should set only after you accept the risk. See [Send a saved template](https://dev.appliflo.com/guides/send-template#appliflo-library-contracts).

## Let the agent read these docs

So the agent writes correct calls, point it at these docs:

- `https://dev.appliflo.com/llms.txt`: an index of every page.
- `https://dev.appliflo.com/llms-full.txt`: every page in one Markdown file.
- Any page as Markdown: add `.md`, for example `https://dev.appliflo.com/guides/quickstart.md`.
- The AppliFlo Docs MCP at `https://dev.appliflo.com/docs-mcp`, with `search_docs` and `get_doc` tools. It is read-only, needs no key, and only reads these docs.

To add the AppliFlo Docs MCP to Claude Code:

```bash
claude mcp add appliflo-docs --transport http https://dev.appliflo.com/docs-mcp
```

The AppliFlo Docs MCP is separate from the AppliFlo MCP server at `appliflo.com/api/mcp`. Only the AppliFlo MCP server acts on your workspace.
