@aioum/mcp

Mirrored from packages/mcp/README.md in the repository — edit that file, not this page.

An MCP server that exposes AIOUM marketplace services as tools to any MCP client — Claude Desktop, an agent framework, the OpenAI/Anthropic tool loop. When the client calls a tool, this server pays for and invokes the underlying AIOUM service through a budget-capped agent (@aioum/sdk): pay-per-call, no API keys, and the agent can never spend past its budget.

It also serves the management tools (aioum_status, aioum_agents, aioum_stake_delegate, …): everything the app can do, driven from Claude. They follow the same contract as the aioum CLI (the AIOUMControl layer in @aioum/sdk) and read the same AIOUM_* environment. See Management tools.

How it works

  • tools/list → discovers the network's services and maps each to an MCP tool (aioum_<id>__<tool>), with price + reputation in the description. No on-chain setup needed to list.
  • tools/call → lazily authorizes a budget-capped session key (once), then opens a session, signs a per-call voucher, invokes the tool, and settles on-chain — returning the result plus the amount paid and budget remaining.

Use with Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "aioum": {
      "command": "npx",
      "args": ["-y", "@aioum/mcp"],
      "env": {
        "OWNER_KEY": "0x<owner private key>",
        "AIOUM_BUDGET": "10 USDC",
        "DEPLOYMENTS": "/abs/path/to/deployments.json",
        "AIOUM_PRIVATE_KEY": "0x<your wallet key, for staking and the jury>",
        "AIOUM_OWNER": "claude",
        "AIOUM_INDEXER_URL": "http://127.0.0.1:8549",
        "AIOUM_AGENTS_URL": "http://127.0.0.1:8770/runner",
        "AIOUM_MULTINODE_URL": "http://127.0.0.1:8556",
        "AIOUM_PRIVATE_NODE_URL": "http://127.0.0.1:8770"
      }
    }
  }
}

Claude can now call AIOUM services as tools; each call is paid automatically, capped by AIOUM_BUDGET. Every AIOUM_*_URL above is its default, so on a local stack only the keys and DEPLOYMENTS are needed; leave DEPLOYMENTS out and the server still starts, with the management tools that need no chain.

Use with Claude Code

claude mcp add aioum \
  -e OWNER_KEY=0x… -e AIOUM_BUDGET="10 USDC" -e DEPLOYMENTS=/abs/path/to/deployments.json \
  -e AIOUM_PRIVATE_KEY=0x… -e AIOUM_OWNER=claude \
  -- npx -y @aioum/mcp

or, checked into a project as .mcp.json:

{
  "mcpServers": {
    "aioum": {
      "command": "npx",
      "args": ["-y", "@aioum/mcp"],
      "env": { "DEPLOYMENTS": "./offchain/deployments.json", "AIOUM_OWNER": "claude" }
    }
  }
}

