home / mcp / aapi mcp server

AAPI MCP Server

Provides access to Ankr Advanced APIs to fetch balances and token prices across major blockchains.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "asphere-xyz-aapi-mcp-server": {
      "url": "https://aapi-mcp-server.asphere.network/{ANKR-API-KEY}/sse",
      "headers": {
        "ANKR_API_KEY": "<YOUR_KEY>"
      }
    }
  }
}

You can access Ankr's Advanced APIs through this MCP server to fetch balances, token prices, and other blockchain data across many networks. This server lets you run commands locally or connect remotely, enabling AI models to query data as part of your workflows.

How to use

Connect to the MCP server to start querying balances and prices. You can use either a remote HTTP MCP endpoint or a local stdio-based MCP server. Once connected, you can request: 1) token balances for addresses or ENS names across multiple chains, and 2) current token prices for native coins or ERC20 tokens on supported blockchains.

Key capabilities include getting account balances across multiple blockchains and retrieving token prices for tokens on specific networks. You provide an address or ENS name and, optionally, a list of blockchains to restrict the query. For token prices, you specify the blockchain and, if needed, the token contract address. These tools help you assemble data for dashboards, analytics, or on-demand AI reasoning.

How to install

Prerequisites you need before starting:

  • Node.js installed on your system
  • pnpm installed globally (npm i -g pnpm)

Step-by-step setup and run for the MCP server locally and remotely.

pnpm i

export ANKR_API_KEY="YOUR-ANKR-KEY"
pnpm dev:sse

Additional setup and configurations

This MCP server supports both a remote HTTP endpoint and a local stdio-based server. Use the following configurations to connect from your MCP client.

"mcpServers": {
  "aapi": {
    "command": "npx",
    "args": ["-y", "@asphere/aapi-mcp-server"],
    "env": {
      "ANKR_API_KEY": "<YOUR_KEY>"
    }
  }
}

Security and deployment notes

When using the remote MCP server, include your Ankr API key in the URL path as shown. For local development, keep your API key in environment variables and do not expose it in client-side code.

If you deploy the remote service, ensure your MCP clients point to the remote URL and include the required API key in their request path to authenticate with the Ankr Advanced API.

Troubleshooting tips

If you cannot reach the MCP server, verify your API key is correct, the server URL is accessible, and your client is configured to use the correct path for sse connections.

Check that the server is running and listening on the expected port when using the local setup, and ensure your environment variable ANKR_API_KEY is set in your process environment.

Available tools

getAccountBalance

Fetch token balances across multiple blockchains for a given address or ENS name. You can specify which blockchains to query; if omitted, all supported chains are checked.

getTokenPrice

Get current price for a token (native or ERC20) on a chosen blockchain. You provide the blockchain and, optionally, the token contract address; leave the contract address empty to get the native coin price.