r/mcp • • 13d ago

Open-source MCP server that puts a policy engine between your agent and its payment rails

Most payment MCPs hand the agent a raw API key. PurseString puts a policy check in front of every spend instead:

  • One policy file: policies.yaml sets budgets, per-merchant limits, vendor allow and block lists, and approval thresholds. The budget check and the decision write happen atomically under one lock.
  • Human approval: approvals bind the merchant and the amount, expire after a set time, and are single use. Alerts go to Slack or Discord.
  • Correct money math: integer minor units (no float rounding) and idempotent retries.
  • Tamper-evident audit log: hash-chained, with a verify-log command. Set PURSESTRING_AUDIT_KEY and the chain becomes HMAC.
  • Runaway protection: a kill switch and loop detection.
  • Rails: single-use Lithic virtual cards, PayPal, and x402 pay-per-request. Stripe Connect, RazorpayX, Modern Treasury and Airwallex payouts are new and only stub-tested so far.
  • Self-hosted, no telemetry, card numbers never written to disk. Apache-2.0, rated A on Glama.

I’d love to hear what rules you’d want in place before letting an agent spend for you.

Run it directly via npx: npx -y pursestring

GitHub: https://github.com/suseendar1414/pursestring
npm: https://www.npmjs.com/package/pursestring
Glama: https://glama.ai/mcp/servers/suseendar1414/pursestring

3 Upvotes

7 comments sorted by

2

u/QuanTradin 13d ago

budget per day isn't enough on its own, I'd want a velocity limit too, like no more than N spends in ten minutes, because a looping agent burns a daily budget before anyone reads the Slack alert. and refunds or cancels should go through without approval, the agent backing out of a mistake shouldn't wait on a human.

I built Quantradin, practice trading for agents with fake money, and drew the line in the same place: backing out is free, opening a new position needs a key the person issues. quantradin.com

does your loop detection look at repeated merchants or repeated amounts?

1

u/AcceptableAttitude19 13d ago

Both. Loop detection halts an agent after 5 near-identical spends (same vendor, amount within 10%) in 10 minutes. You were right about velocity, so I just added a cap on GitHub: 20 spends per agent per 10 minutes across any merchant, can change both on policies.yaml. Small refunds already skip approval, and big ones still need a human because of prompt injection. If you have more ideas like this, issues and PRs are very welcome. u/QuanTradin looks neat!

1

u/QuanTradin 13d ago

matching amounts within 10% catches the loop that retries with a slightly different number, which exact matching would miss. and capping per agent across every merchant closes the gap I was worried about.

1

u/a-identity 12d ago

One thing I’d make explicit in the audit trail is the boundary between identity evidence and the spend-policy decision. Recording the evidence source and observation time (or block), plus the policy version/hash used for each approval, makes it possible to explain later why that spend was allowed—even if the counterparty’s reputation or the policy changes afterward. I work on agent identity and payment controls, so this is close to my work. How do you handle evidence changing between the check and execution?

1

u/AcceptableAttitude19 11d ago

On evidence changing between the check and the money moving: the budget check and the decision are written atomically under one lock. Approvals expire after a TTL and can only be used once. Cards are single-use with a short TTL, so a stale approval can’t be replayed later. What’s missing is re-checking counterparty evidence at execution time. How do you handle that in your work: re-verify at execution, or pin the evidence with a timestamp or block?

1

u/a-identity 10d ago

I’d use a hybrid. Pin the evidence snapshot with its source and observation time (or block), then re-check volatile fields at execution. If the evidence changed or crossed its freshness window, invalidate the old approval and request a new decision instead of silently using stale approval. The snapshot supports audit; the execution check addresses the time-of-check/time-of-use gap.

1

u/Dangerous_Can621 12d ago

strict per-transaction caps, vendor allowlists, and loop detention are non negotiable before handing an agent payment access, so baking atomic budget locks right into the policy layer makes a ton of sense.