maza-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
maza-mcp
A Model Context Protocol server that lets AI
agents use and manage MAZA — the cryptocurrency Sami revived after its
abandonment (see docs/DESIGN.md for why that history shaped this design).
An agent connected to this server can ask questions a human would need a wallet, a block explorer and a calculator to answer — and can move money under local spend limits, stated in dollars, that the server enforces before any money moves.
Zero dependencies. The server is pure Python stdlib (≥ 3.10). Nothing to audit but the code itself; it runs anywhere Python runs.
Three backends, one set of tools. A real
mazadnode (RPC), a public indexer (read-only HTTP), and an offline demo chain. Auto mode uses whichever of the first two you configure: with both, reads come from the indexer and wallet and spending from the node.Money is integer satoshis inside, decimal strings on the wire. A number that arrives as a float (a daemon amount, a Python caller's value) is read through its shortest decimal form first; no money arithmetic is done in floating-point. (A figure the daemon reports is exact up to 67,108,864 MAZA in one amount; above that a JSON number cannot carry satoshi precision, and it is the figure shown, never the amount sent.)
Sends are fail-closed.
MAZA_MCP_ALLOW_SEND=0by default. Two-phase preview→confirm (preview_token): request binding plus an extra explicit tool step, off unlessMAZA_MCP_CONFIRM_SEND=1— it is not a human approval step (see "Preview and confirm" below). Per-transaction and per-UTC-day limits, stated in dollars (or in coins) and adjustable while the server runs. Optional spend-from allowlist. Every call audited to a0600JSONL log with redaction whileMAZA_MCP_AUDITis on (the default;0turns it off).Proofs are re-checked, with the anchor named. A merkle proof from the indexer is re-verified locally against the root it names; whether that root belongs to the chain you trust is decided by the header you compare it with, not by the proof.
verify_merkle_proofaccepts raw data and checks the math.
Quick start
pip install git+https://github.com/SamiAhmed7777/maza-mcp.git # or, in a clone: pip install .
maza-mcp selftest # offline demo chain: proves the whole tool surface
MAZA_MCP_MODE=demo maza-mcp list # the tools, their arguments and limits (the simulated chain's set)
maza-mcp check # your node/indexer reachable? which mode? (nothing set: says what to configure)
maza-mcp limit --state-dir ~/.maza-mcp # the spend limits in force; change them: --send-usd A --daily-usd BConnect an agent host (stdio)
An MCP host that can launch a stdio server (Claude Desktop, a custom agent, another Hermes — the configuration key and launch shape are the host's, not this server's):
{
"mcpServers": {
"maza": {
"command": "maza-mcp",
"args": ["serve"],
"env": {
"MAZA_MCP_MODE": "rpc",
"MAZA_MCP_RPC_URL": "http://127.0.0.1:12832",
"MAZA_MCP_RPC_USER": "…",
"MAZA_MCP_RPC_PASSWORD": "…",
"MAZA_MCP_ALLOW_SEND": "1",
"MAZA_MCP_MAX_SEND_USD": "1",
"MAZA_MCP_MAX_DAILY_USD": "5"
}
}
}
}Read-only deployments drop the last three variables: the server then answers chain questions, proofs and history, and cannot spend no matter what the agent (or an attacker whispering to it) asks for.
Related MCP server: PayAgents MCP Server
Running on mainnet, for real
The server is built for mainnet: MAZA_MCP_NETWORK defaults to main, and
the address checks, price quotes and examples all assume the real chain.
A deployment that moves real MAZA should look like this:
A dedicated wallet, lightly funded. Point the agent at its own
mazadwallet (its own datadir or wallet), holding only what it may lose. A limit guards against a wrong amount; it is not a wall against an agent that has been fooled, because the agent can change a limit when it is asked to (see "Spend limits, in dollars" below). The balance is what holds. Do not point it at the treasury.Bind every payment to its preview.
MAZA_MCP_CONFIRM_SEND=1makessendrefuse until it carries the tokenpreview_sendissued for that exact payee, amount, key and note. It is request binding and one more explicit tool step — not a human approval: an agent that is willing to make both calls gets its payment through, and the tool refuses only a request that changed between the two. The human boundary is the switch itself (ALLOW_SEND), the payee list, and what the wallet holds. A retried call — the same call again, token included — replays the recorded result instead of paying twice, even once the day's cap is full.Pin the payee when the job allows.
MAZA_MCP_ALLOW_TO=<address>,…: the limits bound how much may leave, and the agent can change those; this bounds wheresendmay pay, and no tool changes it. Anything else is refused withpayee_not_allowedbefore a preview token exists (withMAZA_MCP_CONFIRM_SEND=1; with it off, before the send is attempted). The list bindssendonly:broadcast_txrelays a transaction that was signed elsewhere, under its own switch (off by default), and does not consult it. LeaveMAZA_MCP_ALLOW_BROADCASToff where the pin is the point;get_statuswarns when both are on.Start read-only. Leave
MAZA_MCP_ALLOW_SENDunset for the first days. The agent can read the chain, verify proofs and quote prices, and cannot spend at all. Turn sending on once the transcripts look right.Rehearse first. The same guards run on the demo chain (
MAZA_MCP_MODE=demo, seeexamples/training.md): train the agent where a mistake costs nothing.MAZA_MCP_NETWORK=testdoes the same against a real testnet node.Keep the state directory with the wallet. It holds the caps ledger, the used-token set and the audit log (
0700/0600). Losing it resets the day's counters and forgets which idempotency keys already paid, so back it up alongsidewallet.dat. While the ledger is unreadable,maza-mcp checkexits 1 andsendis refused; a directory that rejects writes shows at the first send, which is refused with nothing sent (state_unwritable).
{
"mcpServers": {
"maza": {
"command": "maza-mcp",
"args": ["serve"],
"env": {
"MAZA_MCP_MODE": "rpc",
"MAZA_MCP_RPC_URL": "http://127.0.0.1:12832",
"MAZA_MCP_RPC_USER": "…",
"MAZA_MCP_RPC_PASSWORD": "…",
"MAZA_MCP_ALLOW_SEND": "1",
"MAZA_MCP_CONFIRM_SEND": "1",
"MAZA_MCP_MAX_SEND_USD": "0.50",
"MAZA_MCP_MAX_DAILY_USD": "2"
}
}
}
}Spend limits, in dollars
Two limits bound what may leave: the most one payment may carry, and the
most one UTC day may carry. State them in dollars — MAZA_MCP_MAX_SEND_USD
and MAZA_MCP_MAX_DAILY_USD, on mainnet with the price feed on — or in
coins (MAZA_MCP_MAX_SEND_MAZA / MAZA_MCP_MAX_DAILY_MAZA, on any
network). One unit per server.
A dollar limit is converted each time a payment is checked, at the MAZA
price the server holds at that moment, rounded down to a satoshi: the coins
a limit allows are worth at most the dollars. The rounding may not take a
positive limit to nothing: a dollar limit that buys fewer than one satoshi
at the price held is refused amount_below_one_satoshi, never applied as a
cap of zero — read as "no cap" a zero would open the wallet, read as "no
spending" it would forbid the payments the operator meant to allow. That
refusal happens where a pair becomes caps, at the price in force, so a
stored pair can be refused at the next payment; maza-mcp limit therefore
says the pair is re-read, not that it is applied. With no price held, the
payment is refused limits_unpriced instead of being converted at a guess, and
the preview says the same. The same refusal answers while the price held is
marked stale — older than 15 minutes: an old price is shown, with its age,
and nothing is converted at it (neither the limits nor convert) until a
fresh one is held. Limits stated in MAZA coins are not converted, so an old
price changes nothing on such a server. A day limit below one payment is
refused: at start-up as a configuration error, through the agent as
daily_below_payment.
The limits are adjustable while the server runs — no ceiling — and each
change is one line in the audit log while it is on (the default;
MAZA_MCP_AUDIT=0 turns it off):
Through the agent:
set_spend_limits, listed while a limit is in force. Its description tells the agent to change a limit when the person who runs the server asks and not on its own initiative.From a shell:
maza-mcp limit --state-dir DIR --send-usd 10 --daily-usd 30. It needs neither the node nor the price feed;maza-mcp limit --state-dir DIRshows the pair in force. A server already running re-reads a change at its next payment (a dollar pair is converted there, at the price held then, and refused there if it buys no satoshi).At start-up: the environment, as above.
A change is written to <state dir>/limits.json (0600), is read again at
the next payment — converted there if it is stated in dollars, and refused
there if it buys no satoshi — and survives a restart. A stored file the
server does not trust (wider than owner-only, not a regular file, oversized,
unreadable or in the other unit) refuses payments — the code says which:
limits_unsafe, limits_corrupt or limits_oversized — until the pair is
written again, and maza-mcp check fails while that is so. get_status
reports the limits in force in both units, the price they were converted at,
what was spent today and what is left.
Because the agent can change the limits, a limit is a guard against a wrong
amount, not a wall against an agent that has been fooled. The wall is what
no tool changes: sending off by default, and the payee list
MAZA_MCP_ALLOW_TO.
The tools
Category | Tools |
info |
|
convert |
|
read |
|
search |
|
proof |
|
verify |
|
wallet |
|
spend |
|
broadcast |
|
admin |
|
limits |
|
demo |
|
Tool results are a stable envelope: {"ok", "tool", "simulated", "sats_per_maza": 100000000, "result" | "error": {"code", "message", "details"}, "text"}. Error codes are names, not numbers (insufficient_funds,
cap_exceeded, confirmation_required, not_found, …) — an agent can branch
on them. Every tool result also carries text: a human-readable sentence, so
small models (or humans reading the transcript) don't have to parse JSON.
With MAZA_MCP_CONFIRM_SEND=1, send does not broadcast on the first ask.
The flow is:
preview_sendwith theidempotency_keythe payment will carry →{"allowed": true, "preview_token": "…", "blocking": []}(orallowed: falseand why: caps, payee pin, wrong network, …). The key is required here as it is insend: without it neither tool can say whether the payment would go through, so a preview without one is refused.sendwith the sameidempotency_keyand thepreview_token→ the real transaction. Repeatingsendwith the same key — with or without the token — is a replay that returns the same txid, not a second spend. Thepreview_tokenbelongs to one payee, amount, key and note: asendthat changes any of them is refused aspreview_mismatchbefore the token is consumed, so it still works for the payment that was previewed.
What the step is, and what it is not: it binds a payment to the request that
was previewed, and it makes send a second, explicit call. It is not an
approval by a person: the same agent can call preview_send and then send
with the token it just received, so an agent that is willing and able to make
both calls pays what it asked to pay. A refusal here means the request changed
between the two calls (preview_mismatch), the key was already used, or a
guard said no — not that a human agreed. What a rogue or fooled agent runs
into is the switch (MAZA_MCP_ALLOW_SEND=0), the payee pin
(MAZA_MCP_ALLOW_TO) and the balance; see "Safety model" below.
MAZA_MCP_CONFIRM_SEND is 0 by default: the token step is then off, and the
first send that passes the address, network, payee and cap checks pays. The
idempotency_key is required either way. The
caps, the payee pin and the idempotency ledger apply either way, and so does
the audit log while it is on (MAZA_MCP_AUDIT=1, the default); get_status
warns Spending is enabled WITHOUT a preview step.
Configuration (environment)
Variable | Default | Meaning |
|
|
|
|
|
|
| (empty) | read-only chain data; no default endpoint is hardcoded — point it at your indexer. Required in |
| — | mazad JSON-RPC; required in |
| — | node credentials: user and password, or the path to mazad's |
|
| spending needs an explicit yes |
|
| additionally require the preview token |
| — | per-transaction cap in coins (any network) |
| — | per-UTC-day cap in coins. One unit per server |
| — | per-transaction cap in dollars (mainnet; needs the price feed) |
| — | per-UTC-day cap in dollars, converted at the held MAZA price when a payment is checked, rounded down; a limit that buys no satoshi at that price is refused |
| — | spend only the coins of these addresses (comma-separated) |
| — | fixed change address (needs |
| — | comma-separated payee allowlist for |
|
| raw-tx broadcast: relays a transaction signed elsewhere. Its outputs are capped like a payment, so both caps must be set; the payee list does not apply; there is no preview step |
|
| diagnostics, backup, allowlisted RPC (rpc mode only) |
|
| caps ledger, the stored limits and the audit log ( |
|
| one JSON line per call, redacted; |
|
| FreiExchange + CMC (mainnet only, fail-closed); a dollar limit is converted at it |
| (empty) | your own explorer for links |
|
| raise errors instead of encoding them |
Credentials come from the environment, in one of the two forms above. They are not echoed: status, logs and errors carry redacted or hashed forms only.
Safety model (the short version)
Off by default. No spend, no broadcast, no admin unless each is explicitly enabled. The price feed is the exception: it is on by default and lazy (nothing is fetched at start-up, and the chain and wallet tools never fetch a price); a price is fetched when one is asked for (
get_price,convert) or a dollar limit is converted.MAZA_MCP_PRICE=0removes it: the server then makes no outbound price call, and a dollar limit is refused at start-up.Local limits, adjustable by design. Limits are enforced in this process before any RPC leaves it, and the node has no say in them. The agent can change them:
set_spend_limitsexists for when you ask it to. So a limit guards against a wrong amount, not against a fooled agent. Against that: sending off (item 1), the payee list (item 3 of the mainnet checklist) and a wallet that holds little. The payee list constrainssendonly, so the same boundary is the broadcast switch left off:MAZA_MCP_ALLOW_BROADCAST=1relays a transaction signed elsewhere, whose outputs are capped like a payment but whose destination the list does not check. Set the pin and leave the relay off together, or the pin covers half the ways money can leave.Rehearsal mode. Demo mode with
ALLOW_SEND=1is a full dress rehearsal: same guards, same envelope, same audit log (on unlessMAZA_MCP_AUDIT=0), fake chain. Train agents here.Proof you can check. Indexer proofs are re-verified with local SHA256 merkle math before they are called "verified".
No address reuse pressure.
get_new_addressreturns a fresh address;make_uri/parse_uriare BIP-21-shaped so invoices survive being copy-pasted.What the server does NOT do. No private-key export, no
dumpprivkey, no arbitrary RPC passthrough (a read-only allowlist, refused before the node is asked), no wallet decryption, no silent network switching.Arguments are checked as whole strings. An idempotency key, a file name or a path segment has to match its pattern in full: a value that merely starts like a valid one (with a newline on the end, say) is refused before any handler, wallet or node sees it.
See docs/DESIGN.md for the full design record and docs/BENEFITS.md for
what this unlocks.
Tests
python -m unittest discover -s tests -p "test_*.py" -v # offline; skips = the opt-in live tests (+ the SDK test below unless "mcp" is installed)
pip install mcp && python -m unittest tests.test_e2e_sdk_client -v # optional: through the official SDK client
# live, opt-in:
MAZAMCP_TEST_MAZAD=/path/to/mazad python -m unittest tests.test_live_daemon -v
MAZAMCP_TEST_INDEXER=https://your-indexer.example/indexer \
python -m unittest tests.test_live_indexer -vRe-verified 2026-12-01 (UTC), after the tests were kept off the network:
offline suite OK (1004 tests, 4 skipped) in 50 modules, run three
ways (discovery from the repository root, all modules by dotted name in one
run from another directory, and each module alone from there). The 1002 is
the tree's own count, re-measured from the test modules on the final bytes;
the three commands under "Reproducing this" are what re-establish the run
itself, and they are re-run on the published bytes before a release.
Live, verified 2026-11-30: daemon OK
(3 tests) against a MazaCore 0.16.3 testnet node the test spawns itself
(spend path proven via the node's own insufficient_funds refusal on an
empty wallet, plus the local cap_exceeded guard); live indexer OK (1
test) against a real indexer with a locally re-verified merkle proof.
The same suite passes on CPython 3.10.22, the oldest version the package
declares (requires-python = ">=3.10"), and a wheel built from this tree
installs into a clean 3.12 environment where maza-mcp selftest passes.
tests/fixtures/indexer/ holds anonymized live-shape captures; a shape test
fails if the indexer's contract drifts.
Reproducing this
# 1. discovery, from the repository root
python -m unittest discover -s tests -p "test_*.py" -v
# 2. every module by dotted name, in one run, from another directory
cd /tmp && PYTHONPATH=/path/to/maza-mcp python -m unittest $(cd /path/to/maza-mcp && \
ls tests/test_*.py | sed 's#/#.#g; s#\.py$##')
# 3. each module alone, from the same place (a module that only passes beside another fails here)
cd /tmp && for m in $(cd /path/to/maza-mcp && ls tests/test_*.py | sed 's#/#.#g; s#\.py$##'); do
PYTHONPATH=/path/to/maza-mcp python -m unittest "$m" || echo "not OK: $m"; done
# 4. the tool surface, offline, on the demo chain
maza-mcp selftest
# 5. a wheel from this tree, installed and run from outside it
python -m venv /tmp/maza-venv && /tmp/maza-venv/bin/pip install . && \
cd /tmp && /tmp/maza-venv/bin/python -m unittest discover -s /path/to/maza-mcp/tests -p "test_*.py"The figures in this section were taken with those five commands on the tree as committed.
The one real payment, and the defects it found
One real mainnet payment has been made: 0.1 MAZA to a fresh address of the
same wallet, fee only. No second payment is authorised. Its transcript found
defects the offline tests had missed; each was fixed at the root after a test
went red, and docs/VERIFICATION.md records the list, the tests that lock
each one, and what is still unverified (the restricted spend path and the
dollar limits have moved no real money). The same document records the
mutation battery's history and the crash that was found outside a test.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Crypto wallet for AI agents: balances, payments, swaps and trading with owner controls.
Give your AI agent a wallet: live FX rates, swaps and payments in 140+ local currencies.
Give AI agents a wallet with a spending limit. Non-custodial USDC on Base, server-enforced limits.
Provide AI agents and automation tools with contextual access to blockchain data including balance…
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to check balances and send transactions across multiple blockchains with automatic spending limit protection and policy enforcement.3MIT

PayAgents MCP Serverofficial
AlicenseAqualityDmaintenanceEnables AI agents to autonomously make policy-controlled payments for APIs and tools via Bitcoin Lightning (L402) and Base USDC (x402), including paying paywalled endpoints, checking balances, and reviewing transactions.314 npm1MIT- AlicenseAqualityBmaintenanceEnables AI agents to check paywalled resource prices, pay and fetch content within enforced budgets, and inspect wallet status.3271 npm3Business Source 1.1
- AlicenseAqualityBmaintenanceEnables AI agents to perform and manage payments through the Model Context Protocol, including paying, checking balances and history, registering bots, setting spending limits, discovering supported networks and tokens, inspecting commissions, and managing bot pools. It also supports governed tool calls with policy decisions, human approval, and tamper-evident audit traces.12Apache 2.0