mcp ethers server
A Model Context Protocol server that gives LLMs the ability to interact with Ethereum networks, manage wallets, query blockchain data, and execute smart contract operations through a standardized interface.
A Model Context Protocol server that gives LLMs the ability to interact with Ethereum networks, manage wallets, query blockchain data, and execute smart contract operations through a standardized interface.
A Model Context Protocol server for interacting with Ethereum wallets and networks using Ethers.js v6. This server provides LLMs with a standardized interface to interact with Ethereum networks, smart contracts, and wallets.
The MCP Ethers Wallet server implements the Model Context Protocol specification, providing LLMs with tools to:
npm install mcp-ethers-wallet
import { startServer } from 'mcp-ethers-wallet';
startServer().catch((error) => {
console.error('Failed to start server:', error);
process.exit(1);
});
"ethers": {
"command": "node",
"args": [
"/path-to-mcp-ethers-wallet/build/src/index.js"
],
"env": {
"ALCHEMY_API_KEY": "<<your alchemy api key>>"
}
}Install the MCP Inspector:
npm install -g @modelcontextprotocol/inspector
Start the server:
npm start
In another terminal, run the inspector:
mcp-inspector
Open http://localhost:5173 in your browser to interact with the tools
getSupportedNetworks: Get a list of all supported networks and their configurationsgetBlockNumber: Get the current block number for a networkgetBlockDetails: Get detailed information about a specific blockgetGasPrice: Get the current gas pricegetFeeData: Get detailed fee data including base fee and priority feecheckWalletExists: Check if a wallet is configured (without exposing private keys)getWalletBalance: Get the native token balance of a walletgetWalletTransactionCount: Get the number of transactions sent from a walletgetERC20Balance: Get the balance of an ERC20 token for a walletgetTransactionDetails: Get detailed information about a transactionsendTransaction: Send a native token transactionsendTransactionWithOptions: Send a transaction with custom options (gas, nonce, etc)getTransactionsByBlock: Get all transactions in a specific blockcontractCall: Execute a contract write methodcontractCallView: Execute a contract read methodgetContractCode: Get the bytecode of a deployed contractlookupAddress: Resolve an ENS name to an addressresolveName: Resolve an address to an ENS nameThe server supports multiple networks including: - Ethereum Mainnet - Polygon PoS - Arbitrum - Optimism - Base - And more...
Use the getSupportedNetworks tool to get a complete list of supported networks.
The server can be configured using environment variables:
ALCHEMY_API_KEY: Your Alchemy API key for network accessPRIVATE_KEY: Private key for transaction signing (optional)DEFAULT_NETWORK: Default network to use (defaults to "mainnet")The server provides detailed error messages for common issues: - Invalid network names or RPC URLs - Chain ID mismatches - Contract interaction failures - Transaction errors - Network connectivity issues
# Install dependencies
npm install
# Run tests
npm test
# Start in development mode
npm run dev
# Build
npm run build
Issues and pull requests are welcome on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.
Dennison Bertram ([email protected])