Skip to main content
Glama
Fine Print MCP Server

Fine Print MCP Server

by frostyhand
README.md
# Fine Print

**A pre-payment check for AI shopping agents.** Call it right before your agent pays. It reads the merchant's checkout and stops the payment, or asks the human, when the cart holds something the shopper never agreed to: a subscription, a free trial that turns paid, an add-on, a fee that only appeared at checkout, a total that changed, or text that gives orders to the AI.

Every check is plain code. There is no model in the loop and no network call, so nothing a merchant writes on the page can talk its way past it. Each finding links to the US consumer law it relates to.

```
Do not pay yet. You will be charged $15.30 by beans.example today.
• 1 × Single-origin coffee beans, 2 lb: $15.30
After today, "Single-origin coffee beans, 2 lb" keeps charging $15.30 every month until you cancel.

2 problems:
• "Single-origin coffee beans, 2 lb" is set up as a recurring purchase: $15.30 every month starting 2026-12-22. You asked for a one-time purchase.
• "Single-origin coffee beans, 2 lb" can be bought once, but the checkout selected a subscription. Switch the line to the one-time option "one-time".
```

It speaks both agent checkout protocols: the **Agentic Commerce Protocol** (ACP, OpenAI and Stripe, spec 2026-04-17) and the **Universal Commerce Protocol** (UCP, including the purchase options extension).

## Why

Personal agents are starting to pay for things. The checkout is where money leaves the account, and it is the one screen the shopper no longer reads. Research has already shown that web agents fall for dark patterns, and that bigger models can be more susceptible, not less. Benchmarks measure the problem. Fine Print is the guard you put in the payment path.

## What it catches

| | Check | Decision |
|---|---|---|
| FP101 | Total over the shopper's ceiling | block |
| FP102 | Total changed after the shopper approved it | confirm |
| FP103 | Merchant has not marked the price final | confirm |
| FP104 | Charged in a different currency | block |
| FP105 | The parts do not add up to the total | block |
| FP201 | A subscription the shopper did not ask for | block |
| FP202 | A renewal hidden in the disclosure text | block |
| FP203 | The merchant defaulted the line to "Subscribe & save" | block, with the fix |
| FP204 | A free trial that converts to a paid plan | confirm |
| FP205 | A renewal with no cancellation terms | confirm |
| FP301 | An item the shopper did not ask for (protection plans, memberships) | block, with the fix |
| FP302 | A higher quantity than asked | block |
| FP303 | A tip or gift wrap added | confirm |
| FP401 | Price went up at checkout (drip pricing) | confirm, block for tickets and lodging |
| FP402 | A fee with a vague name | note |
| FP501 | A merchant that is not on the allowlist | block |
| FP502 | The shipping ZIP changed | block |
| FP503 | The shopper's approval has expired | block |
| FP504 | The checkout session has expired | block |
| FP505 | Checkout text that gives instructions to the AI | confirm |
| FP506 | Invisible characters or raw markup in the terms | confirm |

Full reasons and law references: [RULES.md](RULES.md).

## Does it matter? Checkout Traps

I ran 10 current models as shopping agents against a simulated ACP and UCP merchant. There were 11 trap carts and 2 clean controls, each run 5 times, without Fine Print, with Fine Print as a tool, and with Fine Print as a guard in the payment path. That came to 1,950 episodes. Harm is scored from what the merchant actually charged, not from Fine Print's own rules.

| | Without Fine Print | Fine Print as a tool | Fine Print as a guard |
|---|---|---|---|
| Paid for a trap | 37 of 550 (6.7%) | 0 of 550 | 0 of 550 |
| Clean carts still bought | 100 of 100 | 100 of 100 | 100 of 100 |

Six of the 10 models paid a total that was **$5.00 more than the listed parts, every time**: Claude Sonnet 5.5, Claude Haiku 5.5, GPT-6 Luna, DeepSeek V4.1 Flash, Qwen4 Max and Kimi K3.1 Pro. Two paid for a tip that the merchant had added in advance. The models are good at spotting an extra line. They are bad at checking the arithmetic. Fine Print does the arithmetic.

Full tables, the cost of the tool mode, and the limits are in [bench/RESULTS.md](bench/RESULTS.md). The protocol, written before the run, is in [bench/PROTOCOL.md](bench/PROTOCOL.md).