(keys go in your shell environment, not the file: OWNER_KEY, AIOUM_PRIVATE_KEY and AIOUM_PRIVATE_NODE_TOKEN are read from the server's environment too.)

Configuration (env)

VarPurpose
OWNER_KEYOwner EOA private key (funds + authorizes the budget-capped session key). Required for paid calls unless a session key is supplied.
SESSION_KEY + SMART_ACCOUNTSession mode: a session key already authorized on a smart account (from the app's Deploy Agents page, or createAgent elsewhere). The server then needs no owner key and can spend at most the key's remaining cap until it expires; renewal happens in the owner wallet, not here.
AIOUM_BUDGETBudget cap, e.g. "10 USDC". Default 10 USDC. The server can never spend more.
AIOUM_EXPIRESSession-key lifetime, e.g. "24h". Default 24h.
AIOUM_AUTO_RENEW1 (default) auto-re-authorizes a fresh session key when the current one expires; 0 fails paid calls loudly instead.
AIOUM_RENEW_SKEW_SECONDSRe-authorize this many seconds before expiry so a call never lands on a just-lapsed key. Default 60.
DEPLOYMENTSPath to a deployments.json (the network's, or your local development network's). Otherwise set AIOUM_CHAIN_ID, AIOUM_RPC_URL, AIOUM_NODE_URL, AIOUM_BUNDLER_URL, and the AIOUM_* contract addresses.
NODE_TOKENBearer token for a token-gated node, if any.
AIOUM_MINTLocal development network: 1 to mint mock USDC to the owner before setup.

Session-key expiry

A session key is deliberately short-lived (AIOUM_EXPIRES). Past expiry, every paid call would fail until the owner re-authorizes. This server handles that automatically: before each call it re-authorizes a fresh budget-capped key if the current one is within AIOUM_RENEW_SKEW_SECONDS of expiry, and it retries once if a key lapses mid-flight. Set AIOUM_AUTO_RENEW=0 to opt out and surface expiry as an error (e.g. if a human should re-approve the budget each period).

Management tools

One tool per AIOUMControl method, all prefixed aioum_. Each returns a short summary line and a ```json block with the structured payload; a failure comes back as an MCP error with one readable line. Tools marked signs send a transaction from AIOUM_PRIVATE_KEY; tools marked spends cost money on the runner's or the node's side. The environment each group needs is in the heading (every URL has a local default, listed under Environment).

Monitor (indexer, agent runner, node URLs; AIOUM_DEPLOYMENTS for balances)

ToolWhat it does
aioum_statusProbe every part of the stack (including the deposit service: its mode, chain and fee) and report who can plan assistants.
aioum_plannersThe planner listings on the marketplace (any node can run one; paid per planning turn), whether the runner has a key or local model of its own, and the model catalogue: every model a person could plan with, available now or with why not (catalogue[]: model, family, tier, via, available, why).
aioum_activityThe runner's totals and its latest runs (limit).
aioum_walletBalances of the runner's wallet and, with AIOUM_PRIVATE_KEY, yours.

Deposits (AIOUM_DEPOSITS_URL; AIOUM_DEPLOYMENTS + AIOUM_PRIVATE_KEY derive the AI wallet, or pass wallet; the key signs a send)

Fund the AI wallet from any chain: whatever is sent to its deposit address, in any asset, arrives here as USDC and is swept to the wallet, less the fee the quote states. amount is in the asset's own units ("0.5" ETH); the token's decimals come from aioum_deposit_tokens (18 when unknown).

ToolWhat it does
aioum_deposit_addressThe deposit address, the AI wallet, the chain, the fee, whether the forwarder is deployed, and the service's mode: route where the route provider delivers, direct elsewhere (the local development network among them), where USDC sent to the address is swept to the wallet and nothing else is offered (wallet).
aioum_deposit_chainsChains a deposit can route from. On a direct network the service answers 501 with one sentence: "Routes from other chains deliver to Base; on this network send USDC to your deposit address and it is swept to your AI wallet"; aioum_deposit_tokens and aioum_deposit_quote say the same there.
aioum_deposit_tokensAssets on a chain, with addresses and decimals (chain, q, limit).
aioum_deposit_quoteWhat an amount arrives as: USDC out, the fee, the credit, the route and its time; nothing sent (chain, token, amount, wallet, fromAddress).
aioum_deposit_sendQuote, then send from your wallet on the source chain (an approval for a token, then the route transaction) and record the deposit (chain, token, amount, wallet). Signs on the source chain and spends the asset.
aioum_deposit_listThe wallet's deposits with refreshed statuses (wallet).
aioum_deposit_statusOne deposit (id).
aioum_deposit_sweepForward the USDC that has arrived at the deposit address to the wallet now, less the fee; the service's sweeper sends it. The path that works on every network (wallet).
aioum_deposit_card_partnersPay by card: the on-ramp partners the deposit service has keys for, how each reports delivery, its fee, and whether this network can take a card payment (partners deliver USDC on Base).
aioum_deposit_cardPay by card: a partner's link that delivers USDC to the deposit address, tracked as a deposit (partner, wallet); the person pays on the partner's page.

Market (AIOUM_INDEXER_URL, AIOUM_AGENTS_URL)

ToolWhat it does
aioum_servicesSearch services by words, category and liveness (q, category, liveOnly, limit).
aioum_serviceOne service in full (serviceId).
aioum_operatorAn operator's stake, reputation and listings (address).
aioum_review_requestAsk the runner to review a listing (serviceId, or nodeUrl and key): each tool called with its sample input, the result judged; waits for the end by default (wait, timeoutSeconds); budgetUsdc: a budget of your own, signed by your wallet. One request per listing per day.
aioum_review_statusA listing's latest review (serviceId): the line, the scores by tool, latency, the price charged, the judge's reasons, when and by whom, what to fix.
aioum_toolsThe tools an agent can pay for right now, with their arguments (q, refresh).
aioum_refresh_indexMake the indexer re-read the chain and re-probe the nodes.

Agents (AIOUM_AGENTS_URL, AIOUM_OWNER)

ToolWhat it does
aioum_agentsList your agents (owner).
aioum_agent_getOne agent in full (id).
aioum_superPrompt first: prompt and budgetUsdc (the budget you are willing to spend) become a Super Agent, fully loose on services, skills and data, pay in any token, the best live planner (said back with why), with a project whose stages that planner proposes; started unless start is false; planner picks one yourself. Spends from that budget.
aioum_agent_createCreate an agent from a spec, optionally copying a starter first (spec.budget with both caps is required; a starter carries none). The spec's fields: name, description, instructions, mode, planner, plannerService, plannerModel (with anthropic or openai: the model the runner's key or local endpoint plans with), tools, access, deny, skills, skillsAccess, data (memory, files), dataAccess, steps, outputTemplate, budget, schedule, payAcross (pay in any token, default true).
aioum_agent_updateChange an agent's fields (id, spec).
aioum_agent_deleteDelete an agent (id).
aioum_agent_runRun an agent and wait for the result, spend and receipts (id, input, timeoutSeconds, default 300). Spends from the agent's budget.
aioum_agent_schedulePut an agent on a timer or switch it off (id, everyMinutes, input, enabled).
aioum_agent_publishList an agent as a paid service (id, priceUsdc, stakeZai). The runner stakes ZAI.
aioum_agent_unpublishTake that listing down (id).
aioum_runsRecent runs (agentId, limit).
aioum_run_getA run's full log: steps, paid calls, receipts, output (runId).
aioum_run_stopStop a run (runId).
aioum_run_watchWatch a run as it happens: every step with what the agent is doing, which service, what it cost and the media it made, then how it ended and its spend per service (runId, timeoutSeconds default 300, from to skip steps already seen).
aioum_spendWhat a run, an agent or a project spent per service: runId, or agentId / projectId with period (24h default, 7d, all; a per-day line too).
aioum_startersThe ready-made agents and pipelines you can start from (kind: agent, pipeline or all), each resolved against what is live, with what it still needs.
aioum_pipeline_createCreate a pipeline (id) with the budgets you set (budgetUsdc, the project's cap; agentBudgetsUsdc, a cap per agent key): its agents in hiring order (the hired ones published as listings), its project on the lead; input is the brief, start runs it now and turns on the lead's schedule (spends). Refused with the missing parts named.
aioum_skillsThe skills an agent can load: the open-source index (repo, commit, licence) and skills listed on nodes, per use or one-time (q, category, tag, limit); give the ids to aioum_agent_create as skills.

Projects (AIOUM_AGENTS_URL, AIOUM_OWNER): a brief that outlives one run. One brief, one budget and stages in order; each stage is a run of the same agent that gets the stage's instruction plus what every earlier stage produced, and may spend what is left of the project's budget. Links and workspace paths its tools returned are collected as the stage's artifacts. A failed stage pauses the project; change the stages still to run and resume.

ToolWhat it does
aioum_project_listYour projects, or one agent's (owner, agentId).
aioum_project_getOne project in full: every stage, its run, spend, output and links (id).
aioum_project_createCreate a project as a draft (agentId, brief, budgetUsdc (required, yours), title, stages: a list of { title?, instruction } or plain strings, or "auto" to let the agent's planner propose 3 to 8; a planner listing is paid one turn, a run of kind plan on the agent).
aioum_project_startRun the stages not done yet and wait until it stops (id, wait default true, timeoutSeconds default 600). Spends from the project's budget.
aioum_project_pauseLet the running stage finish, then stop before the next (id).
aioum_project_resumeContinue from the first stage not done; a failed stage runs again (id, wait, timeoutSeconds). Spends.
aioum_project_stagesReplace the stages still to run and/or the budget; done stages stay (id, stages, budgetUsdc).
aioum_project_optimizeThe workflow optimizer: the profile, the planned changes with gain and evidence, the measured and predicted time and cost; apply writes the safe ones to the stages that are not done, again makes a draft copy with them written in (id, apply, again).
aioum_project_deleteDelete a project; a running stage is stopped, its runs stay (id).

Sell (AIOUM_MULTINODE_URL, AIOUM_NODE_TOKEN when the node's admin API is token-gated)

ToolWhat it does
aioum_sell_templatesBrowse the service templates (q).
aioum_sell_configAssemble a services.json from templates, with the env it needs (names).
aioum_sell_previewTry a spec's tool on your node before listing it (spec, tool, args, env).
aioum_sell_addList a service from a spec or a template with price, stake and env overrides; pricingMax lets the node raise the price with demand up to that and lower it back. The node stakes ZAI.
aioum_sell_skillSell a skill: the folder with SKILL.md goes on your node and is listed, per use (every load is a paid call) or one-time (an agent pays once and keeps it); dir (a folder here, uploaded), files or nodeDir; mode, price; name, description, category, key, stake. The node stakes ZAI.
aioum_sell_listWhat your node serves now.
aioum_sell_removeDelist a service (key).
aioum_sell_verify_domainProve a listing is first-party (domain): the DNS TXT record or /.well-known/aioum.json to add for your node's operator, and whether it is there now.

Stake (AIOUM_DEPLOYMENTS, AIOUM_RPC_URL; AIOUM_PRIVATE_KEY to sign)

ToolWhat it does
aioum_stake_operatorsOperators you could back, with stake, listings and liveness.
aioum_stake_positionsWhat you delegated to each operator and what is claimable.
aioum_stake_delegateBack an operator with ZAI (operator, amountZai). Signs.
aioum_stake_claimClaim the USDC an operator earned for you (operator). Signs.
aioum_stake_unstakeStart taking ZAI back (operator, amountZai). Signs.
aioum_stake_withdrawWithdraw ZAI after the unbonding period (operator). Signs.
aioum_stake_requestAsk the network's staking node to review a listing and put the network's ZAI behind it so it goes live (serviceId; wait, timeoutSeconds). Returns the final state, live, rejected or failed, with the reasons. The node's pool signs, not you.
aioum_stake_requestsBacking requests on the staking node, newest first (operator, serviceId, state, limit).

Jury (AIOUM_DEPLOYMENTS, AIOUM_RPC_URL; AIOUM_PRIVATE_KEY to sign; salts in ~/.aioum/jury-salts.json)

ToolWhat it does
aioum_jury_statusThe jury's rules and your seat.
aioum_jury_joinTake a seat by staking ZAI (amountZai). Signs.
aioum_jury_casesDisputes with deadlines, votes and your commit/reveal state (limit).
aioum_jury_commitSeal a vote; the salt is saved locally (disputeId, nodeAtFault). Signs.
aioum_jury_revealReveal a sealed vote with its saved salt (disputeId). Signs.
aioum_jury_finalizeClose a dispute after the reveal period (disputeId). Signs.
aioum_jury_escalateEscalate a dispute that missed quorum (disputeId, nodeAtFault). Signs.
aioum_jury_rewardClaim a juror reward (disputeId). Signs.
aioum_jury_leaveStart unstaking from the jury (amountZai). Signs.
aioum_jury_withdrawWithdraw unlocked jury stake. Signs.

Private node (AIOUM_PRIVATE_NODE_URL; AIOUM_PRIVATE_NODE_TOKEN or the node's token file)

ToolWhat it does
aioum_node_statusThe node's health and connected providers.
aioum_node_connectConnect a provider with an API key, or get an OAuth sign-in link (provider, apiKey, baseUrl, header, prefix).
aioum_node_disconnectDisconnect a provider (provider).
aioum_node_toolsThe node's tools.
aioum_node_callCall one of them (tool, args).
aioum_node_memory_addRemember something on the node (text, kind, tags).
aioum_node_memory_listWhat the node remembers.
aioum_node_memory_deleteForget one memory (id).
aioum_node_memory_forget_allWipe every memory.
aioum_node_schedulesThe node's timed jobs.
aioum_node_schedule_createCreate a job (job: name, steps, intervalSeconds, budgetUsd).
aioum_node_schedule_runRun a job now and wait (id). Spends up to the job's budget.
aioum_node_schedule_togglePause or resume a job (id).
aioum_node_schedule_deleteDelete a job (id).
aioum_node_backup_exportWrite an encrypted backup to a file (path, passphrase).
aioum_node_backup_restoreRestore from that file (path, passphrase).

Amounts are decimal strings ("12000" ZAI, "0.05" USDC); every write returns its tx hash(es). The server never returns a private key or token.

Environment for the management tools

VarPurposeDefault
AIOUM_DEPLOYMENTSThe network's deployments.json (addresses, chain id): needed for staking, the jury and balances. DEPLOYMENTS is accepted too; without either, the server looks for ./deployments.json, ./offchain/deployments.json, ../offchain/deployments.json.none (no chain tools)
AIOUM_RPC_URLChain RPC.from deployments, else http://127.0.0.1:8545
AIOUM_PRIVATE_KEYYour wallet, for staking, the jury and balances (OWNER_KEY is used when unset).none (read-only)
AIOUM_OWNERGroups the agents you create.cli
AIOUM_INDEXER_URLThe indexer.http://127.0.0.1:8549
AIOUM_AGENTS_URLYour runner: your own inside your private node, or a shared one.http://127.0.0.1:8770/runner
AIOUM_NODE_URLThe demo node.http://127.0.0.1:8546
AIOUM_MULTINODE_URLThe catalogue node whose admin API lists your services.http://127.0.0.1:8556
AIOUM_NODE_TOKENBearer token for that admin API, if the node has one.none
AIOUM_FACILITATOR_URL, AIOUM_BUNDLER_URLProbed by aioum_status.8547, 8548
AIOUM_PRIVATE_NODE_URLYour private node.http://127.0.0.1:8770
AIOUM_PRIVATE_NODE_TOKENIts bearer token; else the file $PRIVATE_NODE_DIR/token (default ~/.aioum-private/token).the token file
AIOUM_DEPOSITS_URLThe deposit service (aioum_deposit_*): deposits from any chain, credited as USDC.http://127.0.0.1:8551
AIOUM_BACKER_URLThe network's staking node (aioum_stake_request, aioum_stake_requests): reviews a listing and backs it with the network's ZAI.http://127.0.0.1:8552
AIOUM_DEBUG1 logs the resolved config (secrets masked) to stderr at start.off

Run locally

npm install && npm run build
OWNER_KEY=0x... AIOUM_BUDGET="5 USDC" DEPLOYMENTS=../../offchain/deployments.json npm start
# or exercise it as a client:
npm run smoke

License

MIT