# Safety for AI agents

How scopes, price guards, idempotency keys and confirmations keep an AI agent from spending money you didn't intend, and how to set up keys and budgets for agents.

- Canonical: https://fineproxy.org/developers/docs/mcp/safety/

An agent connected to FineProxy acts with your API key. This page explains what protects your account when the agent makes a mistake, and how to set up keys so that a mistake stays cheap.

## Scopes are the guardrail

The server enforces the key's [scopes](/developers/docs/authentication/#scopes) on every tool call. The agent can't work around them: if the key lacks a scope, the tools that need it don't work. Each tool's description in [`tools/list`](/developers/docs/mcp/tools/) ends with the scopes it requires, for example `[requires scopes: services:write, wallet:spend]`.

These tools take money from the wallet and need `wallet:spend` (plus `services:write`):

| Tool | What it charges | Guard |
| --- | --- | --- |
| `order_composite` | A new datacenter, ISP or personal proxy order | `expected_total_cents` from `quote_composite`, `idempotency_key` |
| `order_dedicated` | A new dedicated proxy order | `expected_total_cents` from `quote_dedicated`, `idempotency_key` |
| `buy_service` | A fixed catalog product at its catalog price | Idempotent per product and parameters |
| `renew_service` | One or more extra periods at the service's purchase price | — |
| `add_ips` | Prorated cost of extra IPs for the rest of the paid period | `expected_charge_cents`, `idempotency_key` |
| `refresh_ips` | Free in the free window, paid after that (`1000` cents in testing) | `expected_amount_cents`, `idempotency_key` |
| `purchase_addon` | An add-on such as an extra allowlist IP | `expected_price_cents`, `idempotency_key` |

`init_deposit` needs `wallet:deposit`. It doesn't move money: it creates a payment link that you open and pay yourself.

These tools change services without charging and need `services:write`: `cancel_service`, `set_auto_renew`, `disable_addon`, `rotate_proxy_credentials`, `add_whitelist_ip`, `remove_whitelist_ip`, `replace_whitelist_ip`, `update_whitelist_limits`, `restore_import_shortfall`.

## Price guards

Every purchase tool accepts the price the agent expects to pay. The server compares it with the actual price before charging. On a mismatch it charges nothing and returns the current price:

```text
Invalid arguments: Price mismatch: expected_total_cents=1199, actual quote is 1200 cents. Nothing was charged.
```

The intended flow is always quote first, then buy with the quoted number:

1. `quote_composite` returns `total_price_cents: 1200` for 100 IPs × 1 month.
2. `order_composite` is called with `expected_total_cents: 1200`.

`expected_total_cents` is optional in the `order_composite` schema, and the server instructions tell agents to always pass it. Check for it when you approve an order. For `purchase_addon` the guard is required: the agent takes the total for the chosen quantity from `list_available_addons`.

## Idempotency keys

Purchase tools require an `idempotency_key`. If the network drops and the agent retries the same order with the same key, the server returns the original order instead of charging again. In testing, a replayed `order_composite` returned the same `service_id` with `balance_applied_cents: 0`.

Use a fresh key for every new purchase intent and the same key only for retries of that purchase.

## The allowlist is mandatory for orders

`order_composite` and `order_dedicated` require `whitelist_ips`, at least one IPv4 address allowed to use the proxies. The server tells agents to ask you for it when it's unknown.