## Use it

### As a library

```ts
import { check, fromACP, verifyUnchanged } from "fine-print";

const mandate = {
  maxTotal: 12000,               // cents, all-in
  currency: "USD",
  items: [{ match: "grinder", maxQuantity: 1 }],
  shipToPostalCode: "94110",
  advertisedPrice: 8900,         // what the listing showed
  buyerState: "CA",
};

const session = await merchant.getCheckoutSession(id);   // ACP CheckoutSession JSON
const verdict = check(mandate, fromACP(session, { merchant: "shop.example" }));

if (verdict.decision === "block") return tellTheShopper(verdict.summary);
if (verdict.decision === "confirm" && !(await askTheShopper(verdict.summary))) return;

// Right before paying, make sure nothing changed since the check.
const latest = await merchant.getCheckoutSession(id);
if (!verifyUnchanged(verdict, fromACP(latest, { merchant: "shop.example" }))) return recheck();
await merchant.complete(id, payment);
```

Or let `guardPayment` do all four steps:

```ts
import { guardPayment, fromUCP } from "fine-print";

await guardPayment({
  mandate,
  load: async () => fromUCP(await ucp.getCheckout(id), { merchant: "beans.example" }),
  confirm: async (verdict) => askTheShopper(verdict.summary),
  pay: async () => ucp.complete(id, payment),
});
```

### As an MCP server

Any MCP client (Claude, ChatGPT developer mode, Cursor, your own agent) can call it as a tool before paying.

```json
{
  "mcpServers": {
    "fine-print": { "command": "npx", "args": ["-y", "fine-print-mcp"] }
  }
}
```

Tools: `check_checkout` (pass the checkout exactly as the merchant returned it, plus what the shopper approved) and `list_rules`.

## Three things I found in the specs while building this

1. **ACP has no structured field for recurring charges.** A line item can carry `disclosures`, but there is no way to say "this renews at $14.99 a month" in a field an agent can read. A subscription can only be disclosed as prose. That is why FP202 exists, and it is the strongest case for a structured field.
2. **ACP uses `subtotal` two ways in the same example.** In `examples/discount-extension/stacked-discounts.json`, the checkout's `subtotal` already has `items_discount` taken off (209,800 − 42,460 = 167,340), but each line item's `subtotal` is before the discount (199,900, then −40,280, total 159,620). An agent that checks the arithmetic has to accept both readings. FP105 does.
3. **In UCP the merchant picks the default purchase option.** If the agent does not choose, the business selects the default, and the first option listed is the default. A merchant can list "Subscribe & save" first. FP203 catches it and returns the one-time option id to switch to.

## Trap carts

`test/fixtures` holds 15 checkouts a merchant could really send, each with the verdict Fine Print must return. All 10 ACP fixtures validate against the published ACP 2026-04-17 schema, so these are spec-valid traps, not malformed input. Controls (a clean order, a "subscribe to our newsletter" banner) must come back clean.

```bash
npm test
```

## Design choices

- **Deterministic.** Regular expressions and arithmetic only. A prompt injection cannot argue with a regex.
- **Fail closed on the money.** Anything over budget, recurring without permission, or unexplained blocks. Anything that needs a human judgment asks.
- **Plain-language output.** `summary` is written for the shopper, so the agent can show it verbatim.
- **Replay protection.** `digest` is a SHA-256 over the normalized checkout. If the merchant changes anything between the check and the payment, `verifyUnchanged` fails.
- **No data leaves the process.** No telemetry, no network.

## Not legal advice

The law references tell a person which US rule a practice relates to. A finding does not mean a merchant broke the law, and a clean result does not mean a checkout is compliant.

## Roadmap

- Python package with the same rules and fixtures
- A page-text adapter for browser agents that shop without a protocol
- More state auto-renewal and pricing laws, each checked against the statute before it is added
- Run browser shopping agents (not just tool-calling models) against private trap stores
- A softer FP505 when the money and the cart already match the request, since a "confirm" on leftover text makes some agents give up on a cart that is fine

## License

Apache-2.0. The vendored ACP schema in `test/schemas` is Apache-2.0 from the Agentic Commerce Protocol project; see [NOTICE](NOTICE).