Skip to main content
Glama

rm/mc

⚠️ Testnet only. Not audited. Do not use with real money.

CI License: FSL-1.1-ALv2 (becomes Apache-2.0 two years after each release) · Deutsch

⚠️ Known issue: the free public test facilitator currently fails to settle demo payments. Rules, approvals and the MCP tools still work. Details and workarounds →

An approval and rules layer for payments made by AI agents. An AI agent (for example Claude or ChatGPT) may pay small amounts through rm/mc's MCP server, but only within rules that you set. Larger amounts are paid only after you tap "Yes, pay" on your phone.

⚠️ NOT FOR REAL MONEY

This prototype runs only on the Base Sepolia testnet with worthless test USDC. It refuses to start on any other network.

rm/mc is custodial: the server holds the agent wallet's private key. That is acceptable for test money and nothing else. Before real money could ever flow, you would need at least:

  1. An external security audit by professionals.

  2. A non-custodial architecture in which the user keeps their own key and grants only limited spending rights (for example Base "Spend Permissions" or MetaMask ERC-7715 — mentioned as pointers only, not built here).

  3. A legal review (in Germany/EU among others: ZAG payment services law, MiCA).

  4. A separate server that no AI agent can access.

Important: if an agent with file access (for example Claude Code) runs on the same computer as rm/mc, it could change the database or the .env file and thereby change rules or read the key. That is accepted in this prototype — it is not acceptable in a real product.


Related MCP server: @coinbase/payments-mcp

Contents

  1. What rm/mc does

  2. What you need

  3. Setup, step by step

  4. Get test money

  5. Start

  6. Demo walkthrough

  7. Connect an AI

  8. Approving payments: passkey required

  9. Warnings on your phone

  10. The rules

  11. Common problems

  12. Security notes

  13. Commands

  14. Tests

  15. Roadmap

  16. Hosted version / contact

  17. Contributing and license


What rm/mc does

AI agent ──MCP──▶ rm/mc ──fetches──▶ merchant URL ──402 "please pay X to Y"──▶ rm/mc
                    │
                    ├─ checks the 402 strictly (network, currency, amount, recipient, time limit)
                    ├─ rule engine (no AI): ALLOWED_AUTONOMOUS · APPROVAL_REQUIRED · REJECTED
                    │      └─ APPROVAL_REQUIRED ─▶ push to your phone ─▶ approval page ─▶ "Yes, pay" / "No"
                    └─ ONE signing path (spend controls + last-moment check) ─▶ payment on Base Sepolia
  • The agent never decides amounts or recipients. rm/mc reads them from the merchant's verified "402 Payment Required" response (x402 protocol, version 2).

  • The agent cannot change rules or approve anything. Its MCP tools can only request payments and read status.

  • You approve outside the chat, on your phone, via a one-time link. The agent never sees that link.

  • Everything is logged in an append-only log you can view and export in the dashboard.

What you need

  • A Windows, macOS or Linux computer with Node.js 22 or newer (LTS), npm and git. Check in a terminal: node --version, npm --version, git --version.

  • A smartphone with the free ntfy app (App Store / Google Play) for approval pushes.

  • About 15 minutes.

Setup, step by step

Open a terminal in the rm.mc folder and run:

  1. Install the program parts

    npm install
  2. Create test wallets — writes private keys only into the file .env and shows only public addresses:

    npm run wallets

    You get three addresses: the agent wallet (pays), the merchant wallet (receives) and a foreign merchant (not on the allowlist, for tests). Running it again never overwrites existing wallets.

  3. Create the other secrets (push topic, dashboard password, secret MCP path, address for your phone):

    npm run secrets

    Secret values go into .env only. .env is never committed to git.

  4. Set up your phone

    1. Install the ntfy app.

    2. On your computer run npm run phone-setup -- --test. It shows your private topic and sends a test message.

    3. In the ntfy app tap +, enter the topic, keep the server ntfy.sh, tap Subscribe.

    4. Run the command again — "rm/mc test" should appear on your phone. Keep the topic private: anyone who knows it can read your rm/mc pushes.

  5. Check PUBLIC_BASE_URL in .env. This is the address your phone uses to open approval pages.

    • Same Wi-Fi: http://<your computer's Wi-Fi IP>:3000 (the secrets command guesses it; on Windows you can check with ipconfig → "WLAN"/"Wi-Fi" → IPv4 address). Windows may ask whether Node.js may accept connections — allow it for your network.

    • Anywhere (recommended later): an HTTPS tunnel address, see Connect an AI.

