AI agents can now pay for things: API credits, SaaS seats, datasets, cloud resources, invoices. Every bank, card issuer and payment provider gives them a different API, and none of them knows why the agent is spending. That's how you end up with:
- 🔁 A checkout page hangs, the agent retries, and you pay twice.
- 📆 A $15 "trial" fits under the $50 cap and auto-renews forever.
- 🤷 Finance asks "what was this charge?" and nobody can say why the agent bought it.
PurseString is an open-source, self-hosted MCP server that gives AI agents spending guardrails. The agent declares what it wants to pay for, why, and what it tried first. PurseString checks that against your policies.yaml, blocks duplicates, pauses risky spend for a human in Slack or Discord, records the decision, and only then executes it on the right provider.
[!WARNING]
v0.4.0 alpha (changelog). PurseString issues real Lithic cards: use a production Lithic key and set adapter.lithic.environment: production. It's early software, so start with low limits. Tested end to end on the Lithic sandbox: card issue, duplicate-request replay, auto-close after 10 minutes, and real-time charge approval (answered in under 3 ms; try it yourself). Tell us what breaks in issues.
🏆 PayPal AI Hackathon: how PurseString uses PayPal and AI
- PayPal Agent Toolkit / PayPal MCP server (
@paypal/mcp): PurseString runs PayPal's own MCP server behind itself and re-exposes its tools to the agent, with guardrails. Read-only tools pass through. Refunds are auto-run, paused for a human, or refused, depending on the amount. Accepting a dispute or cancelling always needs a human. A retried refund returns PayPal's first answer instead of refunding twice.
- PayPal Payouts API (PayPal and Venmo): the
send_payment tool pays vendors. The recipient comes from a payee directory in policies.yaml, never from the agent, so a prompt injection has no address to swap in. The intent ID is sent as PayPal-Request-Id, so a payout can't happen twice.
- PayPal OAuth (client credentials): PurseString keeps the client secret, and PayPal's MCP server only ever sees short-lived access tokens.
- AI: the agent being governed is any MCP-capable model. We built and tested with Claude (Claude Desktop and Claude Code), and the project speaks the Model Context Protocol through the official TypeScript SDK. Claude Code was also used as a pair programmer for the code, tests and docs.
Setup in the PayPal sandbox takes about 5 minutes: see docs/paypal.md.
🧩 What it does, and what works today
|
|
Status |
| 🔌 Connect |
Banks, payment providers and card issuers behind one MCP interface, through community-built adapters. |
🟡 Virtual cards via Lithic (sandbox and production), Privacy.com cards funded from your own bank account and Airwallex cards for businesses outside the US (both new, untested with a live account), PayPal and Venmo payouts straight to a vendor's account on file, Stripe Connect, RazorpayX, Modern Treasury and Airwallex payouts (new, tested against stubbed API responses only), x402 pay-per-request APIs in USDC (new, testnet by default, not yet run against a live facilitator), guardrails in front of PayPal's own MCP server (refunds, disputes, cancellations), plus a mock rail for testing. Not yet: your existing card directly, and other providers (see roadmap). |
| 🛡️ Govern |
Budgets, vendor allow and block lists, and human approvals, defined once and enforced the same way on every provider. |
✅ Live: policies.yaml, per-agent daily budgets, a velocity limit on spends per agent across all merchants, Slack / Discord approval pause, per-purchase rail routing, a kill switch for one agent or all of them that freezes their cards at the rail and trips itself when an agent keeps re-buying the same thing or keeps getting denied, and card controls that lock a card to the vendor's merchant categories. |
| 💳 Execute |
Authorized payments and other supported financial operations. |
🟡 Single-use and merchant-locked virtual cards today. Bank transfers (ACH / wire) are on the roadmap (#16). |
| 🔒 Protect |
No duplicate operations, safe handling of uncertain payment states, and a record of every decision. |
✅ Live: idempotency keys, safe retries after a hung checkout, real-time checks on every card charge, cards that close after 10 minutes, hash-chained audit log (pursestring verify-log). |
| 🌍 Expand |
Developers add integrations for more providers and countries. |
✅ Live: a small adapter interface and a contributor guide. The first community adapters are up for grabs. |
✅ live today · 🟡 partly live, more on the roadmap
Govern and Protect in detail
|
|
| 🛑 No double charges |
Every intent gets a deterministic key, SHA256(agent_id, task_id, vendor, amount). Retry inside 30 minutes and you get the same card back, not a second transaction. |
| 📆 No surprise subscriptions |
Anything marked is_recurring goes to a human, whatever the amount. Approved subscriptions get a merchant-locked card with a monthly cap, so they can't be reused elsewhere. |
| 🙋 Approve by risk, not by dollar amount |
Small, one-time, allowlisted spend is auto-approved. Recurring, over-threshold or unknown-vendor spend pauses and pings Slack or Discord. Blocklisted vendors and spend over the hard cap are refused outright. |
| ⚡ Every charge checked as it happens |
With just-in-time authorization, the card issuer asks PurseString before each charge goes through. Only a charge that matches the approved intent (right card, right amount, first use, still live) is approved. |
| ⏱️ Cards that close themselves |
Single-use cards close 10 minutes after issue, so a leaked number is worthless. |
| 🧠 Intent before money |
The agent must state the goal and the free alternatives it tried. A vague goal or no alternatives means a human looks first. |
| 📼 A black box recorder for every decision |
Goal, alternatives, the agent's reasoning, every rule and how it ruled, who approved, and what was executed, as append-only JSON lines. Card numbers are never written to disk. |
| 🔀 One policy, routed per provider |
routes in policies.yaml picks the provider per purchase by amount, vendor or recurrence, so the same rules apply wherever the money moves. |
| 📏 Measured, not claimed |
An attack benchmark runs prompt-injected refunds, split payouts, swapped payees, retries, loops and over-budget agents with and without PurseString (mock mode, npm run bench). With the default policy, unwanted spend fell from $6,784.71 to $528.94, and money reaching an attacker fell from $2,198.00 to $192.00. |
| 🏠 Self-hosted, Apache 2.0 |
Runs on your laptop or in your VPC. Your financial credentials never leave your infrastructure. |
🤝 Use it with your rail, not instead of it
PurseString doesn't replace your card issuer or bank. It's the interface and policy layer on top, so the same rules apply whichever provider moves the money.
|
Card issuer controls(Ramp, Stripe Issuing, Lithic) |
PurseString on top |
| Spend caps and merchant locks |
✅ |
✅ (enforced on the card it issues) |
| One policy across several rails |
Each rail has its own |
✅ |
| Agent must declare goal and alternatives |
|
✅ |
| Intent-level duplicate-charge protection |
|
✅ |
| Real-time approval checked against why the card was issued |
|
✅ |
| Recurring charges always routed to a human |
|
✅ |
| Reasoning-level audit trail ("why did it buy this?") |
|
✅ |
| Open source, self-hosted |
|
✅ |
🚀 Quickstart
New here? Try it in 10 minutes with Claude Desktop and test cards: an auto-approved purchase, a blocked double charge, and a subscription that waits for your approval.
1. Add it to your MCP client. Claude Desktop (claude_desktop_config.json), Cursor (.cursor/mcp.json) and most others use the same shape:
{
"mcpServers": {
"pursestring": {
"command": "npx",
"args": ["-y", "pursestring"],
"env": { "SLACK_WEBHOOK_URL": "https://hooks.slack.com/services/..." }
}
}
}
With Claude Code: claude mcp add pursestring -- npx -y pursestring
With ChatGPT (developer mode) or claude.ai custom connectors: run it as a server and sign in with OAuth. See docs/chatgpt.md.
2. Write a policy. Run npx -y pursestring init to get a commented policies.yaml, then edit the vendor allowlist. With no file, safe defaults apply: auto-approve under $20 on allowlisted vendors, a human above $50 or for anything recurring.