A powerful Model Context Protocol (MCP) server that brings Etherscan's blockchain data directly to your AI tools like Claude Code and Cursor! 🚀
This MCP server is specifically designed for dApp and smart contract developers! 👨💻 It supercharges your AI assistant with essential blockchain development tools by providing direct access to Etherscan's data:
- 📄 Smart Contract ABIs - Fetch contract interfaces instantly for integration
- 🔍 Contract Details - Get comprehensive contract information including source code
- 🌐 Multi-Chain Support - Works across all major EVM networks
Optimized for developers: Only includes the most essential tools to keep context consumption small
Built with the awesome xmcp framework for maximum developer happiness! ✨
- Node.js (v20 or higher)
- pnpm
- An Etherscan API key (get yours at etherscan.io)
-
Clone and Install
git clone <your-repo-url> cd etherscan-mcp-for-dev pnpm install
-
Development Server
pnpm dev
This fires up the MCP server with hot reloading! 🔥
-
Build for Production
pnpm build
This project follows the xmcp structured approach where tools live in the src/tools directory and are automatically discovered:
src/
├── tools/
│ ├── getContractAbi.ts # 📋 Fetch contract ABIs
│ ├── getContractDetail.ts # 🔍 Get detailed contract info
│ └── getSupportedChains.ts # 🌐 List supported chains
└── ...
Each tool follows this pattern:
import { z } from "zod";
import { type InferSchema } from "xmcp";
// 📝 Define parameters with Zod validation
export const schema = {
address: z.string().describe("Contract address"),
chain: z.string().describe("Chain name or ID"),
};
// 🏷️ Tool metadata
export const metadata = {
name: "getContractAbi",
description: "Fetch smart contract ABI from Etherscan",
annotations: {
title: "Get Contract ABI",
readOnlyHint: true,
destructiveHint: false,
idempotentHint: true,
},
};
// ⚡ Implementation
export default async function getContractAbi({ address, chain }: InferSchema<typeof schema>) {
// Your awesome logic here!
return {
content: [{ type: "text", text: "Contract ABI data..." }],
};
}Fetches the Application Binary Interface (ABI) for any verified smart contract.
Example Claude query:
"Can you get the ABI for the 0xdac17f958d2ee523a2206206994597c13d831ec7 on ethereum?"
Retrieves comprehensive contract information including source code, compiler version, and proxy details.
Example Claude query:
"Show me the source code for contract 0xdac17f958d2ee523a2206206994597c13d831ec7 on ethereum"
Lists all supported blockchain networks and their chain IDs.
Example Claude query:
"What blockchains does etherscan support?"
pnpm dev # Hot reloading goodness ⚡# Build first
pnpm build
# Then run with STDIO transport:
pnpm start-
Open Your AI Tools MCP configuration file:
- Cursor:
~/.cursor/mcp.json - Windsurf:
~/.codeium/windsurf/mcp_config.json - Cline:
~/.cline/mcp_config.json - Claude:
~/.claude/mcp_config.json
- Cursor:
-
Add configuration:
{ "mcpServers": { "etherscan-mcp": { "command": "npx", "args": ["-y", "etherscan-mcp-for-dev@latest"], "env": { "ETHERSCAN_API_KEY": "your_api_key_here" } } } }
- xmcp Documentation - Framework docs
- MCP Specification - Protocol details
- Etherscan API - Data source docs
MIT License - see LICENSE for details.
Built with ❤️ using xmcp