Skip to main content
Glama

Purser

A post-quantum wallet for AI agents. Purser is an MCP server that lets an AI agent (Claude Code, Claude Desktop, any MCP client) pay for things from your QoreChain account, inside limits that QoreChain and a contract enforce, never the agent itself. Every instruction between you and the agent is signed with ML-DSA-87 (FIPS 204).

A purser is the officer who keeps a ship's money: they spend it for the crew, by the captain's rules, and keep the books. That is the job we give the agent.

Why

Agents that act for you need to pay: APIs, data, compute, other agents. Today that means handing the agent a private key or a card number. One prompt injection, bad tool or bug then spends whatever that key can reach, and the key is a classical ECDSA/Ed25519 key that a quantum computer will forge.

Related MCP server: PipRail

What Purser does differently

Works with any AI agent

An MCP server with 11 tools; one line of config for Claude Code / Claude Desktop.

Limits live on chain

Per-payment and daily caps, expiry and allowed calls are a QoreChain session key; payees, per-payee and per-agent caps, budget, payments per day are the Purser contract. A modified MCP server changes nothing.

Post-quantum at every step

The owner signs policies, approvals and instructions with ML-DSA-87 in QoreX; the agent signs every payment, note and approval request with its own ML-DSA-87 key; the contract verifies both with the pqcVerify and pqcKeyStatus precompiles.

Human in the loop for big payments

Above a threshold the agent files a signed approval request on chain; one QoreX signature approves it; the payment can then go through exactly once.

Agent commerce over HTTP 402

fetch_paid pays a "402 Payment Required" invoice and fetches the resource; merchants check paymentForRef on chain. A live paid API (real Open-Meteo forecasts) is included.

Prompt-injection resistant

The agent obeys only instructions you signed in QoreX (read_owner_messages); web content comes back marked as untrusted; refusals are final.

You see everything

Dashboard reads the chain: agents, limits, payments with receipts, notes, approvals, and alerts for any session-key spend that bypassed Purser.

How a payment is checked

agent (MCP server)                  QoreChain                              Purser contract
──────────────────                  ─────────                              ───────────────
signs the intent with ML-DSA-87 ─►  session key (x/abstractaccount):   ─►  payee on the owner's ML-DSA-87-signed list,
signs MsgExecuteEVM with its        per-payment cap, daily cap, expiry,    per-payee and per-agent daily caps, budget,
ed25519 session key; relays it      only pay/postNote/requestApproval      payments per day, approval above a threshold,
in a hybrid tx (ML-DSA-87)          on this contract                       agent's ML-DSA-87 signature (pqcVerify)

Track requirements

Requirement (Post-Quantum AI Agents)

Where in Purser

Proof

The agent's own scoped EVM window (transaction, value, duration and target limits)

The agent identity opens a window scoped to the Purser contract only (allowedTargets), with maxTxs, maxValue and a block limit, and uses it for its signed notes, approval requests and to deliver owner-signed policies. core/src/evm.ts, purser window, shown in guard_status.

9FC80204…, 0x3581d643…

Smart-account spending rules

x/abstractaccount session key: permissions: ["evm"], rule purser with per-tx and daily caps, allowedDenoms: ["uqor"], allowed_evm_calls = Purser's pay, postNote, requestApproval; expiry; instant revoke. core/src/owner.ts.

7FE653AE…

Transaction, value, duration and target limits

Chain: per-payment and daily value caps, expiry, allowed calls; window: tx count, value, blocks, target. Contract: payments per day, per-payee and per-agent daily caps, budget, policy expiry.

E2E table below

Authenticated messaging

Owner → agent: QoreX-signed transactions (memo purser:msg:…), verified by the chain and re-verified by the MCP server. Agent → owner: notes and approval requests signed with ML-DSA-87, verified by the contract.

0AC7456E…, 0xe05c6f0d…

What happened on chain

Every row is a real transaction on the testnet from pnpm --filter @purser/core e2e:

#

What

Result

Transaction

1

Owner links the agent's session key: 1 QOR per payment, 20 QOR/day, 2 h, may call only Purser.pay

linked

