Nirium

v0.8.0
io.github.nirium-protocol/nirium-mcp Checked 1 hour ago Published 1 day ago

Verifiable receipts for AI agent payments on Stellar: anchor, verify, x402 paid endpoints

Model Context Protocol server for Nirium - lets any MCP-compatible AI (Claude, GPT, Cursor, VS Code Copilot, and others) anchor verifiable receipts to IPFS with Audit Trail, pay x402 endpoints (MPP tools are experimental), read Reporting summaries and market data. Treasury tools for DeFindex vaults are off by default and testnet-only (see below). Every receipt the anchor_audit_record tool returns can be re-checked by anyone with npx nirium-cli verify or at nirium.xyz/verify.

Summary extracted from the README.

nirium-mcp

Model Context Protocol server for Nirium - lets any MCP-compatible AI (Claude, GPT, Cursor, VS Code Copilot, and others) anchor verifiable receipts to IPFS with Audit Trail, pay x402 endpoints (MPP tools are experimental), read Reporting summaries and market data. Treasury tools for DeFindex vaults are off by default and testnet-only (see below).

Every receipt the anchor_audit_record tool returns can be re-checked by anyone with npx nirium-cli verify <cid> or at nirium.xyz/verify. Since 21 Nov 2026 the result also includes document, the exact JSON that was pinned: keep it, and npx nirium-cli cid shows a saved copy is the original.

What a receipt adds over the ledger: a Stellar payment is already public, so a receipt that only repeats payer, payee and amount proves nothing new; link the transaction instead. Receipts are for what the ledger doesn't hold: policy decisions (including refused payments that were never signed), what a payment was for, off-chain records, and who declared them. More in the design FAQ.

Software-only. This server never holds funds - paid tools sign per-request payments from a Stellar wallet you control via STELLAR_SECRET_KEY.

Install

No install needed - run directly with npx, or add to your MCP client config. Also listed in the official MCP Registry as io.github.nirium-protocol/nirium-mcp.

Claude Desktop config

{
  "mcpServers": {
    "nirium": {
      "command": "npx",
      "args": ["-y", "nirium-mcp"],
      "env": {
        "AGENT_API_URL": "https://nirium-agent.fly.dev",
        "STELLAR_SECRET_KEY": "S...",
        "NIRIUM_API_KEY": "sk_free_..."
      }
    }
  }
}

STELLAR_SECRET_KEY and NIRIUM_API_KEY are optional - omit them and the free tools still work; paid x402 (MPP experimental) and authenticated tools will tell you what's missing instead of failing silently.

Tools

Free - no key required

  • get_market_state - XLM/USDC price, SDEX spread, base fee, Blend rate, CETES rate
  • get_loop_status - autonomous loop status, scan count, last AI decision
  • execute_demo - dry-run a strategy via real Soroban simulation, no funds moved
  • get_wallet_info - show the configured x402 (MPP experimental) wallet and enabled tools
  • get_nodes - list the execution nodes with live status, custody model and network
  • anchor_audit_record - anchor a hash (or a small JSON record) to IPFS, get back a CID
  • get_reporting_summary - settled payouts, x402 receipts and anchors for a period

Authenticated - requires NIRIUM_API_KEY

  • start_loop - start the autonomous scanning loop
  • stop_loop - stop it

Paid via x402 - requires a funded STELLAR_SECRET_KEY

  • get_premium_signals - $0.02 USDC - testnet only; signals come from the autonomous loop, which runs on testnet. They reference testnet tokens, which have no monetary value, and are not a recommendation to buy, sell or hold anything. The mainnet box returns 501 without charging.
  • get_premium_market - $0.05 USDC - market state with reference rates attributed to their source, fee pressure and network conditions. Factual data, no advice.
  • execute_paid_strategy - $0.25 USDC - testnet only; execution needs a signing key and the mainnet box holds none by design, so it returns 501 without charging.

Paid via MPP - requires a funded STELLAR_SECRET_KEY

  • get_mpp_signals - $0.02 USDC - same data and same testnet-only limit as get_premium_signals, settled via direct Soroban SAC transfer with no external facilitator
  • get_mpp_market - $0.05 USDC - same as get_premium_market, MPP-settled
  • Known issue in 0.6.13: both MPP tools go through @stellar/mpp 0.7.1, which does not support @stellar/stellar-sdk 17 yet, so they are expected to fail. Use nirium-mcp@0.6.12 for MPP until a fixed @stellar/mpp is published. The x402 tools are not affected.

Treasury - off by default, testnet only, requires NIRIUM_API_KEY

Since 0.7.0 these eleven tools load only when NIRIUM_MCP_TREASURY=1 is set, and never with STELLAR_NETWORK=mainnet, where the treasury node is paused. Without the variable the server lists 14 tools.

