eth mcp
Provides tools for AI assistants to interact with the Ethereum blockchain through standard JSON-RPC methods, enabling queries for account balances, gas prices, and smart contract code.
Provides tools for AI assistants to interact with the Ethereum blockchain through standard JSON-RPC methods, enabling queries for account balances, gas prices, and smart contract code.
A Model Context Protocol (MCP) server for interacting with Ethereum blockchain.
This MCP server provides tools to query Ethereum blockchain data through standard JSON-RPC methods. It enables AI assistants and applications to interact with the Ethereum blockchain through a standardized protocol.
This MCP server provides three key Ethereum RPC methods as tools:
Note: More are coming
To add this MCP to Cursor:
First, clone this repository:
git clone https://github.com/yourusername/eth-mpc.git
Go to Cursor settings → MCP → Add new MCP server
node /path/to/eth-mpc/index.js
Once added, the Ethereum RPC tools will be available to use within Cursor.
The server uses stdio transport, making it compatible with MCP clients like Claude Desktop, Cursor, and others.
The MCP Inspector is a development tool for testing and debugging MCP servers. It provides an interactive interface to test your MCP server's functionality without needing a full AI client.
To test your Ethereum RPC MCP server with the Inspector:
To run the Inspector:
npx @modelcontextprotocol/inspector
Input the command and path
The Inspector will connect to your running MCP server and display available tools.
The Inspector allows you to:
For example, to test the eth_getBalance
tool:
1. Select the tool in the Inspector interface
2. Enter a valid Ethereum address (e.g., 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
- Vitalik's address)
3. Use the default block parameter (latest
)
4. Submit the request and view the response
This MCP server can be integrated with any MCP-compatible client, including:
When integrated, the client application can use the tools provided by this server to query Ethereum blockchain data directly.
Model Context Protocol (MCP) is an open standard that allows AI models to interact with various tools and services. It provides a standardized way for developers to expose APIs, data sources, and functionality to AI assistants.
MCP servers like this one form part of an ecosystem that allows AI assistants to perform complex tasks across multiple services without requiring custom integration for each service.
? Official Documentation: Model Context Protocol Overview
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
[
{
"description": "Retrieves the code at a given Ethereum address",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"address": {
"description": "The Ethereum address to get code from",
"pattern": "^0x[a-fA-F0-9]{40}$",
"type": "string"
},
"blockParameter": {
"default": "latest",
"description": "Block parameter (default: "latest")",
"type": "string"
}
},
"required": [
"address"
],
"type": "object"
},
"name": "eth_getCode"
},
{
"description": "Retrieves the current gas price in wei",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
},
"name": "eth_gasPrice"
},
{
"description": "Retrieves the balance of a given Ethereum address",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"address": {
"description": "The Ethereum address to check balance",
"pattern": "^0x[a-fA-F0-9]{40}$",
"type": "string"
},
"blockParameter": {
"default": "latest",
"description": "Block parameter (default: "latest")",
"type": "string"
}
},
"required": [
"address"
],
"type": "object"
},
"name": "eth_getBalance"
},
{
"description": "Executes a call to a contract function without creating a transaction",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"blockParameter": {
"default": "latest",
"description": "Block parameter (default: "latest")",
"type": "string"
},
"transaction": {
"additionalProperties": false,
"description": "The transaction call object",
"properties": {
"data": {
"description": "The compiled code of a contract OR the hash of the invoked method signature and encoded parameters",
"pattern": "^0x[a-fA-F0-9]*$",
"type": "string"
},
"from": {
"description": "The address the transaction is sent from",
"pattern": "^0x[a-fA-F0-9]{40}$",
"type": "string"
},
"gas": {
"description": "Integer of the gas provided for the transaction execution in hex",
"pattern": "^0x[a-fA-F0-9]+$",
"type": "string"
},
"gasPrice": {
"description": "Integer of the gas price used for each paid gas in hex",
"pattern": "^0x[a-fA-F0-9]+$",
"type": "string"
},
"to": {
"description": "The address the transaction is directed to",
"pattern": "^0x[a-fA-F0-9]{40}$",
"type": "string"
},
"value": {
"description": "Integer of the value sent with this transaction in hex",
"pattern": "^0x[a-fA-F0-9]+$",
"type": "string"
}
},
"required": [
"to",
"data"
],
"type": "object"
}
},
"required": [
"transaction"
],
"type": "object"
},
"name": "eth_call"
},
{
"description": "Retrieves logs matching the given filter criteria",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"filter": {
"additionalProperties": false,
"description": "The filter options",
"properties": {
"address": {
"anyOf": [
{
"pattern": "^0x[a-fA-F0-9]{40}$",
"type": "string"
},
{
"items": {
"pattern": "^0x[a-fA-F0-9]{40}$",
"type": "string"
},
"type": "array"
}
],
"description": "Contract address or a list of addresses from which logs should originate"
},
"fromBlock": {
"description": "Block number in hex or "latest", "earliest" or "pending"",
"type": "string"
},
"toBlock": {
"description": "Block number in hex or "latest", "earliest" or "pending"",
"type": "string"
},
"topics": {
"description": "Array of 32 Bytes DATA topics",
"items": {
"anyOf": [
{
"pattern": "^0x[a-fA-F0-9]{64}$",
"type": "string"
},
{
"items": {
"pattern": "^0x[a-fA-F0-9]{64}$",
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
]
},
"type": "array"
}
},
"type": "object"
}
},
"required": [
"filter"
],
"type": "object"
},
"name": "eth_getLogs"
},
{
"description": "Sends a transaction to the Ethereum network",
"inputSchema": {
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"transaction": {
"additionalProperties": false,
"description": "The transaction object",
"properties": {
"data": {
"description": "The compiled code of a contract OR the hash of the invoked method signature and encoded parameters",
"pattern": "^0x[a-fA-F0-9]*$",
"type": "string"
},
"from": {
"description": "The address the transaction is sent from",
"pattern": "^0x[a-fA-F0-9]{40}$",
"type": "string"
},
"gas": {
"description": "Integer of the gas provided for the transaction execution in hex",
"pattern": "^0x[a-fA-F0-9]+$",
"type": "string"
},
"gasPrice": {
"description": "Integer of the gas price used for each paid gas in hex",
"pattern": "^0x[a-fA-F0-9]+$",
"type": "string"
},
"nonce": {
"description": "Integer of a nonce used to prevent transaction replay",
"pattern": "^0x[a-fA-F0-9]+$",
"type": "string"
},
"to": {
"description": "The address the transaction is directed to",
"pattern": "^0x[a-fA-F0-9]{40}$",
"type": "string"
},
"value": {
"description": "Integer of the value sent with this transaction in hex",
"pattern": "^0x[a-fA-F0-9]+$",
"type": "string"
}
},
"required": [
"from"
],
"type": "object"
}
},
"required": [
"transaction"
],
"type": "object"
},
"name": "eth_sendTransaction"
}
]