A unified TypeScript MCP (Model Context Protocol) server for multi-chain blockchain interactions, supporting Bitcoin, Ethereum, Base, and Optimism networks.
- Bitcoin: Mainnet & Testnet (Blockstream API)
- Ethereum: Mainnet & Sepolia (Alchemy, Infura, Public Nodes)
- Base: Mainnet & Sepolia (L2)
- Optimism: Mainnet & Sepolia (L2)
- Wallet: Native & ERC20 token balances, UTXO analysis.
- Transactions: Fetch details, decode raw txs, estimate gas/fees.
- Network: Block details (latest or by hash), network stats, chain IDs.
- Smart Contracts: Verify contract source, read state (via Viem).
# Install dependencies
npm install
# Build the project
npm run buildThe server is configured via environment variables. Create a .env file based on .env.example:
# Server Configuration
LOG_LEVEL=info
# API Keys (Recommended for stability)
ALCHEMY_API_KEY=your_alchemy_key
INFURA_API_KEY=your_infura_key
ETHERSCAN_API_KEY=your_etherscan_key
BASESCAN_API_KEY=your_basescan_key
# Custom RPC URLs (Optional overrides)
BITCOIN_RPC_URL=...
ETHEREUM_RPC_URL=...
BASE_RPC_URL=...
OPTIMISM_RPC_URL=...
# Custom Testnet RPC URLs (Optional overrides)
BITCOIN_TESTNET_RPC_URL=...
ETHEREUM_TESTNET_RPC_URL=...
BASE_TESTNET_RPC_URL=...
OPTIMISM_TESTNET_RPC_URL=...Stdio Mode (default):
npm startHTTP Mode:
npm run start:httpbitcoin_get_balance: Get address balance.bitcoin_get_utxos: List unspent transaction outputs.bitcoin_analyze_utxos: Analyze UTXO set stats.bitcoin_get_block: Fetch block by hash or height.bitcoin_get_transaction: Fetch transaction by ID.bitcoin_estimate_fee: Get current fee estimates.bitcoin_decode_tx: Decode raw hex transaction.
eth_get_balance: Get native ETH balance.eth_get_token_balance: Get ERC20 token balance.eth_get_transaction: Get transaction details.eth_get_transaction_status: Get transaction receipt status.eth_get_block: Get block details (params: hash/number, includeTx).eth_get_latest_block: Get the latest block.eth_estimate_gas: Estimate gas for operations.eth_get_address: Validate and normalize addresses.eth_verify_contract: Check verification status (Explorer).eth_get_network_info: Get gas price and chain stats.
Add the following to your claude_desktop_config.json (usually checking ~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"blockchain-mcp": {
"command": "node",
"args": [
"/absolute/path/to/blockchain-mcp/dist/index.js"
],
"env": {
"ALCHEMY_API_KEY": "your_key_here",
"INFURA_API_KEY": "your_key_here"
}
}
}
}- Open Cursor Settings > Features > MCP.
- Click Add New MCP Server.
- Enter the details:
- Name:
blockchain-mcp(or any name you prefer) - Type:
stdio - Command:
node /absolute/path/to/blockchain-mcp/dist/index.js
- Name:
- Environment Variables:
- You may need to create a wrapper script or use a
.envloader if Cursor doesn't support direct env var entry in the UI yet, or ensure your global environment has the keys. - Alternatively, pass keys inline (not recommended for secrets) or configure the project to load from a specific
.envpath usingdotenvin the code (which this project supports).
- You may need to create a wrapper script or use a
MIT