Reading a DeFindex vault is free. Changing one needs the key, and ten of these eleven tools only build an unsigned XDR; you sign it yourself and broadcast it with submit_treasury_tx. Only execute_treasury_rebalance signs anything, and it does so with Nirium's own key, invite-only while a specific legal question stays open (see below) - everywhere else, Nirium never holds a key that can move your funds.

  • get_treasury_info - Treasury node metadata: what role Nirium holds on DeFindex vaults, what it can and cannot do, fees, security notes
  • get_treasury_vault - Read a DeFindex vault's roles, assets and managed funds. Pass holder to also get that account's balance in the vault's asset
  • get_treasury_vaults - List DeFindex vaults Nirium has deployed or read, on the current network
  • get_treasury_strategy_asset - Read which asset a DeFindex strategy manages, as declared by the strategy itself - pairs it correctly before deploying a vault
  • deploy_treasury_vault (builds unsigned XDR) - Build an UNSIGNED XDR to deploy a DeFindex vault. manager keeps control (rescue, pause, revoke); Nirium only ever holds rebalanceManager, which cannot withdraw or change roles. On mainnet: invite-only (institutional key).
  • deposit_to_treasury_vault (builds unsigned XDR) - Build an UNSIGNED XDR to deposit into a DeFindex vault. Sign with from and broadcast it with submit_treasury_tx. On mainnet: invite-only (institutional key).
  • withdraw_from_treasury_vault (builds unsigned XDR) - Build an UNSIGNED XDR to withdraw from a DeFindex vault. Omit shares to withdraw everything the account holds
  • set_treasury_rebalance_manager (builds unsigned XDR) - Build an UNSIGNED XDR handing the RebalanceManager role to a new address. Only the vault's current Manager can sign it - the same door that grants Nirium the role also revokes it. On mainnet: invite-only (institutional key).
  • build_treasury_rebalance (builds unsigned XDR) - Build an UNSIGNED rebalance XDR, Unwind/Invest between a vault's own strategies only; no other instruction is expressible, and none takes a destination address. On mainnet: invite-only (institutional key).
  • submit_treasury_tx - Broadcast a treasury XDR you already signed (deploy/deposit/withdraw/rebalance/set-rebalance-manager) and wait for confirmation
  • execute_treasury_rebalance (Nirium signs, invite-only) - Sign and submit a rebalance with Nirium's OWN RebalanceManager key, server-side, and wait for confirmation - the only treasury tool that signs anything itself, and it still cannot withdraw funds. This is invite-only while a specific legal question stays open: whether executing on a client's behalf without taking custody still counts as regulated facilitation under Mexican law. Only available where that key actually lives; a receive-only mainnet box returns 501 by design, not a broken 500

Environment variables

Variable Required Purpose
AGENT_API_URL No (defaults to http://127.0.0.1:3002) Nirium agent API base URL
STELLAR_SECRET_KEY For paid tools Funds x402 and MPP payments
NIRIUM_API_KEY For start_loop/stop_loop Agent API key from nirium.xyz/keys
STELLAR_NETWORK No (defaults to testnet) testnet or mainnet
NIRIUM_MCP_TREASURY No (off by default) 1 loads the eleven treasury tools, on testnet only
SOROBAN_RPC_URL Yes on mainnet Soroban RPC endpoint. Testnet falls back to the public one; mainnet has no open public RPC, so paid tools stay disabled until you set this. Providers

A note on anchoring

anchor_audit_record is tamper-evident, not tamper-proof: anyone can check later whether the data still matches its CID, but nothing stops someone from changing a copy. The anchoredAt time comes from the Nirium node's clock, not from a trusted timestamp. It is not notarization and carries no legal presumption of authenticity.

Put the context inside the record. What settles a dispute is what the payment or action was for: the order or quote id, amount, asset, who approved it, the request served. Put that inside record. Only what is inside the record is covered by its hash and by the signature; txHash, network and tag are node metadata, outside it.

Sign it (sign: true). With sign: true the tool signs nirium-audit-v1:<content_sha256> with the server's STELLAR_SECRET_KEY, so the receipt says which key declared it, and npx nirium-cli verify shows SIGNATURE: VALID. agentId adds a label (max 64 characters). It is off by default because it publishes that public key with the receipt. Without STELLAR_SECRET_KEY the call anchors nothing and says why, and if the node does not confirm the same key in attestedBy the tool returns an error instead of an unsigned receipt.

{ "record": { "order": "A-12", "amount": "0.05", "asset": "USDC", "approvedBy": "policy-v1" }, "sign": true, "agentId": "my-agent" }

Live check, 29 Nov 2026, testnet: a signed call through the tool anchored QmSP1XGuFL2sgULzugG3YjREfegdAjRzaKyTcK5bamkhTe; npx nirium-cli verify gives HASH: MATCH, SIGNATURE: VALID and VERIFICATION PASSED. A Nirium self-test, not third-party use.

Anchor a hash of your data rather than the data itself. Nobody can guarantee that something is deleted from IPFS (anyone with the CID may have kept a copy), so raw personal data could outlive any erasure request.

Run from source

git clone https://github.com/nirium-protocol/nirium
cd nirium/packages/mcp
npm install
STELLAR_SECRET_KEY=S... AGENT_API_URL=http://localhost:3002 npx tsx src/index.ts

viem is a required (non-optional) peer dependency of mppx, which this package depends on - it's listed here as a direct dependency so a plain npm install resolves it without an extra manual npm i viem step.

License

Apache-2.0 - see LICENSE.