by mcpdotdirect
EVM MCP Server is a comprehensive Model Context Protocol (MCP) server designed to provide blockchain services across multiple EVM-compatible networks. It enables AI agents to interact with various EVM chains through a unified interface, simplifying blockchain integration and data analysis.
EVM MCP Server is a comprehensive Model Context Protocol (MCP) server designed to provide blockchain services across multiple EVM-compatible networks. It enables AI agents to interact with various EVM chains, including Ethereum, Optimism, Arbitrum, Base, Polygon, and many others, through a unified interface. The server leverages the Model Context Protocol to expose blockchain functionalities as MCP tools and resources, making it easy for AI agents to discover and utilize them.
EVM MCP Server can be used in several ways:
npx @mcpdotdirect/evm-mcp-server
for stdio mode (CLI tools) or npx @mcpdotdirect/evm-mcp-server --http
for HTTP mode (web applications).bun install
or npm install
), then start the server using bun start
(stdio) or bun start:http
(HTTP).npx @mcpdotdirect/evm-mcp-server
or by creating an .cursor/mcp.json
file in your project root for portable configurations.claude mcp add evm-mcp-server npx @mcpdotdirect/evm-mcp-server
to add the server and then claude
to start Claude with the server enabled.vitalik.eth
) are automatically resolved to addresses.Q: What is the Model Context Protocol (MCP)? A: The Model Context Protocol is a framework that allows AI agents to discover and use external tools and resources, in this case, blockchain services.
Q: How does ENS resolution work with EVM MCP Server? A: All tools and resources that accept Ethereum addresses also support ENS names. The server automatically resolves these human-readable names to their corresponding blockchain addresses behind the scenes.
Q: What security considerations should I be aware of? A: Private keys are used only for transaction signing and are never stored by the server. For production use, consider implementing additional authentication, using HTTPS for the HTTP server, and implementing rate limiting.
Q: Can I modify the default server configuration?
A: Yes, the default chain ID, server port, and host are hardcoded. You can modify them by editing src/core/chains.ts
for chain configuration and src/server/http-server.ts
for server configuration.
Q: How can I add support for new networks or features?
A: To extend the server, you can add new services under src/core/services/
, register new tools in src/core/tools.ts
, register new resources in src/core/resources.ts
, and add new network support in src/core/chains.ts
.
A comprehensive Model Context Protocol (MCP) server that provides blockchain services across multiple EVM-compatible networks. This server enables AI agents to interact with Ethereum, Optimism, Arbitrum, Base, Polygon, and many other EVM chains with a unified interface.
The MCP EVM Server leverages the Model Context Protocol to provide blockchain services to AI agents. It supports a wide range of services including:
All services are exposed through a consistent interface of MCP tools and resources, making it easy for AI agents to discover and use blockchain functionality. Every tool that accepts Ethereum addresses also supports ENS names, automatically resolving them to addresses behind the scenes.
ERC20 Tokens
NFTs (ERC721)
Multi-tokens (ERC1155)
# Clone the repository
git clone https://github.com/mcpdotdirect/mcp-evm-server.git
cd mcp-evm-server
# Install dependencies with Bun
bun install
# Or with npm
npm install
The server uses the following default configuration:
These values are hardcoded in the application. If you need to modify them, you can edit the following files:
src/core/chains.ts
src/server/http-server.ts
You can run the MCP EVM Server directly without installation using npx:
# Run the server in stdio mode (for CLI tools)
npx @mcpdotdirect/evm-mcp-server
# Run the server in HTTP mode (for web applications)
npx @mcpdotdirect/evm-mcp-server --http
Start the server using stdio (for embedding in CLI tools):
# Start the stdio server
bun start
# Development mode with auto-reload
bun dev
Or start the HTTP server with SSE for web applications:
# Start the HTTP server
bun start:http
# Development mode with auto-reload
bun dev:http
Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use the MCP Inspector.
To connect to the MCP server from Cursor:
Open Cursor and go to Settings (gear icon in the bottom left)
Click on "Features" in the left sidebar
Scroll down to "MCP Servers" section
Click "Add new MCP server"
Enter the following details:
evm-mcp-server
command
npx @mcpdotdirect/evm-mcp-server
Click "Save"
Once connected, you can use the MCP server's capabilities directly within Cursor. The server will appear in the MCP Servers list and can be enabled/disabled as needed.
For a more portable configuration that you can share with your team or use across projects, you can create an .cursor/mcp.json
file in your project's root directory:
{
"mcpServers": {
"evm-mcp-server": {
"command": "npx",
"args": [
"-y",
"@mcpdotdirect/evm-mcp-server"
]
},
"evm-mcp-http": {
"command": "npx",
"args": [
"-y",
"@mcpdotdirect/evm-mcp-server",
"--http"
]
}
}
}
Place this file in your project's .cursor
directory (create it if it doesn't exist), and Cursor will automatically detect and use these MCP server configurations when working in that project. This approach makes it easy to:
If you're developing a web application and want to connect to the HTTP server with Server-Sent Events (SSE), you can use this configuration:
{
"mcpServers": {
"evm-mcp-sse": {
"url": "http://localhost:3001/sse"
}
}
}
This connects directly to the HTTP server's SSE endpoint, which is useful for:
To use this configuration:
.cursor
directory in your project root if it doesn't existmcp.json
in the .cursor
directoryAfter configuring the MCP server with mcp.json
, you can easily use it in Cursor. Here's an example workflow:
// blockchain-example.js
async function main() {
try {
// Get ETH balance for an address using ENS
console.log("Getting ETH balance for vitalik.eth...");
// When using with Cursor, you can simply ask Cursor to:
// "Check the ETH balance of vitalik.eth on mainnet"
// Or "Transfer 0.1 ETH from my wallet to vitalik.eth"
// Cursor will use the MCP server to execute these operations
// without requiring any additional code from you
// This is the power of the MCP integration - your AI assistant
// can directly interact with blockchain data and operations
} catch (error) {
console.error("Error:", error.message);
}
}
main();
With the file open in Cursor, you can ask Cursor to:
Cursor will use the MCP server to execute these operations and return the results directly in your conversation.
The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language.
If you're using Claude CLI, you can connect to the MCP server with just two commands:
# Add the MCP server
claude mcp add evm-mcp-server npx @mcpdotdirect/evm-mcp-server
# Start Claude with the MCP server enabled
claude
// Example of using the MCP client to check a token balance using ENS
const mcp = new McpClient("http://localhost:3000");
const result = await mcp.invokeTool("get-token-balance", {
tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
ownerAddress: "vitalik.eth", // ENS name instead of address
network: "ethereum"
});
console.log(result);
// {
// tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
// owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
// network: "ethereum",
// raw: "1000000000",
// formatted: "1000",
// symbol: "USDC",
// decimals: 6
// }
// Example of using the MCP client to resolve an ENS name to an address
const mcp = new McpClient("http://localhost:3000");
const result = await mcp.invokeTool("resolve-ens", {
ensName: "vitalik.eth",
network: "ethereum"
});
console.log(result);
// {
// ensName: "vitalik.eth",
// normalizedName: "vitalik.eth",
// resolvedAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
// network: "ethereum"
// }
The server provides the following MCP tools for agents. All tools that accept address parameters support both Ethereum addresses and ENS names.
Tool Name | Description | Key Parameters |
---|---|---|
get-token-info |
Get ERC20 token metadata | tokenAddress (address/ENS), network |
get-token-balance |
Check ERC20 token balance | tokenAddress (address/ENS), ownerAddress (address/ENS), network |
transfer-token |
Transfer ERC20 tokens | privateKey , tokenAddress (address/ENS), toAddress (address/ENS), amount , network |
approve-token-spending |
Approve token allowances | privateKey , tokenAddress (address/ENS), spenderAddress (address/ENS), amount , network |
get-nft-info |
Get NFT metadata | tokenAddress (address/ENS), tokenId , network |
check-nft-ownership |
Verify NFT ownership | tokenAddress (address/ENS), tokenId , ownerAddress (address/ENS), network |
transfer-nft |
Transfer an NFT | privateKey , tokenAddress (address/ENS), tokenId , toAddress (address/ENS), network |
get-nft-balance |
Count NFTs owned | tokenAddress (address/ENS), ownerAddress (address/ENS), network |
get-erc1155-token-uri |
Get ERC1155 metadata | tokenAddress (address/ENS), tokenId , network |
get-erc1155-balance |
Check ERC1155 balance | tokenAddress (address/ENS), tokenId , ownerAddress (address/ENS), network |
transfer-erc1155 |
Transfer ERC1155 tokens | privateKey , tokenAddress (address/ENS), tokenId , amount , toAddress (address/ENS), network |
Tool Name | Description | Key Parameters |
---|---|---|
get-chain-info |
Get network information | network |
get-balance |
Get native token balance | address (address/ENS), network |
transfer-eth |
Send native tokens | privateKey , to (address/ENS), amount , network |
get-transaction |
Get transaction details | txHash , network |
read-contract |
Read smart contract state | contractAddress (address/ENS), abi , functionName , args , network |
write-contract |
Write to smart contract | contractAddress (address/ENS), abi , functionName , args , privateKey , network |
is-contract |
Check if address is a contract | address (address/ENS), network |
resolve-ens |
Resolve ENS name to address | ensName , network |
The server exposes blockchain data through the following MCP resource URIs. All resource URIs that accept addresses also support ENS names, which are automatically resolved to addresses.
Resource URI Pattern | Description |
---|---|
evm://{network}/chain |
Chain information for a specific network |
evm://chain |
Ethereum mainnet chain information |
evm://{network}/block/{blockNumber} |
Block data by number |
evm://{network}/block/latest |
Latest block data |
evm://{network}/address/{address}/balance |
Native token balance |
evm://{network}/tx/{txHash} |
Transaction details |
evm://{network}/tx/{txHash}/receipt |
Transaction receipt with logs |
Resource URI Pattern | Description |
---|---|
evm://{network}/token/{tokenAddress} |
ERC20 token information |
evm://{network}/token/{tokenAddress}/balanceOf/{address} |
ERC20 token balance |
evm://{network}/nft/{tokenAddress}/{tokenId} |
NFT (ERC721) token information |
evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address} |
NFT ownership verification |
evm://{network}/erc1155/{tokenAddress}/{tokenId}/uri |
ERC1155 token URI |
evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address} |
ERC1155 token balance |
mcp-evm-server/
βββ src/
β βββ index.ts # Main stdio server entry point
β βββ server/ # Server-related files
β β βββ http-server.ts # HTTP server with SSE
β β βββ server.ts # General server setup
β βββ core/
β β βββ chains.ts # Chain definitions and utilities
β β βββ resources.ts # MCP resources implementation
β β βββ tools.ts # MCP tools implementation
β β βββ prompts.ts # MCP prompts implementation
β β βββ services/ # Core blockchain services
β β βββ index.ts # Operation exports
β β βββ balance.ts # Balance services
β β βββ transfer.ts # Token transfer services
β β βββ utils.ts # Utility functions
β β βββ tokens.ts # Token metadata services
β β βββ contracts.ts # Contract interactions
β β βββ transactions.ts # Transaction services
β β βββ blocks.ts # Block services
β β βββ clients.ts # RPC client utilities
βββ package.json
βββ tsconfig.json
βββ README.md
To modify or extend the server:
src/core/services/
src/core/tools.ts
src/core/resources.ts
src/core/chains.ts
src/server/http-server.ts
This project is licensed under the terms of the MIT License.
Please log in to share your review and rating for this MCP.