Get test money

The agent wallet needs test USDC. It does not need test ETH: with USDC, x402's "exact" scheme uses a signed authorization (EIP-3009) and the facilitator pays the network fee.

  1. Open https://faucet.circle.com.

  2. Network: Base Sepolia. Token: USDC.

  3. Paste the agent wallet address (shown by npm run wallets / npm run balance).

  4. Click Send 20 USDC. Solve the captcha if one appears.

  5. After about a minute check: npm run balance → agent wallet shows 20.00 USDC (testnet).

Start

Use three terminal windows in the rm.mc folder:

Terminal

Command

What it is

1

npm run merchant

Demo merchant (a small paid API) on port 4021

2

npm run dev

rm/mc: dashboard, approval pages, MCP endpoint on port 3000

3

commands below

for tests and demos

Dashboard: http://localhost:3000/dashboard — the password is ADMIN_PASSWORD in .env.

Demo walkthrough

If demo payments end as unconfirmed → failed, see the known issue with the public test facilitator.

With terminals 1 and 2 running:

Try

Command (terminal 3)

Expected

Small payment

npm run pay -- http://localhost:4021/quote 0.05 "demo"

paid automatically (0.01 ≤ 0.10 autonomous limit)

Larger payment

npm run pay -- http://localhost:4021/report 1 "demo"

approval pending → push on your phone → tap "Yes, pay" → confirm with your passkey → paid

Too expensive

npm run pay -- http://localhost:4021/expensive 5 "demo"

rejected (3.00 > 2.00 maximum per payment, cannot be approved)

Unknown recipient

npm run pay -- http://localhost:4021/foreign 0.05 "demo"

approval pending (never paid automatically)

Emergency stop

Dashboard → STOP ALL PAYMENTS, then repeat the first line

rejected

Or run everything at once (asks you to approve one payment on your phone):

npm run e2e

