Skip to main content
@routemesh/mcp is a local MCP server that lets AI coding agents query blockchain data through RouteMesh. Configure it once and your agent gets cross-chain RPC tools — blocks, transactions, logs, balances, fees — live service pricing, plus optional tools to view your RouteMesh account balance, inspect usage, and manage your API keys.
  • Query 1000+ EVM chains from one server — no per-chain endpoint config.
  • Read-only on-chain tools, plus a generic rpc_call escape hatch for any JSON-RPC method.
  • Automatic failover: requests retry against lb2.routeme.sh when lb.routeme.sh returns retryable errors.
  • Every result carries the X-Batch-Id correlation id, so you can trace requests in the Logs page.

How it works

The server runs locally as a stdio process spawned by your MCP client (Cursor, Claude Desktop, VS Code, or any other stdio MCP client). It keeps no state and runs no background services:
  • RPC tools send JSON-RPC to POST /rpc/{chain_id}/{api_key}, using your ROUTEMESH_API_KEY in the URL path.
  • Customer tools (usage and API keys) call https://api.routeme.sh with a customer management token in the X-Api-Key header. They are only exposed when the ROUTEMESH_MGMT_TOKEN env var is set.
  • On retryable failures (HTTP 429 or 5xx, timeouts, network errors), the server retries with exponential backoff, alternating between the primary and backup load balancers.
The dedicated on-chain query tools read blockchain data; rpc_call forwards the method you supply. The customer tools can create and update API keys, so use a dedicated management token for them.

Prerequisites

  • Node.js 20 or later
  • A RouteMesh API key — see Quick Start
  • A customer management token — optional, only needed for account balance, usage, and key management

Setup

Configure your MCP client

In Cursor, add the following to ~/.cursor/mcp.json:
Any stdio MCP client uses the same shape: command npx, args -y @routemesh/mcp, and the environment variables below. In Claude Desktop, this goes in claude_desktop_config.json.

Environment variables

The defaults work for all RouteMesh customers — in most setups you only need ROUTEMESH_API_KEY.

Tools

Pricing tools

The pricing MCP tools are included in the source for version 1.2.0; npm publication is pending. Until that release is available, use the public HTTP pricing endpoints below or build the MCP server from source. Account balance, usage, and provider tools are already available in published releases.
These tools use public pricing endpoints and do not need a management token. The MCP process still needs the RPC API key in the setup above. Prices are in USD for the RouteMesh service, separate from blockchain gas fees. Results contain currency, unit, and items. An empty list means no matching published price; it does not mean free service. These are current published prices, not account-specific discount quotes. HTTP 429 and 503 are returned as tool errors. See AI agents and automation for direct HTTP examples.

RPC tools

Always available. chainId is the numeric EVM chain ID (e.g. 1 for Ethereum mainnet, 8453 for Base). Use rpc_list_chains to discover chains by name or ID.

Customer tools

Exposed only when ROUTEMESH_MGMT_TOKEN is set.

get_usage parameters

  • from / to — RFC3339 window (e.g. 2026-06-01T00:00:00Z). Defaults: last 30 days up to now; max span 90 days.
  • include — sections to return: summary, balance, by_chain, by_api_key, by_api_key_chain, top_methods, time_series, by_scenario. Default: summary, balance.
  • groupBy — flat grouped rows instead of sections: chain, api_key, api_key,chain, method, day. Overrides include.
  • chainId / apiKeyId — filter to one chain or one API key.
  • granularity — day or hour for time_series (default day).
  • limit — max rows for top_methods and groupBy (default 20, max 100).

Provider tools

Exposed when ROUTEMESH_MGMT_TOKEN is set and the token’s customer is linked to a provider. These tools mirror the provider management endpoints in the API Reference and authenticate the same way, sending the token in the X-Api-Key header. Scoping matches the API endpoints: a token whose customer is not linked to a provider returns 403 (provider not resolved), and resources owned by another provider return 404 (existence is not leaked). Call them only with a provider-linked management token. Node upserts screen endpoints before persisting: URLs must be public http(s) or wss:// (loopback, private, and link-local hosts are rejected up front). A failed mandatory screening returns 400; a URL owned by another provider returns 404; a URL already registered to a different plan of the same provider returns 409. Endpoint-level behavior and error codes are in the API Reference.

Management tokens

Customer tools authenticate with a customer management token. Create one in the dashboard:
  1. Open Mgmt Tokens.
  2. Click New Token and give it a label (e.g. mcp-cursor).
  3. Copy the secret — it is shown only once.
Customer management tokens are scoped to your account’s management routes and, for a provider-linked token, the provider routes — and nothing else. Use a dedicated token for the MCP server so you can revoke it independently if it leaks. Add "ROUTEMESH_MGMT_TOKEN": "your_customer_management_token" alongside ROUTEMESH_API_KEY in the MCP client environment, then restart the MCP server to expose customer tools.

Example prompts

  • “Compare economy and performance eth_call prices on Base.”
  • “What is the price per million newHeads notifications on Ethereum?”
  • “List chains that match base and show me their chain IDs.”
  • “Get the latest block on BSC and summarize the timestamp and transaction count.”
  • “Fetch the receipt for tx 0x... on Ethereum and tell me if it succeeded.”
  • “Get logs for contract 0x... on Arbitrum between blocks 1000000 and 1050000.”
  • “Estimate gas for calling this method on Base with these parameters.”
  • “Run eth_getCode for address 0x... on Base (chain 8453).”
  • “Show my RouteMesh usage for the last 7 days broken down by chain.”
  • “What is my current RouteMesh balance and request count this month?”

Errors and debugging

  • Tools return structured JSON. RPC errors from the router are passed through unchanged — interpret error.code with RPC error codes.
  • Retryable HTTP failures (429, 5xx, timeouts) are retried automatically up to ROUTEMESH_RETRY_ATTEMPTS.
  • Every RPC result includes the batchId from the X-Batch-Id response header. Use it in the Logs page exactly as you would for direct RPC calls — see Debugging.
  • eth_getLogs limits apply to rpc_get_logs exactly as they do to direct requests.

Next steps

  • Quick Start — Get an API key and make your first request.
  • Request behavior — Cooldowns, 429s, and batch requests.
  • Debugging — Use X-Batch-Id and the Logs page when something goes wrong.