### Install Dependencies Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Installs project dependencies using either Bun or npm package managers. ```bash git clone https://github.com/mcpdotdirect/mcp-evm-server.git cd mcp-evm-server bun install # Or with npm npm install ``` -------------------------------- ### Example Cursor Interaction with MCP Server Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Demonstrates how to interact with blockchain data and operations within Cursor using natural language prompts, leveraging the configured MCP server. ```javascript // 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(); ``` -------------------------------- ### Running the MCP EVM Server Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Commands to start the MCP EVM server in different modes. Use stdio for CLI tools and HTTP for web applications. Development modes include auto-reloading. ```bash npx @mcpdotdirect/evm-mcp-server npx @mcpdotdirect/evm-mcp-server --http bun start bun dev bun start:http bun dev:http ``` -------------------------------- ### Cursor MCP Server Configuration (mcp.json) Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Configuration file for integrating MCP servers with Cursor. Allows defining multiple server instances with different commands and arguments for project-specific setups. ```json { "mcpServers": { "evm-mcp-server": { "command": "npx", "args": [ "-y", "@mcpdotdirect/evm-mcp-server" ] }, "evm-mcp-http": { "command": "npx", "args": [ "-y", "@mcpdotdirect/evm-mcp-server", "--http" ] } } } ``` -------------------------------- ### Get Token Balance with ENS Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Demonstrates how to use the MCP client to retrieve a token balance for a given owner address, utilizing an ENS name for the owner. It specifies the token address, owner's ENS name, and the network. ```javascript 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); ``` -------------------------------- ### OTC MCP EVM Server Project Structure Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Outlines the directory and file structure of the OTC MCP EVM Server project. This includes the main entry point, server configurations, core services for blockchain interactions, and utility files. ```plaintext mcp-evm-server/ ├── src/ │ ├── index.ts # Main stdio server entry point │ ├── server/ │ │ ├── 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/ │ │ ├── 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 ``` -------------------------------- ### EVM MCP Server API Reference Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Provides an overview of the API endpoints and functionalities offered by the EVM MCP Server. This includes tools for interacting with blockchain data, managing tokens, and executing smart contract functions. ```APIDOC Tools: - getBlock: Retrieves block information by number, hash, or latest. - getTransaction: Fetches transaction details and receipt by hash. - getBalance: Gets native token balance for a given address. - getTokenBalance: Retrieves ERC20/ERC721/ERC1155 token balance for an address. - resolveENS: Resolves ENS names to Ethereum addresses. - getContract: Interacts with smart contracts for reading state or writing data. - transferNative: Transfers native tokens between addresses. - transferERC20: Transfers ERC20 tokens. - transferERC721: Transfers ERC721 NFTs. - transferERC1155: Transfers ERC1155 multi-tokens. - estimateGas: Estimates gas cost for a transaction. Resources: - ChainInfo: Provides information about supported EVM networks, including chainId and RPC endpoints. - TokenMetadata: Fetches metadata for ERC20, ERC721, and ERC1155 tokens. - ContractEvents: Retrieves and filters event logs from smart contracts. ``` -------------------------------- ### Claude CLI MCP Server Integration Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Commands to add and enable the MCP server for use with the Claude CLI, allowing AI-assisted operations within the CLI environment. ```bash # Add the MCP server claude mcp add evm-mcp-server npx @mcpdotdirect/evm-mcp-server # Start Claude with the MCP server enabled claude ``` -------------------------------- ### Cursor HTTP SSE Server Configuration (mcp.json) Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Configuration for connecting Cursor directly to an HTTP MCP server's Server-Sent Events (SSE) endpoint. Useful for browser-based applications or shared server instances. ```json { "mcpServers": { "evm-mcp-sse": { "url": "http://localhost:3001/sse" } } } ``` -------------------------------- ### MCP Tools API Reference Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Provides a reference for the MCP tools available for agents, categorized into Token services and Blockchain services. All tools supporting address parameters accept both Ethereum addresses and ENS names. ```APIDOC Tools: Token services: - get-token-info: Get ERC20 token metadata. Key Parameters: `tokenAddress` (address/ENS), `network` - get-token-balance: Check ERC20 token balance. Key Parameters: `tokenAddress` (address/ENS), `ownerAddress` (address/ENS), `network` - transfer-token: Transfer ERC20 tokens. Key Parameters: `privateKey`, `tokenAddress` (address/ENS), `toAddress` (address/ENS), `amount`, `network` - approve-token-spending: Approve token allowances. Key Parameters: `privateKey`, `tokenAddress` (address/ENS), `spenderAddress` (address/ENS), `amount`, `network` - get-nft-info: Get NFT metadata. Key Parameters: `tokenAddress` (address/ENS), `tokenId`, `network` - check-nft-ownership: Verify NFT ownership. Key Parameters: `tokenAddress` (address/ENS), `tokenId`, `ownerAddress` (address/ENS), `network` - transfer-nft: Transfer an NFT. Key Parameters: `privateKey`, `tokenAddress` (address/ENS), `tokenId`, `toAddress` (address/ENS), `network` - get-nft-balance: Count NFTs owned. Key Parameters: `tokenAddress` (address/ENS), `ownerAddress` (address/ENS), `network` - get-erc1155-token-uri: Get ERC1155 metadata. Key Parameters: `tokenAddress` (address/ENS), `tokenId`, `network` - get-erc1155-balance: Check ERC1155 balance. Key Parameters: `tokenAddress` (address/ENS), `tokenId`, `ownerAddress` (address/ENS), `network` - transfer-erc1155: Transfer ERC1155 tokens. Key Parameters: `privateKey`, `tokenAddress` (address/ENS), `tokenId`, `amount`, `toAddress` (address/ENS), `network` Blockchain services: - get-chain-info: Get network information. Key Parameters: `network` - get-balance: Get native token balance. Key Parameters: `address` (address/ENS), `network` - transfer-eth: Send native tokens. Key Parameters: `privateKey`, `to` (address/ENS), `amount`, `network` - get-transaction: Get transaction details. Key Parameters: `txHash`, `network` - read-contract: Read smart contract state. Key Parameters: `contractAddress` (address/ENS), `abi`, `functionName`, `args`, `network` - write-contract: Write to smart contract. Key Parameters: `contractAddress` (address/ENS), `abi`, `functionName`, `args`, `privateKey`, `network` - is-contract: Check if address is a contract. Key Parameters: `address` (address/ENS), `network` - resolve-ens: Resolve ENS name to address. Key Parameters: `ensName`, `network` ``` -------------------------------- ### EVM Token Resources API Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Defines the API endpoints for retrieving information and balances of ERC20 tokens, ERC721 NFTs, and ERC1155 tokens on EVM-compatible networks. These resources allow querying token details, balances, and ownership. ```APIDOC Resource URI Patterns: - `evm://{network}/token/{tokenAddress}` - Description: ERC20 token information. - `evm://{network}/token/{tokenAddress}/balanceOf/{address}` - Description: ERC20 token balance for a specific address. - `evm://{network}/nft/{tokenAddress}/{tokenId}` - Description: NFT (ERC721) token information. - `evm://{network}/nft/{tokenAddress}/{tokenId}/isOwnedBy/{address}` - Description: NFT ownership verification for a specific address. - `evm://{network}/erc1155/{tokenAddress}/{tokenId}/uri` - Description: ERC1155 token URI. - `evm://{network}/erc1155/{tokenAddress}/{tokenId}/balanceOf/{address}` - Description: ERC1155 token balance for a specific address. ``` -------------------------------- ### MCP Resources API Reference Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Details the MCP resource URIs for accessing blockchain data. These URIs support ENS names, which are automatically resolved to addresses. Includes patterns for chain information, blocks, addresses, and transactions. ```APIDOC Resources: Blockchain Resources: - `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. ``` -------------------------------- ### Resolve ENS Name to Address Source: https://github.com/otc-ai/otc-mcp/blob/main/README.md Shows how to use the MCP client to resolve an Ethereum Name Service (ENS) name to its corresponding blockchain address. It requires the ENS name and the network. ```javascript const mcp = new McpClient("http://localhost:3000"); const result = await mcp.invokeTool("resolve-ens", { ensName: "vitalik.eth", network: "ethereum" }); console.log(result); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.