Ethers Wallet
STDIOModel Context Protocol server that provides Ethereum wallet functionality using ethers.js.
Model Context Protocol server that provides Ethereum wallet functionality using ethers.js.
A Model Context Protocol (MCP) server that provides Ethereum wallet functionality using ethers.js v6.
The MCP Ethers Wallet exposes Ethereum functionality to LLM applications through the Model Context Protocol. It provides tools for:
This server follows the MCP specification, making it compatible with any MCP client, such as Claude Desktop.
To use this as an MCP server with tools like Claude Desktop, use the following configuration:
{ "ethers": { "command": "node", "args": [ "pathTo/ethers-server/build/src/mcpServer.js" ], "env": { "ALCHEMY_API_KEY": "key goes here", "INFURA_API_KEY": "key goes here" } } }
Replace pathTo/ethers-server
with the actual path to your installation directory, and add your API keys.
# Clone the repository git clone https://github.com/yourusername/ethers-server.git cd ethers-server # Install dependencies npm install # Build the TypeScript code npm run build
# Using Node.js npm start # Using Bun (recommended for faster performance) bun start
Configure Claude Desktop to use this server:
node path/to/ethers-server/build/src/mcpServer.js
Use the Ethers tools in your Claude conversations.
The MCP Inspector is a tool for testing and debugging MCP servers.
# Install MCP Inspector globally npm install -g @modelcontextprotocol/inspector # Run it with your server mcp-inspector --command "node build/src/mcpServer.js"
Create a .env
file in the root directory with:
# Required
ALCHEMY_API_KEY=your_alchemy_api_key
INFURA_API_KEY=your_infura_api_key
# Optional
DEFAULT_NETWORK=mainnet # Default: mainnet
LOG_LEVEL=info # Default: info (options: error, warn, info, debug)
The server supports multiple Ethereum and EVM-compatible networks. The supported networks are defined in src/config/networkList.ts
:
You can specify a network when using tools with the provider
parameter, e.g., "provider": "polygon"
or "provider": "bera"
.
You can also use a custom RPC URL:
"provider": "https://my-custom-rpc.example.com"
{ "name": "getSupportedNetworks", "arguments": {} }
{ "name": "getWalletBalance", "arguments": { "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", "provider": "mainnet" } }
{ "name": "erc20GetTokenInfo", "arguments": { "tokenAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "provider": "mainnet" } }
{ "name": "callContractMethod", "arguments": { "contractAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "methodName": "symbol", "params": [], "abi": ["function symbol() view returns (string)"], "provider": "mainnet" } }
The server implements caching for certain operations to improve performance and reduce API calls:
The cache uses a time-to-live (TTL) mechanism that automatically expires entries after a configurable period.
The server implements rate limiting for certain operations:
This prevents abuse and ensures the server remains responsive.
The server includes comprehensive error handling:
npm run build
The server includes comprehensive test suites:
# Start a Hardhat node in a separate terminal npx hardhat node # Run all tests bun test
These tests validate the MCP protocol implementation by spawning the server and sending real MCP requests:
bun run test:client:mcp
# Run ERC20 tests bun test src/services/erc/erc20.test.ts # Run ERC721 tests bun test src/services/erc/erc721.test.ts # Run ERC1155 tests bun test src/services/erc/erc1155.test.ts # Run core tool tests bun test src/tests/write-methods.test.ts
Tests use the bun.setup.ts
file to configure the test environment, including setting up Hardhat as the default provider.
saveToEnv
option in wallet operations..env
file.ethSign
method can sign transaction-like data, which is less secure than signMessage
. Use with caution.Contributions are welcome! Please feel free to submit a Pull Request.
MIT
Dennison Bertram ([email protected])