Safe4 — the payment firewall for AI agents, as an MCP server

MCP serverProductivity

safe4 checks whether a purchase your AI made actually matches the task it was given. Once added, your AI can test a purchase against its original task and see if the two line up. Each check is paid per call in USDC via x402.

Use Safe4 — the payment firewall for AI agents, as an MCP server in Claude, ChatGPT or Ahel Desktop

Free. Sign in, add Safe4 — the payment firewall for AI agents, as an MCP server and connect your AI. About a minute.

Also: Claude Code · Cursor · Codex

Then ask your AI: use the safe4 price tool from Safe4

Details

Available today. Use it from your connected AI after setup.

Add safe4, then run a check on a purchase your AI has made to see whether it matches the task it was given. Each check is billed per call in USDC via x402.

Safe4 — the payment firewall for AI agents, as an MCP serverStart free

What your AI can do with it

  • Test an agent's purchase against the task it was given
  • See whether a purchase lines up with the original assignment
  • Pay for each check in USDC
  • Settle payment per call through x402

Install Safe4 — the payment firewall for AI agents, as an MCP server

The server’s own address, for the clients that take one directly. Or connect Ahel once and every client you use reads it from one address, with the account kept on Ahel rather than in each client’s config.

  • Claude Code

    claude mcp add --transport http --scope user safe4-the-payment-firewall-for-a 'https://api.safe4.ai/mcp/'

    Run it once in your project, then open /mcp to approve any sign-in the server asks for.

  • Claude Desktop

    https://api.safe4.ai/mcp/

    Add a custom connector in Settings, paste this address, and approve the sign-in.

  • Cursor

    cursor://anysphere.cursor-deeplink/mcp/install?name=safe4-the-payment-firewall-for-a&config=eyJ1cmwiOiJodHRwczovL2FwaS5zYWZlNC5haS9tY3AvIn0=

    Open the link and Cursor adds the server at that address.

  • ChatGPT

    https://api.safe4.ai/mcp/

    In Settings, enable Developer mode, create an MCP app, and paste this address. Your plan and workspace must allow custom apps.

  • Codex

    codex mcp add safe4-the-payment-firewall-for-a --url 'https://api.safe4.ai/mcp/'

    Run it once, then sign in with codex mcp login safe4-the-payment-firewall-for-a if the server asks for an account.

From the project's README

As published by safe4ai/safe4-mcp in README.md.

Safe4 decides whether an AI agent's proposed payment should be allowed, by testing the purchase against the task the agent was actually given.

The case it exists for is the one budget limits miss: a payment that is inside every budget, in an allowed category, and to an approved counterparty — and is still the wrong purchase, because it does not serve the task.

This repository is the public manifest and client example for the hosted MCP server. The service itself runs at api.safe4.ai; there is no server to install.

Connect

Streamable HTTP, no installation:

{
  "mcpServers": {
    "safe4": {
      "type": "http",
      "url": "https://api.safe4.ai/mcp/"
    }
  }
}

Connecting and listing tools are free. Only safe4_authorize is paid.

Tools

safe4_price — free

Returns the current price and the payment networks the endpoint accepts, so an agent can see the cost before committing to a paid call.

safe4_authorize — paid, settled per call in USDC over x402

Returns an ALLOW or DENY decision for a proposed payment, with a reason code, the concepts it matched, and a hash-chained audit entry.

Called without a payment it returns the x402 challenge instead of a decision. An x402-aware client pays and calls again with the resulting payload in the payment argument.

Arguments:

ArgumentMeaning
taskThe task the agent was given, as stated by its principal
purchaseWhat is being bought
purchase_purposeWhy this purchase serves the task
amount, currencyThe proposed payment
counterpartyWho would receive it
service_categoryCategory of the thing being bought
allowed_service_categoriesCategories the principal permits
allowed_counterpartiesOptional. Payees the principal permits
task_idOptional. Echoed into the audit entry
paymentAn x402 payment payload. Omit to receive the price list

The task and the two allow-lists are the principal's constraints, not the agent's — they are what the purchase is tested against, so an agent that writes its own task is grading its own homework. Safe4 records every field it was given and marks the task context as request-supplied, so a substituted constraint is visible in the audit entry afterwards.

Try it without paying

The example runs the entire free surface — connect, list tools, read the price, fetch the challenge — and stops before signing anything. It needs only httpx: no key, no funded wallet.

python examples/mcp_buyer_demo.py https://api.safe4.ai --dry-run

Drop --dry-run and set SAFE4_BUYER_PRIVATE_KEY to buy a real decision. That signs an EIP-3009 authorisation for exactly the amount and payee the server advertised, and nothing else; the script holds no custody and Safe4 never sees the key.

What a decision rests on

Four checks, in order, and a purchase must clear all of them:

  1. Budget and caps — per-transaction, daily, and agent-scoped limits.
  2. Service category — the purchase's category must be one the principal permitted.
  3. Counterparty — when the task declares allowed_counterparties, payment to anyone else is refused. This is the only check that sees a swapped payee; task text and category are identical in that attack.
  4. Task-to-purchase match — the task must account for what the purchase says it is buying, not merely share a word or two with it.

Every decision is appended to a hash-chained audit log. Each entry carries the previous entry's hash, so the record is tamper-evident and continuous across restarts and redeploys.

Payment

Priced per call in USDC over x402. The endpoint advertises its terms in the 402 challenge; buyers pay on whichever advertised network suits them. Safe4 holds no wallet key and takes no custody of buyer funds.

Links

Security

Reporting instructions are in SECURITY.md. Please do not open a public issue containing exploit details.

License

The manifest and client examples in this repository are MIT licensed. The hosted service they describe is a separate commercial product.

Tools it offers (2)

What this server listed when Ahel dialed its public endpoint in Oct 2026, with no key and no account of yours. The names are the server’s own.

  • safe4_price
  • safe4_authorize

Signals

Last commit
Aug 2026
Advanced
Delivery
safe4 MCP server → your Ahel connector (mcp.ahel.ai) → your AI.
Item type
mcp-server
Key
ai-safe4-safe4
Source
github.com/safe4ai/safe4-mcp
Hosted endpoint
https://api.safe4.ai/mcp/