Metadata-Version: 2.5
Name: roost-mcp
Version: 0.3.0
Summary: Roost MCP servers for AI agents that handle money: a payment check before money moves (roost-corpus-mcp) and a finance-agent safety test (roost-eval-mcp). Advisory, zero-config, no API key.
Project-URL: Homepage, https://roostcapital.ai
Project-URL: Documentation, https://roostcapital.ai/docs
Author-email: Roost <developers@roostcapital.ai>
License: Apache-2.0
Keywords: ai-agents,evals,finance,mcp,model-context-protocol,payments,roost
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.11
Requires-Dist: cryptography>=42
Requires-Dist: httpx>=0.27
Requires-Dist: mcp<2,>=1.2.0
Requires-Dist: pydantic>=2
Provides-Extra: credit
Requires-Dist: roost-sdk>=0.2.0; extra == 'credit'
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=7.4; extra == 'dev'
Provides-Extra: keychain
Requires-Dist: keyring>=24; extra == 'keychain'
Description-Content-Type: text/markdown

# roost-mcp

MCP servers from [Roost](https://roostcapital.ai) for AI agents that handle money. Two are free and need no API key or signup: a payment check to call before money moves, and a safety test for finance agents. The package also has `roost-verify`, which checks a signed decision record, and the server for Roost accounts.

```
pip install roost-mcp
```

## Add the free servers to your MCP client

Both run over stdio. Point your client at either one, or both. A Claude Desktop style config:

```json
{
  "mcpServers": {
    "roost-corpus": { "command": "roost-corpus-mcp" },
    "roost-eval": { "command": "roost-eval-mcp" }
  }
}
```

If your client doesn't inherit your shell `PATH`, use the absolute path to the console script (what `which roost-corpus-mcp` prints).

An anonymous token is created on first use. Roost stores each call without its raw details: names and references as salted hashes, amounts rounded to two significant figures, free text dropped. The stored calls are aggregated into a benchmark of how money-moving agents behave. That is why they are free.

Prefer no install? Add `https://mcp.roostcapital.ai/mcp` as a connector in Claude. It runs the same check and returns Roost's signed record of each decision.

## `roost-corpus-mcp`: a payment check before money moves

`roost_preflight_finance_action` takes one invoice, purchase order or transfer and answers `PROCEED` or `HOLD`, with the reasons. It holds:

- a likely duplicate: the same vendor and amount under a different invoice number within 60 days
- a bill above its agreed amount, when you send `agreed_amount_cents`
- a split bill: two bills in a week that each sit just under a common approval limit
- an amount far above that vendor's usual

The check compares a payment with earlier checks from the same install. It is advisory: Roost never moves, blocks or approves money, and your agent decides. USD invoices, purchase orders and transfers today.

`check_payment` is the tool's earlier name and still works.

## `roost-eval-mcp`: a safety test for finance agents

Find the money decisions your agent gets dangerously wrong before it ships. `list_eval_scenarios` returns realistic money situations (fraud bait, payee changes, overspend, duplicates, social engineering). Your agent decides proceed, hold or flag on each. `submit_eval` returns a private scorecard that leads with a `status` (`BALANCED`, `UNSAFE`, `OVER_CONSERVATIVE`, `MIXED` or `NO_DATA`), then the component metrics and every failing case with a fix.

The result is self-reported and private to you. Don't put personal, payment or confidential information in free-text fields.

## Check a signed record

```
roost-verify RECORD.json [--keys URL_OR_FILE]
```

Checks a Roost decision record's signature against Roost's published keys. No account or key needed.

- `verified: key <key_id>, seq <n>` and exit code 0
- `not verified: <reason>` and exit code 1

## Configuration for the free servers

- `ROOST_CORPUS_API_BASE`: API base (default `https://roost-corpus.fly.dev`, the live public endpoint).
- `ROOST_CORPUS_TOKEN` / `ROOST_CORPUS_TOKEN_FILE`: anonymous token override, or the file it is kept in (default `~/.roost/anon_token`).
- `ROOST_CORPUS_SOURCE`: optional install-attribution tag.

## With a Roost account

The `roost-mcp` command runs the account server: the same check against your own payment history, and a place to record a person's decision on each one. It needs the `roost-sdk` package, which is not published yet (the `roost-sdk` name on PyPI is an empty placeholder); ask Roost for it with your account.

| Tool | What it does |
| --- | --- |
| `roost_decide` | Get an advisory pay / wait / finance verdict for a prospective payment. Call BEFORE proposing or scheduling one. |
| `roost_review_pending` | List advisory decisions awaiting human review. |
| `roost_explain_decision` | Fetch the full evidence pack behind one advisory decision. |
| `roost_resolve` | Record a human's judgment (approved / rejected / modified, with an optional reason code and note) on a decision. The acting identity is fixed to the server's configured operator — never an argument the calling agent supplies. |
| `roost_about` | Identify this server + surface docs / OpenAPI / llms.txt URLs (includes the list of shadow tools). |

### Configure

The server reads `ROOST_SDK_*` env vars at startup. One instance acts on behalf of one `(operator, agent)` pair — install once per agent if the operator has multiple.

Required:

- `ROOST_SDK_OPERATOR_API_KEY` — the operator's API credential, sent as a bearer token. For shadow-era use (`roost_decide` and the oversight tools) this is a **Personal Access Token** (`roost_pat_...`), issued by Roost with your account — the raw token is shown once; only its hash is stored server-side, so save it immediately. A PAT authenticates the shadow surface only (`/v1/decisions*`, `/v1/scoreboard`) — it is rejected on credit-era, admin, account, and auth endpoints.
- `ROOST_SDK_AGENT_ID` — agent UUID the server will act for.

Optional:

- `ROOST_SDK_API_BASE` — defaults to `https://api.roostcapital.ai`.
- `ROOST_SDK_OPERATOR_ID` — operator UUID. Used only by the credit tools described at the end.
- `ROOST_SDK_PRIVATE_KEY_PEM` — Ed25519 private key, PEM format. Used only by the credit tools described at the end; the matching public key must be registered for this `(operator, agent)` pair.
- `ROOST_SDK_ACTOR_LABEL` — human-readable label identifying this server instance as an actor. Used to build the pinned actor string (`mcp:<label>`) recorded on every `roost_resolve` call. Defaults to `mcp-operator`.

#### Claude Desktop / Claude Code

Install `roost-mcp` and `roost-sdk` into one environment, then point your client at that environment's `roost-mcp` script (what `which roost-mcp` prints there). In `claude_desktop_config.json` (Desktop) or your `.mcp.json` (Claude Code):

```json
{
  "mcpServers": {
    "roost": {
      "command": "/path/to/env/bin/roost-mcp",
      "env": {
        "ROOST_SDK_OPERATOR_API_KEY": "roost_pat_...",
        "ROOST_SDK_AGENT_ID": "8c64...",
        "ROOST_SDK_ACTOR_LABEL": "claude-desktop"
      }
    }
  }
}
```

Add `ROOST_SDK_OPERATOR_ID` and `ROOST_SDK_PRIVATE_KEY_PEM` only for the credit tools described at the end.

#### Cursor / Cline / Zed

Each editor has its own MCP config UI, but the shape is identical — a command (the `roost-mcp` script above) plus the `ROOST_SDK_*` env vars.

### Oversight from Claude

A typical human-in-the-loop session: an agent has already been calling `roost_decide` before its payments, and a human wants to check what's outstanding.

```
Human:  What payment decisions are waiting on me?
Claude: [calls roost_review_pending] -> 3 decisions, including a $1,250
        payment to "New Vendor Co" with verdict "wait" (low confidence
        on vendor reputation).
Human:  Show me why it said wait.
Claude: [calls roost_explain_decision(decision_id)] -> evidence pack +
        summary: "Verdict: wait. Vendor reputation unknown. Resolution:
        unresolved."
Human:  Approve it, I've vetted this vendor separately.
Claude: [calls roost_resolve(decision_id, "approved")] -> recorded.
        The acting identity is this server's configured operator, not
        anything Claude supplied — an agent can record a human's
        judgment, but it can never claim to *be* a different human.
```

### Verify the setup

The fastest sanity check is to call `roost_about` from your MCP client — it returns the configured `(operator, agent)` pair, the doc URLs, and the list of shadow tools. If the env vars aren't wired, the first tool call surfaces the actual config error.

### Evidence you can open, Roost can't read

Commit each document your agent relied on with `roost_commit_evidence` before
`roost_decide`, and pass the entries as `evidence`. Roost stores only a keyed hash
and a locator sealed with your evidence key, inside the decision's signed record.
Roost can tell when two decisions cite the same document (the keyed hash is the same),
and it sees each entry's kind and time. `roost_verify_chain` detects altered, deleted or
reordered records; it cannot detect a chain cut short at the end.
Later, `roost_open_record` decrypts the locators on your machine so a person can
open the exact invoice, PO or email, and `roost_verify_evidence` confirms each one
matches. `roost_verify_chain` checks your whole record chain against Roost's
published keys.

Set up the evidence key once (32 random bytes, base64):

    python -c "import os, base64; print(base64.b64encode(os.urandom(32)).decode())"

Then either export it as `ROOST_EVIDENCE_KEY`, or install `roost-mcp[keychain]` and
store it in the OS keychain: `keyring set roost-evidence <your ROOST_SDK_ACTOR_LABEL>`.
Back it up: without it, locators can't be opened (commitments still verify against
a document you find another way).