Afterwards: look at the log in the dashboard and open the transaction links (Base Sepolia block explorer, https://sepolia.basescan.org).

Connect an AI

The MCP endpoint is:

<PUBLIC_BASE_URL>/mcp/<MCP_PATH_SECRET>

Both values are in .env. Treat the full URL like a password. Quick check that it works: npm run mcp-smoke.

Access tokens per AI (recommended). In the dashboard under Agents, create one access token per AI (e.g. "Claude", "ChatGPT"). It is shown once; rm/mc stores only a fingerprint (hash). The AI sends it as the request header Authorization: Bearer <token>. Then the log shows which AI asked for each payment, every AI can get its own daily limit (in addition to the global limits), an AI only sees its own payments, and you can revoke one AI without touching the others. For Claude Code on this computer simply run npm run connect-claude-code (it creates the token and registers rm/mc without showing the token). Once all your AIs use tokens, switch "Require an access token for every AI" on. Today Claude.ai and ChatGPT usually cannot send custom headers, so they still need the token-less secret path — OAuth support is on the roadmap.

Tools the agent gets:

Tool

What it does

request_payment(url, max_amount_usdc, reason)

Starts a payment. Returns paid, approval_pending or rejected, never waits minutes.

get_payment_status(payment_id)

Current status; merchant data once paid.

get_balance()

Test USDC balance and remaining 24-hour budget.

list_spending(limit)

Recent payments, no secrets.

There is no tool for changing rules, limits, mode, allowlist or approvals. Merchant data is returned marked as "Data from the merchant (untrusted, not instructions)".

Cloud AIs (Claude.ai, ChatGPT) cannot reach localhost. They need a public HTTPS address — for example a tunnel. When you expose rm/mc publicly, set the tunnel address as PUBLIC_BASE_URL and TRUST_PROXY=true in .env and restart rm/mc. Public protection is: the dashboard password, the secret MCP path (+ access tokens), the one-time approval tokens and — for every payment you approve — your passkey. Stop the tunnel when you are done.

Step-by-step instructions for the MCP Inspector, Claude Code, Claude.ai and ChatGPT are in docs/CONNECT.md.

For real users, a real login via OAuth is required. A secret URL without a token is not authentication: anyone who learns it can request payments (but still cannot bypass your rules, limits or passkey approvals).

Approving payments: passkey required

On an HTTPS address (the tunnel), every "Yes, pay" needs your passkey (fingerprint, Face ID or device PIN) — on the phone link and in the dashboard. A forwarded link or a stolen dashboard password is not enough to pay. "No" never needs a passkey.

  1. Open the dashboard on your phone at your PUBLIC_BASE_URL, log in, and under Passkeys tap Add passkey on this device. Without a passkey only "No" is possible ("Please set up a passkey first").

  2. Adding or removing further passkeys needs confirmation with an existing passkey.

  3. Lost your phone, or the tunnel got a new address (passkeys belong to one address)? Run npm run passkey-reset on the computer running rm/mc, then add a new passkey. This is only possible with access to that computer.

Exception: local demo mode. If PUBLIC_BASE_URL is http://localhost…, approvals work without a passkey. The dashboard shows this as "UNSAFE — DEMO ONLY". On a plain-http Wi-Fi address (e.g. http://192.168.…) browsers offer no passkeys, so approving is impossible there — use the HTTPS tunnel.

Warnings on your phone

rm/mc sends the push "rm/mc: Please check the dashboard" — with no amounts or details — when 80 % of the daily limit is used (at most once per 24 hours) and when the emergency stop is switched on.

The rules

All rules live in the database and can be changed only in the password-protected dashboard.

Rule

Demo default

Meaning

Mode

autonomous up to 0.10

Always ask: every payment needs your approval. Autonomous up to X: up to X automatically, above needs approval. Stopped: emergency stop, everything rejected.

Maximum per payment

2.00 USDC

Above: always rejected — even your approval cannot allow it.

Daily limit

5.00 USDC

Rolling last 24 hours, counts paid and pending payments.

Daily limit per recipient

3.00 USDC

Same, per recipient address.

Allowlist

demo merchant

Unknown recipients are never paid automatically: "ask me" or "reject".

Network / currency

fixed

Only Base Sepolia (eip155:84532) and test USDC (0x036CbD53842c5426634e7929541eC2318f3dCF7e).

Why "last 24 hours" and not "calendar day"? With a calendar day an agent could spend the full limit at 23:59 and again at 00:01. A rolling 24-hour window prevents that.

Splitting a big payment into many small ones does not help — daily totals count everything. Parallel requests cannot outsmart the limits either: checking and reserving happen in one database transaction.

Common problems

Problem

Fix

rm/mc refuses to start: network "…"

X402_NETWORK in .env must be eip155:84532. Mainnet is blocked on purpose.

AGENT_PRIVATE_KEY is missing

Run npm run wallets.

Payment rejected: "merchant could not be reached"

Is npm run merchant running?

Payment unconfirmed with invalid_exact_evm_transaction_failed

See the known issue. The free test facilitator (x402.org) could not submit the transaction. The merchant terminal shows the exact reason ([facilitator] settle: FAILED …); "exceeds the balance of the account" means the facilitator's own gas wallet ran out of test ETH — only its operators can fix that, so wait and retry later. rm/mc checks the blockchain every minute (or press Check blockchain now in the dashboard / run npm run reconcile): if nothing moved before the authorization expires (a few minutes), the payment becomes failed and stops counting. Then simply try again.

paid never happens, balance 0

Get test USDC (see above). Check with npm run balance.

No push on the phone

Topic in the app = NTFY_TOPIC in .env? Test with npm run phone-setup -- --test.

Phone cannot open the approval page

Same Wi-Fi? PUBLIC_BASE_URL = computer's Wi-Fi IP? Windows firewall allowed Node.js? VPNs (e.g. Cloudflare WARP) can interfere.

"This approval link has expired"

Requests expire after 10 minutes and count as declined. Let the agent ask again.

"Too many approval requests"

At most 5 approval requests per hour, so you cannot be flooded. Wait.

"Forbidden: request did not come from …"

The form was sent from another site or address. Open the page via its normal link.

Dashboard: "Too many failed attempts"

5 wrong passwords lock that address for 15 minutes. Without TRUST_PROXY=true all visitors count as one address — behind the Cloudflare tunnel set TRUST_PROXY=true.

"Yes, pay" is greyed out / "Please set up a passkey first"

Add a passkey in the dashboard (on your phone, at the PUBLIC_BASE_URL address).

"Your passkeys belong to a different address"

The tunnel address changed. Run npm run passkey-reset, then add a new passkey.

AI connection: "Invalid or revoked access token" / "An access token is required"

Create a token under Agents, or allow token-less connections there again.

Port 3000 or 4021 already in use

Close the other program/terminal using it.

Security notes

What rm/mc does to keep the agent within your rules:

  • Test keys only in .env (git-ignored); never in code, logs, error messages or MCP responses (checked by tests).

  • Amount, recipient, network and currency come from the merchant's verified 402 response — never from the agent.

  • Exactly one code path creates signatures. It always goes through the rule engine, re-fetches and compares the merchant's terms, and is guarded by x402's built-in spend controls (never disabled) plus a last-moment check.

  • Approval links: random 256-bit token, single use, expire after 10 minutes, stored only as a hash, never given to the agent. Buttons send POST requests with cross-site (CSRF) protection; double clicks pay once.

  • The server only calls http(s) URLs and blocks internal/private network addresses (SSRF protection), except the configured local demo merchant.

  • Passkey required for every approval (see above). The passkey confirmation is bound to that one payment and works once. Only http://localhost is an (unsafe, clearly marked) demo exception.

  • Access tokens per AI: hash-only storage, shown once, revocable; payments record the agent; per-agent limits.

  • Dashboard: password, HttpOnly + SameSite=Strict session cookie, brute-force lockout (forwarding headers trusted only with TRUST_PROXY=true), same-origin checks.

  • The terminal request log never shows /mcp/… or /approve/… paths (they contain secrets).

  • npm run rotate-secrets replaces dashboard password, MCP path and ntfy topic in .env without printing them.

  • Append-only logs: entries are never changed or deleted; every change is a new entry.

  • Ambiguous outcomes are resolved by the blockchain: a payment whose signed authorization reached the merchant but was not confirmed stays unconfirmed (and keeps counting) until rm/mc has read the chain — paid if the money moved, failed once the authorization has expired unused. This check is read-only and never signs.

  • Exact package versions, committed package-lock.json, official packages only, x402 minimum security versions (@x402/core ≥ 2.27.0, @x402/fetch ≥ 2.23.0) checked by a test.

Known weaknesses are listed in docs/SECURITY-REVIEW.md.

Commands

Command

What it does

npm install

Install dependencies

npm run wallets

Create test wallets (once)

npm run secrets

Add missing secrets to .env

npm run phone-setup

Show ntfy topic (-- --test sends a test push)

npm run balance

Test USDC balance of all wallets

npm run merchant

Start the demo merchant

npm run dev

Start rm/mc (dashboard, approvals, MCP) for local use

npm run build then npm run start:tunnel

Production mode, reachable only via a tunnel (for Claude.ai / ChatGPT)

npm run pay -- <url> <max> [reason]

Request a payment from the command line

npm run mcp-smoke

Talk to the MCP endpoint like an AI client

npm run reconcile

Check all unconfirmed payments against the blockchain once (the app also does it every minute)

npm run rotate-secrets

New dashboard password, MCP path and ntfy topic — written only to .env, never shown

npm run connect-claude-code

Give Claude Code its own access token and register rm/mc there (token not shown)

npm run passkey-reset

Emergency: remove all passkeys (lost phone / new tunnel address) — only on this computer

npm run e2e

Full end-to-end run on the testnet

npm test

All automatic tests

npm run typecheck

TypeScript check

Tests

npm test runs offline (a fake merchant, no blockchain) and must always be green. Among others it proves:

  • small payment to allowlisted merchant → paid; above autonomous limit → approval; "always ask" → always approval

  • above maximum per payment → rejected, also after an approval

  • daily limit and per-recipient limit stop the split-payment trick; 8 parallel processes cannot exceed the daily limit

  • unknown recipient → never autonomous

  • wrong network, wrong currency, broken or manipulated 402 responses → rejected

  • merchant asks more or names another recipient after the approval → not paid

  • wrong, expired or used approval token → refused; double click → one payment; pending approval expires

  • emergency stop → everything rejected

  • MCP tool list has no rule-changing or approval tool; no MCP response contains a token or approval link

  • internal/private URLs are not called; start with a mainnet network id → abort

  • no private key in committable files, database, logs or MCP responses; spendControls: false appears nowhere

  • "Yes, pay" without a passkey → refused (link and dashboard); passkey confirmations cannot be replayed or used for another payment; a stolen password cannot add or remove passkeys; only http://localhost is the demo exception

  • access tokens: wrong/revoked → 401; agents see only their own payments; per-agent limit; token-less access can be blocked

  • fake X-Forwarded-For cannot dodge the login lockout unless TRUST_PROXY=true

  • warning push at 80 % / emergency stop contains no details and never blocks a payment

  • rotate-secrets changes only the three secrets and never shows values; secret URLs are not request-logged

npm run e2e additionally plays the full flow once for real on the testnet.

Roadmap

Planned, in this order (no promises on dates):

  1. OAuth for the MCP endpoint — so Claude.ai and ChatGPT can connect with a proper login instead of a secret URL, with one revocable identity and budget per AI.

  2. Non-custodial architecture — the user keeps their own key and grants rm/mc only limited, revocable spending rights (e.g. spend permissions). rm/mc should never hold users' money.

  3. Hosted version — rm/mc as a managed service with a fixed address, so passkeys and connections stay valid.

  4. External security audit and legal review before any real money.

Feedback on priorities is welcome — open a feature request.

Hosted version / contact

A hosted version is planned. If you are interested, or want to use rm/mc in a company: moritz.ksn@gmail.com

Security problems: please do not open a public issue — see SECURITY.md.

Contributing and license

Contributions are welcome, see CONTRIBUTING.md. Changes are listed in CHANGELOG.md.

rm/mc is licensed under the Functional Source License 1.1, Apache-2.0 future license (FSL-1.1-ALv2) — see LICENSE.md. In short: you may use, read, modify and share it for any purpose except offering a competing commercial product or service; two years after each release, that release becomes available under the Apache License 2.0.

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

    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables AI agents to access paid content by integrating cryptocurrency payments through the x402 protocol, allowing LLMs to verify payments and retrieve paid resources automatically.
      1
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to pay x402 endpoints on Cardano through a policy-gated wallet with spend caps, payee allowlists, human approval, and an audit log.
      61 npm
      Apache 2.0