7FE653AE…

2

Agent opens its own scoped EVM window: target = Purser only, 100 txs, value cap, ~1 day

opened

9FC80204…

3

Owner signs the policy with ML-DSA-87 (2 payees, budget 2 QOR, 5 payments/day, approval above 0.6 QOR)

signed

4F36F61B…

4

The agent delivers it from its window; setPolicy verifies the owner's signature (pqcKeyStatus + pqcVerify)

stored

0x3581d643…

5

Agent pays 0.4 QOR to weather-api (intent signed with ML-DSA-87, hybrid envelope)

paid

30825135…

6

1.2 QOR, sent past the agent's own checks

refused by QoreChain: per-tx limit

5CF30783…

7

0.1 QOR to an address the owner never allowed

refused by the contract: PayeeNotAllowed

31423F33…

8

0.7 QOR, above the 0.6 QOR approval threshold

refused by the contract: ApprovalRequired

3E5C5E80…

9

Agent files an ML-DSA-87-signed approval request from its window

requested

0x66076721…

10

Owner approves it with an ML-DSA-87 signature; the contract verifies it

approved

ADD129BE…

11

Agent pays the approved 0.7 QOR

paid

2BEEAA3C…

12

The same 0.7 QOR again

refused: an approval works once

DBD9B3C7…

13

0.5 QOR more after 1.6 QOR: past the 2 QOR budget

refused by the contract: BudgetExceeded

F4FE79B6…

14

A 6th payment in the day (limit 5)

refused by the contract: DailyPaymentCountExceeded

86638E63…

15

The session key used directly for a plain MsgSend

refused by QoreChain: no send permission

EC9143E7…

16

The session key used directly to call another Purser function

refused by QoreChain: not in allowed_evm_calls

3199444E…

17

The session key used directly for a 1.5 QOR plain transfer

refused by QoreChain: per-tx limit

BECFF1E7…

18

Agent posts a note from its window; the contract verifies its ML-DSA-87 signature

posted

0xe05c6f0d…

19

Owner messages the agent; read back verified by the chain and locally

verified

0AC7456E…

20

Owner revokes the session key; the next payment

refused by QoreChain

F463B86A…

The run also checks that check_transaction re-verifies the agent's ML-DSA-87 signature of step 5, and a rerun the same day was refused with AgentDailyCapExceeded (the agent's day counters carry across policy versions).

Also verified with a real QoreX wallet: a payee policy signed in QoreX and verified by the contract (325BB44F…, v1 contract), and unscripted Claude Code sessions that paid a live HTTP 402 API and went through the approval flow: docs/AGENT_RUN.md.

Use it

1. The agent's machine

Node 20+ and pnpm 12 (corepack enable picks the right pnpm).

git clone https://github.com/imthegoodboy/purser && cd purser
pnpm install --filter purser-mcp...        # the MCP server and its library only
pnpm --filter purser-mcp build
node mcp/dist/purser.mjs init --owner <your qor1 address>
# send ~2 testnet QOR for fees to the agent identity it prints (https://dashboard.qorechain.io/faucet)
node mcp/dist/purser.mjs register          # registers the agent identity's ML-DSA-87 key
node mcp/dist/purser.mjs link-code         # a pr1:… code for the owner

2. The owner (QoreX)

  • Link the session key. Current QoreX builds keep spending rules inside the wallet and refuse MsgUpdateSpendingRules from websites (we tested it: "managed by the wallet itself, not by a website"), so link with the CLI; the dashboard shows the exact command: PURSER_OWNER_MNEMONIC="…" node mcp/dist/purser.mjs owner link <code> --per-tx 1 --daily 5 --hours 24. Works with a QoreX recovery phrase or an SDK account (testnet only; the phrase is used to sign and never stored).

  • Set payees and limits at https://purser-wallet.vercel.app/app (signed in QoreX).

  • Approve big payments, message the agent, watch everything, revoke (owner revoke).

3. Connect your AI client

Claude Code picks up .mcp.json in this folder. Any MCP client:

{ "mcpServers": { "purser": { "command": "node", "args": ["<repo>/mcp/dist/purser.mjs", "mcp"] } } }

