Skip to main content

FastMCP server wrapping Ankr Advanced API

Project description

Web3 MCP

Tests codecov PyPI version

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.

Features

  • 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:

# Required
export ANKR_ENDPOINT="your_ankr_rpc_endpoint"

# Optional but recommended for authenticated requests
export ANKR_PRIVATE_KEY="your_private_key"

Usage

Running the server

from web3_mcp.server import init_server

# Initialize MCP server
mcp = init_server(
    name="Ankr MCP",
    endpoint="your_ankr_endpoint",  # Optional, defaults to ANKR_ENDPOINT env var
    private_key="your_private_key"  # Optional, defaults to ANKR_PRIVATE_KEY env var
)

# Run server
mcp.run()

Using with FastMCP CLI

# Set environment variables first
export 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
  • get_currencies: Get available currencies
  • get_token_price: Get token price information
  • get_token_holders: Get token holders
  • get_token_holders_count: Get token holders count
  • get_token_transfers: Get token transfer history

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

web3_mcp-0.1.5.tar.gz (83.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

web3_mcp-0.1.5-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file web3_mcp-0.1.5.tar.gz.

File metadata

  • Download URL: web3_mcp-0.1.5.tar.gz
  • Upload date:
  • Size: 83.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for web3_mcp-0.1.5.tar.gz
Algorithm Hash digest
SHA256 87149de1618bb47ab1ec21a7089bf8843cd286aa8215da065dd8878a5be2ad09
MD5 873ca4c1b8c091ada1d178233b798d70
BLAKE2b-256 b7c3a1383be331f8c8899f1d4a2b898e475bc3b17ae9d6c8c9100335b0eb12b5

See more details on using hashes here.

File details

Details for the file web3_mcp-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: web3_mcp-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for web3_mcp-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 534ca178f943564474453f7b941a03cbe52083a05565062ea0df9c32c2c99fb9
MD5 d243cdd5c75bf841554f3e04c4b111ef
BLAKE2b-256 59c69e427b17895bcba128baff28a2c6ac4fbd8167ebe915a4645d559499283f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page