For AI agents: an LLM-friendly Markdown version of every page is available by appending .md to its URL or by sending an Accept: text/markdown request header. The full documentation index is at https://www.ankr.com/docs/llms.txt
Skip to main content

Quickstart

Five minutes: get a key, install the server, ask a question, read a decoded answer. Everything on this page was run against production; the responses are what the tools actually returned.

1. Get an API key

Create a project in the Web3 API platform and copy its key. If you have not made one before, Premium: basics walks through it.

The key you already use for rpc.ankr.com is the same key. There is no separate agent plan, and no keyless trial.

2. Install the server

Claude Code

claude mcp add --transport http ankr-agent-rpc https://mcp.ankr.com/rpc \
--header "x-ankr-api-key: <YOUR_KEY>"

Run /mcp to confirm it connected.

Cursor

Install in Cursor opens Cursor and adds the server for you. It lands with the key placeholder YOUR_ANKR_API_KEY, so replace that in mcp.json before the first call.

To do it by hand, add to .cursor/mcp.json in your project:

{
"mcpServers": {
"ankr-agent-rpc": {
"url": "https://mcp.ankr.com/rpc",
"headers": { "x-ankr-api-key": "<YOUR_KEY>" }
}
}
}

VS Code

One command, which registers the server in your VS Code user profile, so every workspace sees it:

code --add-mcp '{"name":"ankr-agent-rpc","type":"http","url":"https://mcp.ankr.com/rpc","headers":{"x-ankr-api-key":"<YOUR_KEY>"}}'

For one workspace only, and to keep the key out of a checked-in file, add it to .vscode/mcp.json and prompt for it:

{
"servers": {
"ankr-agent-rpc": {
"type": "http",
"url": "https://mcp.ankr.com/rpc",
"headers": { "x-ankr-api-key": "${input:ankr-api-key}" }
}
},
"inputs": [
{ "id": "ankr-api-key", "type": "promptString", "description": "Ankr API key", "password": true }
]
}

A connected server advertises seventeen tools. Other clients and a local stdio install are covered in Agent RPC MCP.

3. Ask it something

Give your agent a transaction hash and a plain question:

What happened in transaction 0x3fe1022b421843ffa01e84de3eac55250884632c8bee8223e8046a53cab52dc1 on Ethereum?

The agent calls getTransaction, and the receipt comes back with its three event logs already decoded:

"logs": [
{
"contract": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"event": "Transfer",
"args": {
"from": "0xE0554a476A092703abdB3Ef35c80e0D76d32939F",
"to": "0x51C72848c68a965f66FA7a88855F9f7784502a7F",
"value": "5361755468498169704"
}
},
{
"contract": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"event": "Transfer",
"args": {
"from": "0x51C72848c68a965f66FA7a88855F9f7784502a7F",
"to": "0xE0554a476A092703abdB3Ef35c80e0D76d32939F",
"value": "10135766960"
}
},
{
"contract": "0xE0554a476A092703abdB3Ef35c80e0D76d32939F",
"event": "Swap",
"args": {
"amount0": "10135766960",
"amount1": "-5361755468498169704",
"sender": "0x51C72848c68a965f66FA7a88855F9f7784502a7F",
"recipient": "0x51C72848c68a965f66FA7a88855F9f7784502a7F",
"liquidity": "807071352538624856",
"sqrtPriceX96": "1822064612100005028843788509273659",
"tick": "200873"
}
}
]

Named events, named arguments, decimal numbers. No ABI lookup, no topics[0] arithmetic, no hex.

4. Read the numbers correctly

The amounts above are raw base units. 10135766960 is not ten billion dollars. Ask the chain for the token's decimals:

How many decimals does 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 use?

resolveContract answers:

{
"isContract": true,
"token": {
"standard": "ERC-20",
"name": "USD Coin",
"symbol": "USDC",
"decimals": 6
}
}

Six decimals, so 10135766960 is 10,135.77 USDC, and the 18-decimal counterpart is 5.3618 WETH. The transaction is a swap: the pool took USDC in and paid WETH out.

This is the single most common way to get an agent's answer wrong, which is why the decimals lookup is its own tool rather than an assumption.

5. What it cost

Each result reports what it actually did:

"_meta": { "token_count": 949, "tier": 2 }

token_count is a real count of the text emitted, not an estimate, so the agent can budget its own context. tier is the compression TORPC applied: tier 2 means full ABI decode. It is negotiated per call and can come back lower on a large response, so read it rather than assuming it.

For comparison, the same receipt fetched as ordinary JSON-RPC is 3,182 bytes of hex; at tier 2 it is 1,177, a 63% reduction, measured against production.

6. Three more things to try

  • A wallet's position. "What does 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 hold on Ethereum?" calls getBalances, which returns native and ERC-20 balances with USD value, ranked by value, with the tail behind a cursor. Assets the indexer has no price for are reported as unknown, never as zero. Pass a 0x address rather than an ENS name if you want the native balance read straight from the chain.
  • Whether your key may call something. "Can I call eth_getLogs on Ethereum with this key?" calls describeMethods with probe: true, which asks the endpoint rather than guessing, and answers for your key, your tenant, and that chain's schema.
  • An escape hatch read. Anything the routed tools do not cover (eth_call, trace_*, debug_trace*, and the non-EVM equivalents) goes through rpcCall, on any chain Ankr serves.

7. Without an agent

The compression is not tied to MCP. One header on a normal request:

curl -s https://rpc.ankr.com/eth/$ANKR_API_KEY \
-H 'Content-Type: application/json' \
-H 'Accept-Token-Tier: 2' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionReceipt","params":["0x3fe1022b421843ffa01e84de3eac55250884632c8bee8223e8046a53cab52dc1"]}'

The response carries Token-Tier: 2 and the same decoded logs. See TORPC.

Next