You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An MCP server implementation wrapping Ankr Advanced API.
Overview
FastMCP is a Model Context Protocol (MCP) server that provides access to Ankr's Advanced API for blockchain data. It allows LLMs to interact with blockchain data across multiple chains including Ethereum, BSC, Polygon, Avalanche, and more.
Complete wrapper for all Ankr Advanced API endpoints
NFT API: Get NFT metadata, holders, transfers, and ownership information
Query API: Access blockchain statistics, blocks, logs, and transaction data
Token API: Get token balances, prices, holders, and transfer history
Support for multiple blockchain networks
Installation
# Clone the repository
git clone https://github.com/tumf/web3-mcp.git
cd web3-mcp
# Install with uv
uv pip install -e .
Configuration
Set the following environment variables:
# Requiredexport ANKR_ENDPOINT="your_ankr_rpc_endpoint"# Optional but recommended for authenticated requestsexport ANKR_PRIVATE_KEY="your_private_key"
Usage
Running the server
fromweb3_mcp.serverimportinit_server# Initialize MCP servermcp=init_server(
name="Ankr MCP",
endpoint="your_ankr_endpoint", # Optional, defaults to ANKR_ENDPOINT env varprivate_key="your_private_key"# Optional, defaults to ANKR_PRIVATE_KEY env var
)
# Run servermcp.run()
Using with FastMCP CLI
# Set environment variables firstexport ANKR_ENDPOINT="your_ankr_endpoint"export ANKR_PRIVATE_KEY="your_private_key"# Run the server
python -m web3_mcp
API Categories
NFT API
get_nfts_by_owner: Get NFTs owned by a wallet address
get_nft_metadata: Get metadata for a specific NFT
get_nft_holders: Get holders of a specific NFT collection
get_nft_transfers: Get transfer history for NFTs
Query API
get_blockchain_stats: Get blockchain statistics
get_blocks: Get blocks information
get_logs: Get blockchain logs
get_transactions_by_hash: Get transactions by hash
get_transactions_by_address: Get transactions by address
get_interactions: Get wallet interactions with contracts
Token API
get_account_balance: Get token balances for a wallet