web3-tools-mcp 1.2.0 โ†’ 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +91 -228
  2. package/package.json +5 -5
  3. package/dist/package.json +0 -63
  4. package/dist/test/tools/advanced.test.d.ts +0 -2
  5. package/dist/test/tools/advanced.test.d.ts.map +0 -1
  6. package/dist/test/tools/advanced.test.js +0 -235
  7. package/dist/test/tools/advanced.test.js.map +0 -1
  8. package/dist/test/tools/balance.test.d.ts +0 -2
  9. package/dist/test/tools/balance.test.d.ts.map +0 -1
  10. package/dist/test/tools/balance.test.js +0 -167
  11. package/dist/test/tools/balance.test.js.map +0 -1
  12. package/dist/test/tools/contract-info.test.d.ts +0 -2
  13. package/dist/test/tools/contract-info.test.d.ts.map +0 -1
  14. package/dist/test/tools/contract-info.test.js +0 -286
  15. package/dist/test/tools/contract-info.test.js.map +0 -1
  16. package/dist/test/tools/contract.test.d.ts +0 -2
  17. package/dist/test/tools/contract.test.d.ts.map +0 -1
  18. package/dist/test/tools/contract.test.js +0 -234
  19. package/dist/test/tools/contract.test.js.map +0 -1
  20. package/dist/test/tools/ens.test.d.ts +0 -2
  21. package/dist/test/tools/ens.test.d.ts.map +0 -1
  22. package/dist/test/tools/ens.test.js +0 -236
  23. package/dist/test/tools/ens.test.js.map +0 -1
  24. package/dist/test/tools/logs.test.d.ts +0 -2
  25. package/dist/test/tools/logs.test.d.ts.map +0 -1
  26. package/dist/test/tools/logs.test.js +0 -196
  27. package/dist/test/tools/logs.test.js.map +0 -1
  28. package/dist/test/tools/signatures.test.d.ts +0 -2
  29. package/dist/test/tools/signatures.test.d.ts.map +0 -1
  30. package/dist/test/tools/signatures.test.js +0 -112
  31. package/dist/test/tools/signatures.test.js.map +0 -1
package/README.md CHANGED
@@ -1,274 +1,137 @@
1
1
  # Web3 Tools MCP Server
2
2
 
