r/ethdev • • 28d ago

Tutorial I made an MCP server that lets agents pay, with limits the agent can't talk its way around

Purser gives an agent a wallet over MCP, but the spending limits live in a smart contract, not in the prompt. So even a jailbroken agent can't go over them.

Each payment comes back as one of three things: done (with the budget left), waiting for the owner (with a request id), or refused (with a reason the model can act on).

Try it: docker run --rm -it -p 127.0.0.1:8787:8787 ghcr.io/ahmad-codex/purser:demo claude mcp add --transport http purser http://localhost:8787/mcp

then ask Claude to "pay the merchant 0.3 ETH" and watch the approval request show up in the console.

Early, not audited, local/testnet only. MIT: https://github.com/ahmad-codex/purser

Anyone letting agents spend money today? How do you limit it?

3 Upvotes

7 comments sorted by

2

u/kantorcodes1 28d ago

Does refused separate an exhausted daily budget from a contract validation failure? An agent would need to know whether another attempt is pointless or whether the owner can fix something.

1

u/Plane-Preference6245 27d ago

Yes, they're different. budget used up isn't refused, it becomes "waiting for the owner" so they can approve it. a validation failure (not on the allowlist, wrong function) is refused and says only the owner changing permissions can fix it. frozen or revoked is refused too.

But it's all in the text right now, so the agent has to parse wording. opened an issue to return the error code as structured output: https://github.com/ahmad-codex/purser/issues/32

2

u/kantorcodes1 27d ago

Returning the error code as a field should let clients distinguish waiting from refused without parsing prose. Purser looks like a fit for HOL Guard's MCP server contributions. The guide and submission steps are here if you want to add it: https://github.com/hashgraph-online/hol-guard/blob/main/docs/guard/mcp-server-contributions.md.

1

u/Plane-Preference6245 27d ago

Thank you, will check it out

2

u/Lushniak_Masjid 28d ago

Yea prompt limits on agent spending are the first thing a jailbreak eats.

1

u/[deleted] 28d ago

[removed] — view removed comment

1

u/Plane-Preference6245 28d ago

No rate limit yet. spamming can't spend more though: payments within the limit stop at the daily budget in the contract, and refused ones are caught by a dry run so they cost nothing.

The noise is over-limit payments, each one opens a new approval request. i'll add a rate limit per agent key and merge repeats of the same payment, tracking it here: https://github.com/ahmad-codex/purser/issues/30