Skip to content
Back to search

evm-mcp-server

MCP server that provides LLMs with tools for interacting with EVM networks

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/mcpdotdirect--evm-mcp-server/badge.svg)](/listings/mcpdotdirect--evm-mcp-server)

HTML

<a href="/listings/mcpdotdirect--evm-mcp-server"><img src="/api/listings/mcpdotdirect--evm-mcp-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

# Clone the repository
git clone https://github.com/mcpdotdirect/evm-mcp-server.git
cd evm-mcp-server

# Install dependencies with Bun
bun install

# Or with npm
npm install

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 669 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # EVM MCP Server
  2. ![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)
  3. ![EVM Networks](https://img.shields.io/badge/Networks-60+-green)
  4. ![TypeScript](https://img.shields.io/badge/TypeScript-5.8+-3178C6)
  5. ![MCP](https://img.shields.io/badge/MCP-1.22.0+-blue)
  6. ![Viem](https://img.shields.io/badge/Viem-2.39.3+-green)
  7. A comprehensive Model Context Protocol (MCP) server that provides blockchain services across 60+ 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 through 22 tools and 10 AI-guided prompts.
  8. ## 📋 Contents
  9. - [Overview](#overview)
  10. - [Features](#features)
  11. - [Supported Networks](#supported-networks)
  12. - [Prerequisites](#prerequisites)
  13. - [Installation](#installation)
  14. - [Configuration](#configuration)
  15. - [Environment Variables](#environment-variables)
  16. - [Server Configuration](#server-configuration)
  17. - [Usage](#usage)
  18. - [API Reference](#api-reference)
  19. - [Tools](#tools)
  20. - [Prompts](#prompts)
  21. - [Resources](#resources)
  22. - [Security Considerations](#security-considerations)
  23. - [Project Structure](#project-structure)
  24. - [Development](#development)
  25. - [License](#license)
  26. ## 🔭 Overview
  27. The MCP EVM Server leverages the Model Context Protocol to provide blockchain services to AI agents. It supports a wide range of services including:
  28. - Reading blockchain state (balances, transactions, blocks, etc.)
  29. - Interacting with smart contracts with **automatic ABI fetching** from block explorers
  30. - Transferring tokens (native, ERC20, ERC721, ERC1155)
  31. - Querying token metadata and balances
  32. - Chain-specific services across 60+ EVM networks (34 mainnets + 26 testnets)
  33. - **ENS name resolution** for all address parameters (use human-readable names like 'vitalik.eth' instead of addresses)
  34. - **AI-friendly prompts** that guide agents through complex workflows
  35. All services are exposed through a consistent interface of MCP tools, resources, and prompts, 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. The server includes intelligent ABI fetching, eliminating the need to know contract ABIs in advance.
  36. ## ✨ Features
  37. ### Blockchain Data Access
  38. - **Multi-chain support** for 60+ EVM-compatible networks (34 mainnets + 26 testnets)
  39. - **Chain information** including blockNumber, chainId, and RPCs
  40. - **Block data** access by number, hash, or latest
  41. - **Transaction details** and receipts with decoded logs
  42. - **Address balances** for native tokens and all token standards
  43. - **ENS resolution** for human-readable Ethereum addresses (use 'vitalik.eth' instead of '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045')
  44. ### Token services
  45. - **ERC20 Tokens**
  46. - Get token metadata (name, symbol, decimals, supply)
  47. - Check token balances
  48. - Transfer tokens between addresses
  49. - Approve spending allowances
  50. - **NFTs (ERC721)**
  51. - Get collection and token metadata
  52. - Verify token ownership
  53. - Transfer NFTs between addresses
  54. - Retrieve token URIs and count holdings
  55. - **Multi-tokens (ERC1155)**
  56. - Get token balances and metadata
  57. - Transfer tokens with quantity
  58. - Access token URIs
  59. ### Smart Contract Interactions
  60. - **Read contract state** through view/pure functions
  61. - **Write to contracts** - Execute any state-changing function with automatic ABI fetching
  62. - **Contract verification** to distinguish from EOAs
  63. - **Event logs** retrieval and filtering
  64. - **Automatic ABI fetching** from Etherscan v2 API across all 60+ networks (no need to know ABIs in advance)
  65. - **ABI parsing and validation** with function discovery
  66. ### Comprehensive Transaction Support
  67. - **Flexible Wallet Support** - Configure with Private Key or Mnemonic (BIP-39) with HD path support
  68. - **Native token transfers** across all supported networks
  69. - **Gas estimation** for transaction planning
  70. - **Transaction status** and receipt information
  71. - **Error handling** with descriptive messages
  72. ### Message Signing Capabilities
  73. - **Personal Message Signing** - Sign arbitrary messages for authentication and verification
  74. - **EIP-712 Typed Data Signing** - Sign structured data for gasless transactions and meta-transactions
  75. - **SIWE Support** - Enable Sign-In With Ethereum authentication flows
  76. - **Permit Signatures** - Create off-chain approvals for gasless token operations
  77. - **Meta-Transaction Support** - Sign transaction data for relay services and gasless transfers
  78. ### AI-Guided Workflows (Prompts)
  79. - **Transaction preparation** - Guidance for planning and executing transfers
  80. - **Wallet analysis** - Tools for analyzing wallet activity and holdings
  81. - **Smart contract exploration** - Interactive ABI fetching and contract analysis
  82. - **Contract interaction** - Safe execution of write operations on smart contracts
  83. - **Network information** - Learning about EVM networks and comparisons
  84. - **Approval auditing** - Reviewing and managing token approvals
  85. - **Error diagnosis** - Troubleshooting transaction failures
  86. ## 🌐 Supported Networks
  87. ### Mainnets
  88. - Ethereum (ETH)
  89. - Optimism (OP)
  90. - Arbitrum (ARB)
  91. - Arbitrum Nova
  92. - Base
  93. - Polygon (MATIC)
  94. - Polygon zkEVM
  95. - Avalanche (AVAX)
  96. - Binance Smart Chain (BSC)
  97. - zkSync Era
  98. - Linea
  99. - Celo
  100. - Gnosis (xDai)
  101. - Fantom (FTM)
  102. - Filecoin (FIL)
  103. - Moonbeam
  104. - Moonriver
  105. - Cronos
  106. - Scroll
  107. - Mantle
  108. - Manta
  109. - Blast
  110. - Fraxtal
  111. - Mode
  112. - Metis
  113. - Kroma
  114. - Zora
  115. - Aurora
  116. - Canto
  117. - Flow
  118. - Lumia
  119. ### Testnets
  120. - Sepolia
  121. - Optimism Sepolia
  122. - Arbitrum Sepolia
  123. - Base Sepolia
  124. - Polygon Amoy
  125. - Avalanche Fuji
  126. - BSC Testnet
  127. - zkSync Sepolia
  128. - Linea Sepolia
  129. - Scroll Sepolia
  130. - Mantle Sepolia
  131. - Manta Sepolia
  132. - Blast Sepolia
  133. - Fraxtal Testnet
  134. - Mode Testnet
  135. - Metis Sepolia
  136. - Kroma Sepolia
  137. - Zora Sepolia
  138. - Celo Alfajores
  139. - Goerli
  140. - Holesky
  141. - Flow Testnet
  142. - Filecoin Calibration
  143. - Lumia Testnet
  144. ## 🛠️ Prerequisites
  145. - [Bun](https://bun.sh/) 1.0.0 or higher (recommended)
  146. - Node.js 20.0.0 or higher (if not using Bun)
  147. - Optional: [Etherscan API key](https://etherscan.io/apis) for ABI fetching
  148. ## 📦 Installation
  149. ```bash
  150. # Clone the repository
  151. git clone https://github.com/mcpdotdirect/evm-mcp-server.git
  152. cd evm-mcp-server
  153. # Install dependencies with Bun
  154. bun install
  155. # Or with npm
  156. npm install
  157. ```
  158. ## ⚙️ Configuration
  159. ### Environment Variables
  160. The server uses the following environment variables. For write operations and ABI fetching, you must configure these variables:
  161. #### Wallet Configuration (For Write Operations)
  162. You can configure your wallet using **either** a private key or a mnemonic phrase:
  163. **Option 1: Private Key**
  164. ```bash
  165. export EVM_PRIVATE_KEY="0x..." # Your private key in hex format (with or without 0x prefix)
  166. ```
  167. **Option 2: Mnemonic Phrase (Recommended for HD Wallets)**
  168. ```bash
  169. export EVM_MNEMONIC="word1 word2 word3 ... word12" # Your 12 or 24 word BIP-39 mnemonic
  170. export EVM_ACCOUNT_INDEX="0" # Optional: Account index for HD wallet derivation (default: 0)
  171. ```
  172. The mnemonic option supports hierarchical deterministic (HD) wallet derivation:
  173. - Uses BIP-39 standard mnemonic phrases (12 or 24 words)
  174. - Supports BIP-44 derivation path: `m/44'/60'/0'/0/{accountIndex}`
  175. - `EVM_ACCOUNT_INDEX` allows you to derive different accounts from the same mnemonic
  176. - Default account index is 0 (first account)
  177. **Wallet is used for:**
  178. - Transferring native tokens (`transfer_native` tool)
  179. - Transferring ERC20 tokens (`transfer_erc20` tool)
  180. - Approving token spending (`approve_token_spending` tool)
  181. - Writing to smart contracts (`write_contract` tool)
  182. - Signing messages for authentication (`sign_message` tool)
  183. - Signing structured data for gasless transactions (`sign_typed_data` tool)
  184. ⚠️ **Security**:
  185. - Never commit your private key or mnemonic to version control
  186. - Use environment variables or a secure key management system
  187. - Store mnemonics securely - they provide access to all derived accounts
  188. - Consider using different account indices for different purposes
  189. #### API Keys (For ABI Fetching)
  190. ```bash
  191. export ETHERSCAN_API_KEY="your-api-key-here"
  192. ```
  193. This API key is optional but required for:
  194. - Automatic ABI fetching from block explorers (`get_contract_abi` tool)
  195. - Auto-fetching ABIs when reading contracts (`read_contract` tool with `abiJson` parameter)
  196. - The `fetch_and_analyze_abi` prompt
  197. Get your free API key from:
  198. - [Etherscan](https://etherscan.io/apis) - For Ethereum and compatible chains
  199. - The same key works across all 60+ EVM networks via the Etherscan v2 API
  200. ### Server Configuration
  201. The server uses the following default configuration:
  202. - **Default Chain ID**: 1 (Ethereum Mainnet)
  203. - **Server Port**: 3001
  204. - **Server Host**: 0.0.0.0 (accessible from any network interface)
  205. These values are hardcoded in the application. If you need to modify them, you can edit the following files:
  206. - For chain configuration: `src/core/chains.ts`
  207. - For server configuration: `src/server/http-server.ts`
  208. ## 🚀 Usage
  209. ### Using npx (No Installation Required)
  210. You can run the MCP EVM Server directly without installation using npx:
  211. ```bash
  212. # Run the server in stdio mode (for CLI tools)
  213. npx @mcpdotdirect/evm-mcp-server
  214. # Run the server in HTTP mode (for web applications)
  215. npx @mcpdotdirect/evm-mcp-server --http
  216. ```
  217. ### Running the Server Locally
  218. Start the server using stdio (for embedding in CLI tools):
  219. ```bash
  220. # Start the stdio server
  221. bun start
  222. # Development mode with auto-reload
  223. bun dev
  224. ```
  225. Or start the HTTP server with SSE for web applications:
  226. ```bash
  227. # Start the HTTP server
  228. bun start:http
  229. # Development mode with auto-reload
  230. bun dev:http
  231. ```
  232. ### Connecting to the Server
  233. Connect to this MCP server using any MCP-compatible client. For testing and debugging, you can use the [MCP Inspector](https://github.com/modelcontextprotocol/inspector).
  234. ### Connecting from Cursor
  235. To connect to the MCP server from Cursor:
  236. 1. Open Cursor and go to Settings (gear icon in the bottom left)
  237. 2. Click on "Features" in the left sidebar
  238. 3. Scroll down to "MCP Servers" section
  239. 4. Click "Add new MCP server"
  240. 5. Enter the following details:
  241. - Server name: `evm-mcp-server`
  242. - Type: `command`
  243. - Command: `npx @mcpdotdirect/evm-mcp-server`
  244. 6. Click "Save"
  245. 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.
  246. ### Using mcp.json with Cursor
  247. 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:
  248. ```json
  249. {
  250. "mcpServers": {
  251. "evm-mcp-server": {
  252. "command": "npx",
  253. "args": ["-y", "@mcpdotdirect/evm-mcp-server"]
  254. },
  255. "evm-mcp-http": {
  256. "command": "npx",
  257. "args": ["-y", "@mcpdotdirect/evm-mcp-server", "--http"]
  258. }
  259. }
  260. }
  261. ```
  262. 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:
  263. 1. Share MCP configurations with your team
  264. 2. Version control your MCP setup
  265. 3. Use different server configurations for different projects
  266. ### Example: HTTP Mode with SSE
  267. 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:
  268. ```json
  269. {
  270. "mcpServers": {
  271. "evm-mcp-sse": {
  272. "url": "http://localhost:3001/sse"
  273. }
  274. }
  275. }
  276. ```
  277. This connects directly to the HTTP server's SSE endpoint, which is useful for:
  278. - Web applications that need to connect to the MCP server from the browser
  279. - Environments where running local commands isn't ideal
  280. - Sharing a single MCP server instance among multiple users or applications
  281. To use this configuration:
  282. 1. Create a `.cursor` directory in your project root if it doesn't exist
  283. 2. Save the above JSON as `mcp.json` in the `.cursor` directory
  284. 3. Restart Cursor or open your project
  285. 4. Cursor will detect the configuration and offer to enable the server(s)
  286. ### Example: Using the MCP Server in Cursor
  287. After configuring the MCP server with `mcp.json`, you can easily use it in Cursor. Here's an example workflow:
  288. 1. Create a new JavaScript/TypeScript file in your project:
  289. ```javascript
  290. // blockchain-example.js
  291. async function main() {
  292. try {
  293. // Get ETH balance for an address using ENS
  294. console.log("Getting ETH balance for vitalik.eth...");
  295. // When using with Cursor, you can simply ask Cursor to:
  296. // "Check the ETH balance of vitalik.eth on mainnet"
  297. // Or "Transfer 0.1 ETH from my wallet to vitalik.eth"
  298. // Cursor will use the MCP server to execute these operations
  299. // without requiring any additional code from you
  300. // This is the power of the MCP integration - your AI assistant
  301. // can directly interact with blockchain data and operations
  302. } catch (error) {
  303. console.error("Error:", error.message);
  304. }
  305. }
  306. main();
  307. ```
  308. 2. With the file open in Cursor, you can ask Cursor to:
  309. - "Check the current ETH balance of vitalik.eth"
  310. - "Look up the price of USDC on Ethereum"
  311. - "Show me the latest block on Optimism"
  312. - "Check if 0x1234... is a contract address"
  313. 3. Cursor will use the MCP server to execute these operations and return the results directly in your conversation.
  314. The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language.
  315. ### Connecting using Claude CLI
  316. If you're using Claude CLI, you can connect to the MCP server with just two commands:
  317. ```bash
  318. # Add the MCP server
  319. claude mcp add evm-mcp-server npx @mcpdotdirect/evm-mcp-server
  320. # Start Claude with the MCP server enabled
  321. claude
  322. ```
  323. ### Example: Getting a Token Balance with ENS
  324. ```javascript
  325. // Example of using the MCP client to check a token balance using ENS
  326. const mcp = new McpClient("http://localhost:3000");
  327. const result = await mcp.invokeTool("get-token-balance", {
  328. tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC on Ethereum
  329. ownerAddress: "vitalik.eth", // ENS name instead of address
  330. network: "ethereum",
  331. });
  332. console.log(result);
  333. // {
  334. // tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  335. // owner: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  336. // network: "ethereum",
  337. // raw: "1000000000",
  338. // formatted: "1000",
  339. // symbol: "USDC",
  340. // decimals: 6
  341. // }
  342. ```
  343. ### Example: Resolving an ENS Name
  344. ```javascript
  345. // Example of using the MCP client to resolve an ENS name to an address
  346. const mcp = new McpClient("http://localhost:3000");
  347. const result = await mcp.invokeTool("resolve-ens", {
  348. ensName: "vitalik.eth",
  349. network: "ethereum",
  350. });
  351. console.log(result);
  352. // {
  353. // ensName: "vitalik.eth",
  354. // normalizedName: "vitalik.eth",
  355. // resolvedAddress: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
  356. // network: "ethereum"
  357. // }
  358. ```
  359. ### Example: Batch Multiple Calls with Multicall
  360. ```javascript
  361. // Example of using multicall to batch multiple contract reads in a single RPC call
  362. const mcp = new McpClient("http://localhost:3000");
  363. const result = await mcp.invokeTool("multicall", {
  364. network: "ethereum",
  365. calls: [
  366. {
  367. contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
  368. functionName: "balanceOf",
  369. args: ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"],
  370. },
  371. {
  372. contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
  373. functionName: "symbol",
  374. },
  375. {
  376. contractAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
  377. functionName: "decimals",
  378. },
  379. ],
  380. });
  381. console.log(result);
  382. // {
  383. // network: "ethereum",
  384. // totalCalls: 3,
  385. // successfulCalls: 3,
  386. // failedCalls: 0,
  387. // results: [
  388. // { contractAddress: "0xA0b...", functionName: "balanceOf", result: "1000000000", status: "success" },
  389. // { contractAddress: "0xA0b...", functionName: "symbol", result: "USDC", status: "success" },
  390. // { contractAddress: "0xA0b...", functionName: "decimals", result: "6", status: "success" }
  391. // ]
  392. // }
  393. ```
  394. ## 📚 API Reference
  395. ### Tools
  396. The server provides 25 focused MCP tools for agents. **All tools that accept address parameters support both Ethereum addresses and ENS names.**
  397. #### Wallet Information
  398. | Tool Name | Description | Key Parameters |
  399. | -------------------- | --------------------------------------------------------------- | -------------- |
  400. | `get_wallet_address` | Get the address of the configured wallet (from EVM_PRIVATE_KEY) | none |
  401. #### Network Information
  402. | Tool Name | Description | Key Parameters |
  403. | ------------------------ | ----------------------------------- | -------------- |
  404. | `get_chain_info` | Get network information | `network` |
  405. | `get_supported_networks` | List all supported EVM networks | none |
  406. | `get_gas_price` | Get current gas prices on a network | `network` |
  407. #### ENS Services
  408. | Tool Name | Description | Key Parameters |
  409. | -------------------- | ---------------------------------- | -------------------- |
  410. | `resolve_ens_name` | Resolve ENS name to address | `ensName`, `network` |
  411. | `lookup_ens_address` | Reverse lookup address to ENS name | `address`, `network` |
  412. #### Block & Transaction Information
  413. | Tool Name | Description | Key Parameters |
  414. | ------------------------- | --------------------------------- | --------------------------------------- |
  415. | `get_block` | Get block data | `blockNumber` or `blockHash`, `network` |
  416. | `get_latest_block` | Get latest block data | `network` |
  417. | `get_transaction` | Get transaction details | `txHash`, `network` |
  418. | `get_transaction_receipt` | Get transaction receipt with logs | `txHash`, `network` |
  419. | `wait_for_transaction` | Wait for transaction confirmation | `txHash`, `confirmations`, `network` |
  420. #### Balance & Token Information
  421. | Tool Name | Description | Key Parameters |
  422. | ------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------- |
  423. | `get_balance` | Get native token balance | `address` (address/ENS), `network` |
  424. | `get_token_balance` | Check ERC20 token balance | `tokenAddress` (address/ENS), `ownerAddress` (address/ENS), `network` |
  425. | `get_allowance` | Check token spending allowance | `tokenAddress` (address/ENS), `ownerAddress` (address/ENS), `spenderAddress` (address/ENS), `network` |
  426. #### Smart Contract Interactions
  427. | Tool Name | Description | Key Parameters |
  428. | ------------------ | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
  429. | `get_contract_abi` | Fetch contract ABI from block explorer (60+ networks) | `contractAddress` (address/ENS), `network` |
  430. | `read_contract` | Read smart contract state (auto-fetches ABI if needed) | `contractAddress`, `functionName`, `args[]`, `abiJson` (optional), `network` |
  431. | `write_contract` | Execute state-changing functions (auto-fetches ABI if needed) | `contractAddress`, `functionName`, `args[]`, `value` (optional), `abiJson` (optional), `network` |
  432. | `multicall` | Batch multiple read calls into a single RPC request (uses Multicall3) | `calls[]` (array of contract calls), `allowFailure` (optional), `network` |
  433. #### Token Transfers
  434. | Tool Name | Description | Key Parameters |
  435. | ------------------------ | ------------------------------ | --------------------------------------------------------------------------------- |
  436. | `transfer_native` | Send native tokens (ETH, etc.) | `to` (address/ENS), `amount`, `network` |
  437. | `transfer_erc20` | Transfer ERC20 tokens | `tokenAddress` (address/ENS), `to` (address/ENS), `amount`, `network` |
  438. | `approve_token_spending` | Approve token allowances | `tokenAddress` (address/ENS), `spenderAddress` (address/ENS), `amount`, `network` |
  439. #### NFT Services
  440. | Tool Name | Description | Key Parameters |
  441. | --------------------- | ------------------------- | -------------------------------------------------------------------------------- |
  442. | `get_nft_info` | Get NFT (ERC721) metadata | `tokenAddress` (address/ENS), `tokenId`, `network` |
  443. | `get_erc1155_balance` | Check ERC1155 balance | `tokenAddress` (address/ENS), `tokenId`, `ownerAddress` (address/ENS), `network` |
  444. #### Message Signing
  445. | Tool Name | Description | Key Parameters |
  446. | ----------------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------- |
  447. | `sign_message` | Sign arbitrary messages for authentication and verification (SIWE, off-chain signatures) | `message` |
  448. | `sign_typed_data` | Sign EIP-712 structured data for gasless transactions, permits, and meta-transactions | `domainJson`, `typesJson`, `primaryType`, `messageJson` |
  449. ### Resources
  450. 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.
  451. #### Blockchain Resources
  452. | Resource URI Pattern | Description |
  453. | ------------------------------------------- | ---------------------------------------- |
  454. | `evm://{network}/chain` | Chain information for a specific network |
  455. | `evm://chain` | Ethereum mainnet chain information |
  456. | `evm://{network}/block/{blockNumber}` | Block data by number |
  457. | `evm://{network}/block/latest` | Latest block data |
  458. | `evm://{network}/address/{address}/balance` | Native token balance |
  459. | `evm://{network}/tx/{txHash}` | Transaction details |
  460. | `evm://{network}/tx/{txHash}/receipt` | Transaction receipt with logs |
  461. #### Token Resources
  462. | Resource URI Pattern | Description |
  463. | ---------------------------------------------------------------------- | ------------------------------ |
  464. | `evm://{network}/token/{tokenAddress}` | ERC20 token information |
  465. | `evm://{network}/token/{tokenAddress}/balanceOf/{address}` | ERC20 token balance |
  466. | `evm://{network}/nft/{tokenAddress}/{tokenId}` | NFT (ERC721) token information |
  467. | `evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address}` | NFT ownership verification |
  468. | `evm://{network}/erc1155/{tokenAddress}/{tokenId}/uri` | ERC1155 token URI |
  469. | `evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address}` | ERC1155 token balance |
  470. ## 🔒 Security Considerations
  471. - **Private keys** are used only for transaction signing and are never stored by the server
  472. - Consider implementing additional authentication mechanisms for production use
  473. - Use HTTPS for the HTTP server in production environments
  474. - Implement rate limiting to prevent abuse
  475. - For high-value services, consider adding confirmation steps
  476. ## 📁 Project Structure
  477. ```
  478. mcp-evm-server/
  479. ├── src/
  480. │ ├── index.ts # Main stdio server entry point
  481. │ ├── server/ # Server-related files
  482. │ │ ├── http-server.ts # HTTP server with SSE
  483. │ │ └── server.ts # General server setup
  484. │ ├── core/
  485. │ │ ├── chains.ts # Chain definitions and utilities
  486. │ │ ├── resources.ts # MCP resources implementation
  487. │ │ ├── tools.ts # MCP tools implementation
  488. │ │ ├── prompts.ts # MCP prompts implementation
  489. │ │ └── services/ # Core blockchain services
  490. │ │ ├── index.ts # Operation exports
  491. │ │ ├── balance.ts # Balance services
  492. │ │ ├── transfer.ts # Token transfer services
  493. │ │ ├── utils.ts # Utility functions
  494. │ │ ├── tokens.ts # Token metadata services
  495. │ │ ├── contracts.ts # Contract interactions
  496. │ │ ├── transactions.ts # Transaction services
  497. │ │ └── blocks.ts # Block services
  498. │ │ └── clients.ts # RPC client utilities
  499. ├── package.json
  500. ├── tsconfig.json
  501. └── README.md
  502. ```
  503. ## 🛠️ Development
  504. To modify or extend the server:
  505. 1. Add new services in the appropriate file under `src/core/services/`
  506. 2. Register new tools in `src/core/tools.ts`
  507. 3. Register new resources in `src/core/resources.ts`
  508. 4. Add new network support in `src/core/chains.ts`
  509. 5. To change server configuration, edit the hardcoded values in `src/server/http-server.ts`
  510. ## 📄 License
  511. This project is licensed under the terms of the [MIT License](./LICENSE).

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.