### The agent program (opening soon)

The agent program opens soon. This is how it works once it does. An agent with a Base wallet can apply on its own; no PAT needed.

1. `program_apply` with what the agent buys, how it pays and its paying addresses. Roost-mcp creates the agent's
   key on this machine (OS keychain, or `~/.roost/agent_key.pem` at 0600) and sends only the public key.
2. Prove each address one of three ways: sign its `siwe_message` and call `program_prove(method="signature")`;
   pay its `x402_url` once ($0.01) with your x402 wallet; or send the quoted amount and call
   `program_prove(method="transfer")`.
3. Give `claim_url` to your operator. They sign in, accept the terms and claim the agent.
4. `program_status` shows the result. Once claimed, `roost_decide`, `roost_resolve` and `roost_record_outcome`
   sign with the agent's own key. A configured `ROOST_SDK_OPERATOR_API_KEY` always takes precedence.

### Program windows, failures and statements (opening soon)

Once the operator has accepted the current terms (the claim, or `POST /v1/program/operator/enrollments/<id>/accept`
with a payout address), 30-day windows run on their own. `roost_decide` returns a `program` note: the offer to relay
while the operator hasn't accepted, or the live window once they have.

- `program_supplement` adds optional extras (policy limits as numbers, tool names, a one-line reason) or a failure
  report to one of your decisions. Before acceptance it is refused unread and the attempt is counted.
- Roost confirms failures on-chain by itself ($5) or from a report with outcome evidence ($25), at most $100 per
  operator per window, and pays after a signed statement and a 14-day dispute period.
- `program_statement` fetches the signed statements and verifies each against Roost's published keys under the
  statement domain (`roost-program-statement-v1`).

### Credit tools

Roost does not offer lending today. The account server still carries the tools from the earlier credit product (`roost_pay`, `credit_apply`, `credit_status`, `offer_get_active`, `offer_accept`, `offer_decline`) and the `lending_*` tools, whose feature is switched off.

## Local development

```bash
# From the repo root:
pip install -e sdk/python      # roost-sdk in editable mode
pip install -e mcp-server[dev] # roost-mcp + test deps
pytest mcp-server/tests
```

## Links

- [API & SDK reference](https://roostcapital.ai/docs)
- [Markdown / agent-readable docs](https://roostcapital.ai/docs.md)
- [OpenAPI specification](https://api.roostcapital.ai/openapi.json)
- [llms.txt index](https://roostcapital.ai/llms.txt)

Apache-2.0.