Tool

What it does

guard_status

Session key, chain caps, payees and what is left today, budget, the agent's scoped EVM window, fees left, alerts

list_payees

The payees the owner allowed

pay

Pay an allowed payee (ML-DSA-87 intent + session key, checked by chain and contract)

request_approval

Ask the owner to approve a payment above the threshold (signed, on chain)

fetch_paid

GET a public URL; pay its HTTP 402 invoice up to max_qor and fetch it again

list_payments

This agent's receipts

send_note

A signed note to the owner, verified by the contract

read_owner_messages

The owner's ML-DSA-87-signed instructions, verified by the chain and locally

sign_message / verify_message

QoreSign hybrid signatures against keys registered on chain

check_transaction

Was a transaction signed post-quantum, refused, and does the agent's signature verify

No AI client at hand? pnpm --filter purser-mcp demo runs a scripted session over the same protocol.

Repository

Path

What

contracts/

Purser.sol, HybridTx.sol (parses a hybrid-signed QoreChain transaction), tests, deploy script

core/

TypeScript library: session-key payments, ML-DSA-87 intents, approvals, owner policy, messages, alerts

mcp/

The MCP server and purser CLI (bundled to mcp/dist/purser.mjs)

web/

Owner app (Vite + React) with its serverless relayer and the paid demo API

docs/

Architecture, contract, threat model, audits, real agent run

Tests

Suite

Command

Result

Contract (Hardhat 3 + viem; real ML-DSA-87 signatures, real hybrid-signed transactions, malformed-input fuzz cases)

pnpm --filter contracts test

115 passing

Core library unit tests

pnpm --filter @purser/core test

9 passing

MCP protocol (official MCP client over stdio and Streamable HTTP)

pnpm --filter purser-mcp test

5 passing

Live testnet end to end (every lock, every refusal)

pnpm --filter @purser/core e2e

25 steps, E2E OK

Owner app in Edge with QoreChain's QoreX test double, against the live chain

pnpm --filter web ui-e2e

all steps pass

CI runs the first three and the app build on every push.

Security

docs/THREAT_MODEL.md and docs/AUDIT.md. In short: the agent can be tricked or taken over and the owner's exposure stays bounded by the chain caps and the expiry; every Purser payment also needs an owner-approved payee and the agent's ML-DSA-87 signature. One chain fact we verified and state plainly: allowed_evm_calls covers calls with calldata, so a stolen session key could still make plain transfers up to the chain caps; Purser flags any such transfer in the dashboard and the agent status. Keep caps small and expiries short. Testnet only.

Credits

  • Scaffolded with create-qorechain-dapp 0.14.0 (folders contracts/ and web/): npx -y create-qorechain-dapp@0.14.0 contracts --template hardhat --network testnet --package-manager pnpm --yes --no-install and the same with web --template fullstack-web.

  • QoreChain kits: @qorechain/sdk (session keys, hybrid signing, PQC registration), @qorechain/qoresign (QoreSign message signing, hybrid tx verification), @qorechain/evm (EVM windows), @qorechain/pqc, @qorechain/qorex-wallet-mock (browser tests), the QoreX wallet API.

  • The agent pattern (owner, ed25519 agent key, gas wallet) follows QoreChain's Build Before Q-Day Workshop 2 (02-pq-agent).

  • HybridTx.sol comes from our first fest entry, Pactum.

  • Model Context Protocol SDK (@modelcontextprotocol/sdk), viem, CosmJS, Hardhat, React, Vite, TanStack Query, Playwright; forecasts from Open-Meteo.

License

MIT. Built with Claude Code; see AI_USAGE.md.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      A budget-bound x402 payment wallet for AI agents: it autonomously pays HTTP 402 payment-gated URLs across every major chain (EVM, Solana, and many non-EVM families). Self-custodial and backendless, your key, your RPC, with spend caps enforced before any on-chain send.
      8
      10
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to store and retrieve persistent memory across sessions and machines, and to pay any x402 API while keeping a signed, offline-verifiable ledger of purchases and spending.
      Functional Source , Version 1.1, MIT Future