Skip to content

MCP for agents

Let agents manage their own budget

InferMesh runs a Model Context Protocol server so autonomous agents can check their balance, estimate costs and request funding — within limits their owner signed on-chain.

Endpoint

URLhttps://infermesh.dev/v1/mcp
TransportStreamable HTTP (POST, JSON responses, stateless — no session id required)
Protocol versions2025-06-18, 2025-03-26, 2024-11-05
AuthAuthorization: Bearer sk-infer-YOUR_KEY — the key needs the mcp scope
claude mcp add --transport http infermesh https://infermesh.dev/v1/mcp \
  --header "Authorization: Bearer sk-infer-YOUR_KEY"

Tools

ToolAccessWhat it does
get_balanceReadSpendable credits, reserved amount, per-source buckets, tier and the key's spend ceiling.
get_usageReadRequests, tokens, spend and latency over 1h, 24h, 7d or 30d, by model.
list_modelsReadAvailable models with list prices and context windows; filter by lab or capability.
estimate_costReadExact credit cost for given input/output token counts, including the key's gateway fee.
get_topup_policyRead · agent keysThreshold, top-up amount, daily limits and recent top-ups from the agent's vault.
set_low_balance_thresholdWrite · agent keysChange the balance below which an automatic top-up triggers (up to the daily spend limit).
request_topupWrite · agent keysQueue one top-up of the configured amount, paid on-chain from the agent's USDC vault.
get_gateway_statusReadConfigured providers and recent route health.

Agent-only tools require a key that belongs to an agent created on the Agents page; called with a regular key they return an explanatory tool error.

How agent funding works

  1. You create an agent. It gets an isolated credit balance, an API key capped at its daily spend limit, and a fresh session keypair held encrypted by InferMesh.
  2. You sign one transaction that creates the agent's USDC vault on Solana and registers the session key with two hard limits: the maximum per top-up and the maximum per day.
  3. When the agent's balance drops below its threshold (or it calls request_topup), the session key moves USDC from the vault to the protocol and the agent's balance is credited. A relayer pays the network fee, so agents never need SOL.
  4. You can withdraw, change limits, pause, or revoke the session key and close the vault at any time.

What the session key can't do

It cannot send USDC anywhere except into the agent's own credit balance, cannot exceed the per-top-up or daily caps enforced by the program, and stops working the moment you revoke it on-chain.

REST helpers

Agents that don't speak MCP can poll these with the same key:

curl https://infermesh.dev/v1/mcp/balance -H "Authorization: Bearer sk-infer-YOUR_KEY"
curl https://infermesh.dev/v1/mcp/status  -H "Authorization: Bearer sk-infer-YOUR_KEY"
  • /v1/mcp/balance returns the balance, the threshold and whether the agent is below it.
  • /v1/mcp/status adds the full policy, today's top-up count, recent top-ups and gateway health.