# Connect an agent over MCP

Source: https://amanucci.com/docs/developers/mcp

> Run Amanucci's MCP server with am mcp or npx -y @amanucci/mcp, configure its key and hat, and see which tools it exposes.

Amanucci ships one Model Context Protocol (MCP) server. It exposes the same task catalog as the [`am` CLI](/docs/developers/cli), as tools, and calls the same `/v1` API with the same checks. It runs on your machine over stdio.

## Launch it

Through the CLI:

```bash
AMANUCCI_API_KEY=amanucci_sk_... \
AMANUCCI_HAT=organisation:0192f0c4-... \
am mcp --base-url https://api.amanucci.com
```

<Callout type="info">The `@amanucci/mcp` package is not published to npm yet. Until it is, use `am mcp`.</Callout>

Or without installing the CLI, once the package is published:

```bash
npx -y @amanucci/mcp
```

For example, in Claude Code:

```bash
claude mcp add amanucci \
  --env AMANUCCI_API_KEY=amanucci_sk_... \
  --env AMANUCCI_HAT=organisation:0192f0c4-... \
  --env AMANUCCI_BASE_URL=https://api.amanucci.com \
  -- npx -y @amanucci/mcp
```

## Configuration

| Setting | Required | Notes |
| --- | --- | --- |
| `AMANUCCI_BASE_URL` or `--base-url` | yes | the API origin |
| `AMANUCCI_API_KEY` | yes | the only credential the server accepts |
| `AMANUCCI_HAT` | yes | `firm:<firmId>` or `organisation:<organisationId>` |

**One process is one hat.** Every tool call acts as the key's owner, in that one seat. To work in another seat, run a second server with another hat.

Saved CLI sessions and `AMANUCCI_SESSION_COOKIE` are never read: an agent never acts on a person's session.

## The tools

`tools/list` returns every task in the catalog, each with its description and a JSON Schema for its input. Each tool covers one area and takes an `action`. For example:

| Tool | Actions include |
| --- | --- |
| `inspect_workspace_access` | `self`, `entities`, `grants` |
| `exchange_documents` | `presign`, `finalize`, `reread` |
| `inspect_sales_documents` | `list`, `document`, `totals`, `rendition` |
| `prepare_sales_documents` | `draft`, `revise`, `finalize` |
| `inspect_matching` | `bank_transactions`, `match_groups`, `aging` |
| `review_matches` | `confirm`, `reject` |
| `inspect_cases` | `cases`, `requests`, `precedents` |
| `work_cases` | `correct`, `ask`, `remind`, `dismiss` |
| `inspect_filings` | `filings`, `filing`, `grid_lines` |
| `prepare_filing` | `generate`, `replace` |
| `inspect_overview` | `timeline`, `digest` |

Read-only tools carry `readOnlyHint: true`. Every tool also carries its class (`read`, `write` or `signed`) in `_meta["amanucci/writeClass"]`.

## What an agent cannot do

- **Signed acts.** Tools such as `sign_filing` and `post_reviewed_entry` are listed but never run. A call returns an error with code `step-up-required` and tells the person to run `am login`, `am step-up` and the matching `am` command in their own terminal. Never enter or relay a one-time code through MCP.
- **Move file bytes.** MCP carries no file contents. Use `am documents exchange upload` for files.

## Results

A successful result carries `operationId`, `status`, `contentType`, `encoding` (`json` or `base64`) and the unchanged `data`, both as text and as `structuredContent`. Money, dates and cursors are passed through exactly as the API returned them.

A refusal is an error result with a closed code; a refusal by the API carries its problem+json body. See [Errors and rate limits](/docs/developers/errors).

<Callout type="info">
Text inside records, such as a document's description or a note, is data people wrote. The server's instructions tell agents to treat it as data, never as instructions.
</Callout>