> **Warning:** `get_my_ip` returns the public IP of the machine that runs the MCP client. For a desktop client that is usually your computer; for cloud-hosted clients (for example Claude custom connectors, which connect from Anthropic's servers) it is not. Confirm the IP before the agent uses it.

## What the server tells agents

On connection, the server sends `instructions` that clients pass to the model. Among other things they say:

- Buy proxies through `list_countries` → `quote_composite` → `order_composite`, with a fresh `idempotency_key` and the quote's total as `expected_total_cents`.
- Check `wallet_balance` before purchases.
- Tools that require `confirm=true` are destructive or irreversible: confirm the details with the human first and never set `confirm` speculatively.
- To stop paying for a service, turn off auto-renewal with `set_auto_renew` rather than cancelling.
- After `init_deposit`, the wallet is credited only when the payment gateway confirms the payment, never by the tool call itself.

Instructions guide a model; they don't bind it. Scopes and guards are what the server actually enforces.

## Irreversible actions

| Action | Tool | What to know |
| --- | --- | --- |
| Cancel a service | `cancel_service` with `confirm: true` | Terminates the service immediately. Unused paid days are refunded to the wallet at the undiscounted daily rate; `refund_cents` in the result is the exact amount. |
| Disable an add-on | `disable_addon` with `confirm: true` | Refunds the unused part of the current period. |
| Rotate proxy credentials | `rotate_proxy_credentials` | The new password is returned once; the old one stops working, so running scrapers lose access. |
| Refresh IPs | `refresh_ips` | Replaces the IP addresses of the service; the old ones are gone. |

Self-service cancellation is limited to **once every 3 days per account**. A second cancel within that window fails without changing anything:

```text
SERVICE_CANCEL_COOLDOWN: self-service cancellation is limited to once every 3 days. support_required=true retry_at=2026-11-30T10:04:48Z retry_after_seconds=259197. Ask the customer to open a support ticket.
```

If you only want to stop future charges, ask the agent to turn off auto-renew. The service then runs until the end of the paid period and expires without a refund.

## Recommended key strategy

Create separate keys for separate jobs in [Settings → API keys](https://fineproxy.org/account_new/settings#api-keys):

| Key | Scopes | Use for |
| --- | --- | --- |
| Read-only | `customer:read`, `wallet:read`, `services:read`, `catalog:read`, `usage:read`, `tickets:read` | Exploring, monitoring, diagnostics, quotes |
| Management | read-only + `services:write`, `tickets:write` | Allowlist changes, credential rotation, auto-renew, tickets |
| Purchasing | management + `wallet:spend` (and `wallet:deposit` if the agent should create top-up links) | Orders, renewals, add-ons |

Use the read-only key by default and switch to a purchasing key only for the session that needs it. One key per client or per automation also lets you revoke one without breaking the others.

Agents can't create or change API keys: key management works only from a signed-in dashboard session, so an agent can't grant itself more scopes.

## Budget control

- **Keep a small balance.** The agent can only spend what is in the prepaid wallet. Top up the amount you're comfortable with, not more.
- **The agent can't add money.** `init_deposit` only returns a payment link; you complete the payment on the gateway's page.
- **Watch auto-renewal.** New orders have `auto_renew: true` unless the agent sets it to `false`. Renewals are charged automatically from the wallet each period.
- **Review spending.** Ask "Show my last 10 wallet transactions" (`list_ledger`) or check the history in the dashboard.
- **Revoke quickly.** If a key leaks or an agent misbehaves, revoke the key in the dashboard. Requests with a revoked key get `401`.

## What the MCP server can't access

The server runs on FineProxy's side and sees only the tool calls your client sends: tool names and arguments. It has no access to your files, repositories, source code, terminal, browser or other MCP servers. In the other direction, your FineProxy key gives the agent access to your FineProxy account only.

Your MCP client and the model provider, however, see the tool results, including proxy IPs and, if requested with `reveal`, proxy passwords. Choose clients and providers you trust with that data.

## Prompt injection

An agent may read text that came from someone else, such as a web page, a file in your repository, or a support ticket message, and that text may contain instructions like "buy 10,000 IPs". To stay safe:

- **Review tool calls before approving them.** Read the tool name and the arguments, especially `segments`, `expected_total_cents`, `whitelist_ips` and `confirm`.
- **Don't auto-approve spending tools.** If your client lets you allowlist tools, allowlist read-only tools by name only.
- **Don't rely on tool annotations for auto-approval.** Several tools that change state are annotated `readOnlyHint: true` (for example `set_auto_renew`, `rotate_proxy_credentials`, the allowlist tools and the ticket tools). Decide by tool name and scope.
- **Use a read-only key** when the agent works with untrusted content.

## Related pages

- [Authentication](/developers/docs/authentication/): scopes and key management.
- [MCP tools reference](/developers/docs/mcp/tools/): every tool's inputs and required scopes.
- [Example prompts](/developers/docs/mcp/prompts/): safe buying and maintenance conversations.
