Etherscan MCP Python
Provides tools for accessing Ethereum blockchain data including account balances, transactions, blocks, contracts, tokens, gas, logs, and statistics via the Etherscan API.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Etherscan MCP PythonWhat's the ETH balance of 0x742d35Cc6634C0532925a3b844Bc4e6f3aC1b2D7?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Etherscan MCP Python Server
A complete Python implementation of the Etherscan Model Context Protocol (MCP) server, providing comprehensive access to Ethereum blockchain data through the Etherscan API.
Overview
This server provides 53+ tools for accessing Ethereum blockchain data, including:
Account Tools: Balance checking, transaction history, internal transactions
Block Tools: Block data, rewards, timing information
Contract Tools: Source code, ABI, verification status
Transaction Tools: Transaction details, receipts, status
Token Tools: Transfers, balances, supply information
Gas Tools: Gas prices, estimates, oracle data
Statistics Tools: Network metrics, supply data
RPC Tools: Ethereum RPC proxy methods
Logs Tools: Event logs and filtering
Related MCP server: MCP Etherscan Server
Requirements
Python 3.8+
Etherscan API Key
Installation
cd etherscan-mcp-python
pip install -e .Configuration
Set your Etherscan API key as an environment variable:
export ETHERSCAN_API_KEY="your_api_key_here"Usage
Standalone Server
python server.pyWith MCP Tools (Agno Framework)
from agno.tools.mcp import MCPTools
etherscan_mcp = MCPTools(
command="python etherscan-mcp-python/server.py",
env={"ETHERSCAN_API_KEY": "your_api_key"},
timeout_seconds=120
)Complete Tool Reference
🏦 Account Tools (12 tools)
Tool Name | Description | Key Parameters |
| Get ETH balance for single address |
|
| Get ETH balance for multiple addresses (up to 20) |
|
| Get normal transactions by address |
|
| Get internal transactions by address |
|
| Get internal transactions by transaction hash |
|
| Get internal transactions by block range |
|
| Get ERC20 token transfer events |
|
| Get ERC721 (NFT) token transfer events |
|
| Get ERC1155 token transfer events |
|
| Get address funding source and age |
|
| Get blocks validated by address |
|
| Get beacon chain withdrawals |
|
🧱 Block Tools (4 tools)
Tool Name | Description | Key Parameters |
| Get block mining reward and uncle rewards |
|
| Get estimated time until block is mined |
|
| Get block number by timestamp |
|
| Get number of transactions in block |
|
📄 Contract Tools (4 tools)
Tool Name | Description | Key Parameters |
| Get contract ABI for verified contracts |
|
| Get verified contract source code |
|
| Get contract creator and creation tx hash |
|
| Check contract verification status |
|
🔄 Transaction Tools (2 tools)
Tool Name | Description | Key Parameters |
| Get contract execution status |
|
| Get transaction receipt status |
|
🪙 Token Tools (2 tools)
Tool Name | Description | Key Parameters |
| Get ERC20 token total supply |
|
| Get ERC20 token balance of address |
|
⛽ Gas Tools (3 tools)
Tool Name | Description | Key Parameters |
| Get estimated confirmation time for gas price |
|
| Get current safe/proposed/fast gas prices |
|
| Get historical daily average gas limit |
|
📊 Statistics Tools (13 tools)
Tool Name | Description | Key Parameters |
| Get total ETH supply (excluding staking/burnt) |
|
| Get total ETH supply (including staking/burnt) |
|
| Get current ETH price |
|
| Get blockchain size over date range |
|
| Get total discoverable nodes |
|
| Get daily transaction fees paid to miners |
|
| Get daily new address count |
|
| Get daily network utilization percentage |
|
| Get daily average network hash rate |
|
| Get daily transaction count |
|
| Get daily average mining difficulty |
|
| Get historical ETH prices |
|
📝 Logs Tools (3 tools)
Tool Name | Description | Key Parameters |
| Get event logs from address with block range |
|
| Get event logs filtered by topics |
|
| Get event logs from address filtered by topics |
|
🔗 RPC Proxy Tools (13 tools)
Tool Name | Description | Key Parameters |
| Get latest block number |
|
| Get block information by number |
|
| Get uncle block by number and index |
|
| Get transaction count in block |
|
| Get transaction by hash |
|
| Get transaction by block and index |
|
| Get transaction count by address |
|
| Get transaction receipt |
|
| Execute message call without transaction |
|
| Get code at address |
|
| Get storage value at position |
|
| Get current gas price |
|
| Estimate gas for transaction |
|
🎯 Use Cases & Examples
Basic Balance Check
# Get ETH balance for single address
account_balance(address="0x...", chainid="1")
# Get balances for multiple addresses (up to 20)
account_balancemulti(address="0x...,0x...,0x...", chainid="1")Transaction Analysis
# Get transaction history for address
account_txlist(address="0x...", startblock="0", endblock="99999999")
# Get internal transactions (contract interactions)
account_txlistinternal(address="0x...", page="1", offset="100")Block Information
# Get transaction count in specific block (like the web3_GAIA_test.py example)
block_getblocktxnscount(blockno="17000000", chainid="1")
# Get block mining rewards
block_getblockreward(blockno="17000000", chainid="1")Market Data
# Get current ETH price
stats_ethprice(chainid="1")
# Get current gas prices
gas_gasoracle(chainid="1")Smart Contract Analysis
# Get contract source code (if verified)
contract_getsourcecode(address="0x...", chainid="1")
# Get contract ABI
contract_getabi(address="0x...", chainid="1")🔧 Advanced Configuration
Multi-Chain Support
The server supports multiple Ethereum networks via the chainid parameter:
"1"- Ethereum Mainnet (default)"5"- Goerli Testnet"11155111"- Sepolia TestnetAnd other supported networks
Error Handling
The server includes comprehensive error handling for:
❌ Missing API keys
❌ Invalid parameters
❌ API rate limits
❌ Network timeouts
❌ Malformed responses
Performance Optimization
✅ Synchronous HTTP client for MCP compatibility
✅ Efficient JSON parsing and response formatting
✅ Proper timeout handling (120 seconds default)
✅ Memory-efficient tool registration
🔐 Security & Best Practices
API Key Management
Store
ETHERSCAN_API_KEYin environment variablesNever commit API keys to version control
Use
.envfiles for local developmentRotate API keys regularly
Rate Limiting
Etherscan API has rate limits (free tier: 5 calls/sec)
The server respects these limits
Consider upgrading to Etherscan Pro for higher limits
Data Validation
All input parameters are validated
API responses are checked for errors
Malformed data is handled gracefully
🆘 Troubleshooting
Common Issues
❌ "ETHERSCAN_API_KEY not set"
Solution: Set the environment variable
export ETHERSCAN_API_KEY="your_key"
❌ "Connection closed" or "Runtime error"
Solution: Ensure you're not running in nested async context
Check that the server.py uses synchronous
main()function
❌ "Tool not found"
Solution: Verify tool names use underscores (
account_balancenotaccount/balance)Check that tool renaming for Gemini compatibility is applied
❌ "Timeout after 120 seconds"
Solution: Check internet connectivity and API key validity
Verify Etherscan API is not experiencing outages
Debug Mode
For debugging, you can modify the server to add verbose logging:
import logging
logging.basicConfig(level=logging.DEBUG)🤝 Contributing
Adding New Tools
Choose appropriate tool category file (
src/tools/)Follow existing patterns for parameter validation
Add comprehensive docstrings
Test with actual API calls
Update this README with new tool documentation
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/FLock-io/etherscan-mcp-python'
If you have feedback or need assistance with the MCP directory API, please join our Discord server