3
- A Model Context Protocol (MCP) server that provides comprehensive blockchain interaction capabilities using [viem](https://viem.sh/), [Etherscan APIs](https://etherscan.io), and [Hypersync](https://docs.envio.dev/docs/HyperSync/overview). This server enables AI assistants to interact with multiple blockchain networks, query contract data, analyze transactions, and work with smart contracts with enhanced performance and reliability.
3
+ A Model Context Protocol (MCP) server for blockchain interactions using [viem](https://viem.sh/), [Etherscan](https://etherscan.io), and [Hypersync](https://docs.envio.dev/docs/HyperSync/overview).
4
4
 
5
- ## ๐Ÿ“ฆ Installation & Setup
5
+ ## Features
6
6
 
7
- ### Quick Start (Recommended)
8
- The easiest way to use this MCP server is with `npx` - no installation required! Add it directly to your MCP client configuration.
7
+ - Multi-chain support (Ethereum, Base, Arbitrum, Polygon, Optimism, Celo)
8
+ - Smart contract interactions (read functions, ABI retrieval, source code)
9
+ - ENS resolution (names โ†” addresses, text records, avatars)
10
+ - Token balances (native & ERC20, batch queries)
11
+ - Event log queries with Hypersync acceleration
12
+ - Transaction tracing and analysis
13
+ - Storage slot reading with type decoding
9
14
 
10
- ### MCP Client Configuration
11
- Add to your MCP client configuration (e.g., Claude Desktop `config.json`):
15
+ ## Quick Start
12
16
 
13
- ```json
14
- {
15
- "mcp": {
16
- "servers": {
17
- "web3-tools": {
18
- "command": "npx",
19
- "args": [
20
- "-y",
21
- "web3-tools-mcp",
22
- "--etherscan-api-key",
23
- "YOUR_ETHERSCAN_API_KEY",
24
- "--hypersync-api-key",
25
- "YOUR_HYPERSYNC_API_KEY"
26
- ]
27
- }
28
- }
29
- }
30
- }
31
- ```
32
-
33
- **Why npx?**
34
- - โœ… No global installation required
35
- - โœ… Always uses the latest version
36
- - โœ… Automatic dependency management
37
- - โœ… Works across different environments
38
-
39
- ### Alternative: Global Installation
40
- If you prefer to install globally:
17
+ ### Claude Code
41
18
  ```bash
42
- npm install -g web3-tools-mcp
19
+ claude mcp add --scope user --transport stdio web3-tools -- npx -y web3-tools-mcp
43
20
  ```
44
21
 
45
- Then use in your MCP config:
22
+ ### Claude Desktop
23
+ Add to `config.json`:
46
24
  ```json
47
25
  {
48
- "mcp": {
49
- "servers": {
50
- "web3-tools": {
51
- "command": "web3-tools-mcp",
52
- "args": [
53
- "--etherscan-api-key", "YOUR_ETHERSCAN_API_KEY",
54
- "--hypersync-api-key", "YOUR_HYPERSYNC_API_KEY"
55
- ]
56
- }
26
+ "mcpServers": {
27
+ "web3-tools": {
28
+ "command": "npx",
29
+ "args": ["-y", "web3-tools-mcp"]
57
30
  }
58
31
  }
59
32
  }
60
33
  ```
61
34
 
62
- ### Command Line Usage
63
- You can also run the server directly:
64
- ```bash
65
- # Using npx (recommended)
66
- npx web3-tools-mcp --etherscan-api-key YOUR_KEY --hypersync-api-key YOUR_KEY
67
-
68
- # Or if globally installed
69
- web3-tools-mcp --etherscan-api-key YOUR_KEY --hypersync-api-key YOUR_KEY
70
- ```
71
-
72
- ### Environment Variables
73
- Alternative to command line arguments:
74
- ```bash
75
- export ETHERSCAN_API_KEY=your_etherscan_key_here
76
- export HYPERSYNC_API_KEY=your_hypersync_key_here
77
- export ALCHEMY_API_KEY=your_alchemy_key_here # optional
78
- export INFURA_API_KEY=your_infura_key_here # optional
79
- npx web3-tools-mcp
80
- ```
81
-
82
- ### API Keys
83
- - **Etherscan API Key**: Required for contract ABI fetching and verification status
84
- - Get free API key at [etherscan.io/apis](https://etherscan.io/apis)
85
- - **Hypersync API Key**: Required for fast event log querying
86
- - Get free API key at [hypersync.xyz](https://hypersync.xyz)
87
- - **Alchemy API Key**: Optional, provides enhanced RPC reliability
88
- - Get free API key at [alchemy.com](https://alchemy.com)
89
- - **Infura API Key**: Optional, additional RPC provider for failover
90
- - Get free API key at [infura.io](https://infura.io)
91
-
92
- ## ๐ŸŒŸ Key Features
93
-
94
- - **Multi-chain Support**: Works with Ethereum mainnet, Base, Arbitrum, Polygon, Optimism, Celo, and localhost
95
- - **ENS Name Resolution**: Resolve ENS names to addresses, reverse lookup addresses to names, and query ENS records
96
- - **Smart Contract Interactions**: Call view/pure functions, get contract ABIs, and analyze contract bytecode
97
- - **Event Log Analysis**: Query and decode blockchain events with flexible filtering
98
- - **Token Operations**: Get native and ERC20 token balances for single or multiple addresses
99
- - **ABI Utilities**: Generate function, event, and error signatures from ABI definitions
100
- - **Batch Operations**: Execute multiple contract calls, balance queries, or ENS resolutions efficiently
101
- - **Transaction Analysis**: Trace transactions for detailed execution information
102
- - **Enhanced RPC Support**: Automatic failover between providers (Alchemy, Infura, public RPCs)
103
- - **Hypersync Integration**: Fast event log querying with fallback support
104
-
105
- ## ๐Ÿš€ Supported Blockchain Networks
106
-
107
- | Network | Chain ID | Default RPC | Hypersync Support |
108
- |---------|----------|-------------|------------------|
109
- | Ethereum Mainnet | 1 | โœ… | โœ… |
110
- | Base | 8453 | โœ… | โœ… |
111
- | Arbitrum One | 42161 | โœ… | โœ… |
112
- | Polygon | 137 | โœ… | โœ… |
113
- | Optimism | 10 | โœ… | โœ… |
114
- | Celo | 42220 | โœ… | โŒ |
115
- | Localhost | 31337 | โœ… | โŒ |
116
-
117
- ## ๐Ÿ›  Available Tools
118
-
119
- ### 1. ABI Signature Tools
120
-
121
- #### `get_function_signature`
122
- Generate 4-byte function selectors from ABI definitions. Supports batch operations for multiple functions at once.
35
+ ## API Keys (Optional)
123
36
 
124
- #### `get_event_signature`
125
- Generate 32-byte event signatures (topic0) from ABI definitions. Supports batch operations for multiple events at once.
37
+ All API keys are optional. The server uses public RPCs by default. Add keys to unlock additional features:
126
38
 
127
- #### `get_error_signature`
128
- Generate 4-byte error selectors from ABI definitions. Supports batch operations for multiple errors at once.
39
+ **Configuration options:**
40
+ - `--etherscan-api-key` or `ETHERSCAN_API_KEY` - Enables contract ABI/source retrieval
41
+ - `--hypersync-api-key` or `HYPERSYNC_API_KEY` - Fast event queries (10-100x faster)
42
+ - `--alchemy-api-key` or `ALCHEMY_API_KEY` - Enhanced RPC reliability
43
+ - `--infura-api-key` or `INFURA_API_KEY` - Additional RPC provider
44
+ - `--custom-rpc` - Custom RPC URLs as JSON
129
45
 
130
- ### 2. Contract Interaction Tools
46
+ **Get free API keys:**
47
+ - Etherscan: [etherscan.io/apis](https://etherscan.io/apis)
48
+ - Hypersync: [hypersync.xyz](https://hypersync.xyz)
49
+ - Alchemy: [alchemy.com](https://alchemy.com)
50
+ - Infura: [infura.io](https://infura.io)
131
51
 
132
- #### `call_contract_function`
133
- Call view/pure functions on smart contracts. Supports batch operations for executing multiple calls efficiently across different contracts and chains.
134
-
135
- #### `get_contract_abi`
136
- Get comprehensive contract information including ABI, proxy detection, compilation info, creation info, and verification status from Etherscan. Includes smart caching for performance.
137
-
138
- #### `get_contract_source_code`
139
- Retrieve verified contract source code from Etherscan with proxy support and flexible output options (full source, summary, or metadata only). Features smart caching.
140
-
141
- #### `get_contract_source_file`
142
- Retrieve specific source file from cached contract data. Use after calling `get_contract_source_code` with full source option.
143
-
144
- #### `is_contract`
145
- Check if an address is a smart contract or EOA (Externally Owned Account). Returns contract status and bytecode length.
146
-
147
- ### 3. ENS (Ethereum Name Service) Tools
148
-
149
- #### `resolve_ens_name`
150
- Resolve an ENS name to its Ethereum address. ENS names are human-readable identifiers (like vitalik.eth) that resolve to Ethereum addresses. Returns the resolved address or null if not found.
151
-
152
- #### `reverse_resolve_ens`
153
- Reverse resolve an Ethereum address to its primary ENS name. Returns the ENS name if the address has set a reverse record, useful for displaying human-readable names for addresses.
154
-
155
- #### `get_ens_text_record`
156
- Retrieve text records from an ENS name. Common text record keys include:
157
- - `avatar`: Avatar image URL
158
- - `description`: Description text
159
- - `email`: Email address
160
- - `url`: Website URL
161
- - `com.twitter`: Twitter handle
162
- - `com.github`: GitHub username
163
-
164
- #### `get_ens_avatar`
165
- Get the avatar URI for an ENS name. Returns the avatar URL if set, which can be an HTTPS URL, IPFS hash, or NFT reference.
166
-
167
- #### `batch_resolve_ens_names`
168
- Resolve multiple ENS names to addresses in a single batch operation for improved efficiency. Returns results for all names with success/failure status.
52
+ **Example with API keys:**
53
+ ```bash
54
+ # Claude Code
55
+ claude mcp add --scope user --transport stdio web3-tools -- npx -y web3-tools-mcp --etherscan-api-key YOUR_KEY --hypersync-api-key YOUR_KEY
169
56
 
170
- ### 4. Balance Query Tools
57
+ # Environment variables
58
+ export ETHERSCAN_API_KEY=your_key
59
+ export HYPERSYNC_API_KEY=your_key
60
+ npx web3-tools-mcp
61
+ ```
171
62
 
172
- #### `get_balance`
173
- Get native or ERC20 token balances for single or multiple addresses efficiently. Supports batch operations for optimal performance. Omit `tokenAddress` for native balance, include it for ERC20 tokens.
63
+ ## Supported Networks
174
64
 
175
- ### 5. Event Log Tools
65
+ | Network | Chain ID | Hypersync |
66
+ |---------|----------|-----------|
67
+ | Ethereum | 1 | โœ… |
68
+ | Base | 8453 | โœ… |
69
+ | Arbitrum | 42161 | โœ… |
70
+ | Polygon | 137 | โœ… |
71
+ | Optimism | 10 | โœ… |
72
+ | Celo | 42220 | โŒ |
73
+ | Localhost | 31337 | โŒ |
176
74
 
177
- #### `get_logs`
178
- Query contract events with decoded output and parameter filtering. Automatically falls back to Hypersync for supported chains when needed. Supports filtering by contract address, block range, and indexed event parameters.
75
+ ## Available Tools
179
76
 
180
- ### 6. Advanced Tools
77
+ ### Signatures
78
+ - `get_function_signature` - Generate 4-byte function selectors
79
+ - `get_event_signature` - Generate 32-byte event topic0 hashes
80
+ - `get_error_signature` - Generate 4-byte error selectors
181
81
 
182
- #### `get_storage_at`
183
- Read raw storage data from a contract with ABI-based decoding. Supports various types like uint256, address, bool, bytes32, etc.
82
+ ### Contract Info
83
+ - `get_contract_abi` - Get ABI with proxy detection and verification status
84
+ - `get_contract_source_code` - Get verified source code with proxy support
85
+ - `get_contract_source_file` - Retrieve specific source file from cache
86
+ - `is_contract` - Check if address is contract or EOA
184
87
 
185
- #### `get_block_info`
186
- Get comprehensive block information including timestamp, hash, parent hash, and formatted dates. Defaults to latest block if not specified.
88
+ ### Contract Interaction
89
+ - `call_contract_function` - Call view/pure functions (supports batch)
187
90
 
188
- #### `trace_transaction`
189
- Trace a transaction to see detailed execution information including internal calls, state changes, and gas usage. Supports multiple trace types: `trace` (call tree), `vmTrace` (VM execution), `stateDiff` (state changes).
91
+ ### ENS
92
+ - `resolve_ens_name` - ENS name โ†’ address
93
+ - `reverse_resolve_ens` - Address โ†’ ENS name
94
+ - `get_ens_text_record` - Get text records (avatar, email, twitter, etc.)
95
+ - `get_ens_avatar` - Get avatar URI
96
+ - `batch_resolve_ens_names` - Batch resolve multiple names
190
97
 
191
- ## โš™๏ธ Configuration
98
+ ### Balances
99
+ - `get_balance` - Get native or ERC20 balances (supports batch)
192
100
 
193
- The server supports multiple configuration options through environment variables or command-line arguments:
101
+ ### Events & Logs
102
+ - `get_logs` - Query and decode events with Hypersync fallback
194
103
 
195
- ### API Keys
196
- - `ETHERSCAN_API_KEY` / `--etherscan-api-key`: For contract ABI retrieval
197
- - `ALCHEMY_API_KEY` / `--alchemy-api-key`: Enhanced RPC endpoints
198
- - `INFURA_API_KEY` / `--infura-api-key`: Alternative RPC provider
199
- - `HYPERSYNC_API_KEY` / `--hypersync-api-key`: Fast event log querying
104
+ ### Advanced
105
+ - `get_storage_at` - Read storage slots with type decoding
106
+ - `get_block_info` - Get block data (timestamp, hash, etc.)
107
+ - `trace_transaction` - Trace execution (call tree, VM, state diff)
200
108
 
201
- ### Custom RPC URLs
202
- - `--custom-rpc`: JSON object with custom RPC URLs per chain
109
+ ## Advanced Configuration
203
110
 
204
- **Example:**
111
+ ### Custom RPC
205
112
  ```bash
206
- npx web3-tools-mcp --custom-rpc '{"mainnet": "https://my-custom-rpc.com", "base": "https://base-rpc.com"}'
113
+ npx web3-tools-mcp --custom-rpc '{"mainnet":"https://my-rpc.com","base":"https://base-rpc.com"}'
207
114
  ```
208
115
 
209
- ## ๐Ÿ”ง Technical Features
210
-
211
- ### Enhanced RPC Configuration
212
- - **Automatic Provider Selection**: Prioritizes Alchemy โ†’ Infura โ†’ Public RPCs
213
- - **Custom RPC Support**: Override default providers with custom endpoints
214
- - **Failover Mechanisms**: Graceful handling of RPC failures
215
-
216
- ### Hypersync Integration
217
- - **Fast Event Queries**: Significantly faster than traditional RPC for event logs
218
- - **Automatic Fallback**: Falls back to regular viem when Hypersync fails
219
- - **Selective Support**: Available for mainnet, Base, Arbitrum, Polygon, and Optimism
220
-
221
- ### Data Type Handling
222
- - **BigInt Serialization**: Automatic conversion of BigInt values to strings for JSON compatibility
223
- - **Type Conversion**: Smart conversion of arguments based on ABI parameter types
224
- - **Error Handling**: Comprehensive error messages and graceful failure handling
116
+ ### RPC Failover
117
+ Automatic provider selection: Alchemy โ†’ Infura โ†’ Public RPCs
225
118
 
226
119
  ### Batch Operations
227
- - **Multicall Support**: Execute multiple contract calls efficiently
228
- - **Balance Batching**: Query multiple balances in parallel
229
- - **Result Aggregation**: Organized results with success/failure tracking
230
-
231
- ## ๐Ÿ“‹ Requirements
232
-
233
- - **Runtime**: Node.js v20.0.0 or higher
234
- - **Package Manager**: npm (recommended) or yarn/pnpm
235
- - **Dependencies**: viem, @envio-dev/hypersync-client, @modelcontextprotocol/sdk
236
- - **Network Access**: Internet connection for blockchain RPC calls
120
+ Many tools support batching for improved efficiency (contract calls, balances, ENS resolution).
237
121
 
238
- ## ๐Ÿงช Testing
122
+ ## Requirements
239
123
 
240
- The server includes a comprehensive test suite with 70 tests covering all functionality:
124
+ - Node.js โ‰ฅ 20.0.0
125
+ - Internet connection for RPC calls
241
126
 
242
- ### Running Tests
127
+ ## Testing
243
128
 
244
129
  ```bash
245
- # Run all tests
246
- npm test
247
-
248
- # Run tests in watch mode
249
- npm run test:watch
250
-
251
- # Run tests with UI
252
- npm run test:ui
130
+ npm test # Run all tests
131
+ npm run test:watch # Watch mode
132
+ npm run test:ui # UI mode
253
133
  ```
254
134
 
255
- ## ๐Ÿ”— Related Tools
256
-
257
- This server is designed to work seamlessly with other blockchain development tools and can be used alongside:
258
- - Block explorers (Etherscan, Basescan, etc.)
259
- - DeFi protocols analysis
260
- - Smart contract development workflows
261
- - Token analysis and portfolio tracking
262
- - Event monitoring and alerting systems
263
-
264
- ## ๐ŸŽฏ Use Cases
265
-
266
- - **Smart Contract Analysis**: Analyze contract behavior, storage, and interactions
267
- - **Token Research**: Query token balances, transfers, and metadata
268
- - **DeFi Protocol Monitoring**: Track liquidity, swaps, and protocol events
269
- - **Transaction Analysis**: Understand complex transaction flows and internal calls
270
- - **Multi-chain Portfolio Tracking**: Monitor assets across different networks
271
- - **Event-driven Analysis**: Build insights from blockchain event data
272
- - **Contract Verification**: Check contract deployment and proxy patterns
135
+ ## License
273
136
 
274
- This MCP server provides a comprehensive toolkit for blockchain interaction, making it easy for AI assistants to help users analyze, query, and understand blockchain data across multiple networks.
137
+ MIT
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "web3-tools-mcp",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Model Context Protocol server for blockchain interactions using viem, Etherscan, and Hypersync",
5
5
  "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
6
+ "main": "dist/src/index.js",
7
+ "types": "dist/src/index.d.ts",
8
8
  "bin": {
9
- "web3-tools-mcp": "dist/index.js"
9
+ "web3-tools-mcp": "dist/src/index.js"
10
10
  },
11
11
  "files": [
12
- "dist",
12
+ "dist/src",
13
13
  "README.md",
14
14
  "LICENSE",
15
15
  "src"
package/dist/package.json DELETED
@@ -1,63 +0,0 @@
1
- {
2
- "name": "web3-tools-mcp",
3
- "version": "1.2.0",
4
- "description": "Model Context Protocol server for blockchain interactions using viem, Etherscan, and Hypersync",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "bin": {
9
- "web3-tools-mcp": "dist/index.js"
10
- },
11
- "files": [
12
- "dist",
13
- "README.md",
14
- "LICENSE",
15
- "src"
16
- ],
17
- "engines": {
18
- "node": ">=20.0.0"
19
- },
20
- "scripts": {
21
- "clean": "rm -rf dist",
22
- "build": "npm run clean && tsc",
23
- "watch": "tsc --watch",
24
- "prepare": "npm run build",
25
- "test": "vitest run",
26
- "test:watch": "vitest",
27
- "test:ui": "vitest --ui"
28
- },
29
- "keywords": [
30
- "mcp",
31
- "ethereum",
32
- "viem",
33
- "blockchain",
34
- "web3",
35
- "ens",
36
- "ethereum-name-service",
37
- "model-context-protocol",
38
- "ai"
39
- ],
40
- "author": "Benjamin Hajnal <hajnalbenjamin@gmail.com>",
41
- "license": "MIT",
42
- "repository": {
43
- "type": "git",
44
- "url": "git+https://github.com/hajnalben/web3-tools-mcp.git"
45
- },
46
- "bugs": {
47
- "url": "https://github.com/hajnalben/web3-tools-mcp/issues"
48
- },
49
- "homepage": "https://github.com/hajnalben/web3-tools-mcp#readme",
50
- "dependencies": {
51
- "@envio-dev/hypersync-client": "^0.6.5",
52
- "@modelcontextprotocol/sdk": "^1.20.1",
53
- "viem": "^2.31.4",
54
- "zod": "^3.25.76"
55
- },
56
- "devDependencies": {
57
- "@types/node": "^20.19.23",
58
- "@vitest/ui": "^3.2.4",
59
- "dotenv": "^17.2.3",
60
- "typescript": "^5.0.0",
61
- "vitest": "^3.2.4"
62
- }
63
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=advanced.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"advanced.test.d.ts","sourceRoot":"","sources":["../../../test/tools/advanced.test.ts"],"names":[],"mappings":""}