web3-tools-mcp 1.0.0 → 1.1.0
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.
- package/README.md +92 -259
- package/dist/client.d.ts +1653 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +142 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -28274
- package/dist/index.js.map +1 -0
- package/dist/package.json +60 -0
- package/dist/src/client.d.ts +1653 -0
- package/dist/src/client.d.ts.map +1 -0
- package/dist/src/client.js +142 -0
- package/dist/src/client.js.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +88 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/tools/advanced.d.ts +75 -0
- package/dist/src/tools/advanced.d.ts.map +1 -0
- package/dist/src/tools/advanced.js +234 -0
- package/dist/src/tools/advanced.js.map +1 -0
- package/dist/src/tools/balance.d.ts +55 -0
- package/dist/src/tools/balance.d.ts.map +1 -0
- package/dist/src/tools/balance.js +146 -0
- package/dist/src/tools/balance.js.map +1 -0
- package/dist/src/tools/contract-info.d.ts +79 -0
- package/dist/src/tools/contract-info.d.ts.map +1 -0
- package/dist/src/tools/contract-info.js +450 -0
- package/dist/src/tools/contract-info.js.map +1 -0
- package/dist/src/tools/contract.d.ts +79 -0
- package/dist/src/tools/contract.d.ts.map +1 -0
- package/dist/src/tools/contract.js +140 -0
- package/dist/src/tools/contract.js.map +1 -0
- package/dist/src/tools/index.d.ts +3 -0
- package/dist/src/tools/index.d.ts.map +1 -0
- package/dist/src/tools/index.js +27 -0
- package/dist/src/tools/index.js.map +1 -0
- package/dist/src/tools/logs.d.ts +39 -0
- package/dist/src/tools/logs.d.ts.map +1 -0
- package/dist/src/tools/logs.js +231 -0
- package/dist/src/tools/logs.js.map +1 -0
- package/dist/src/tools/signatures.d.ts +83 -0
- package/dist/src/tools/signatures.d.ts.map +1 -0
- package/dist/src/tools/signatures.js +93 -0
- package/dist/src/tools/signatures.js.map +1 -0
- package/dist/src/types.d.ts +22 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils.d.ts +22 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +183 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/test/mcp-client.test.d.ts +2 -0
- package/dist/test/mcp-client.test.d.ts.map +1 -0
- package/dist/test/mcp-client.test.js +376 -0
- package/dist/test/mcp-client.test.js.map +1 -0
- package/dist/test/tools/advanced.test.d.ts +2 -0
- package/dist/test/tools/advanced.test.d.ts.map +1 -0
- package/dist/test/tools/advanced.test.js +235 -0
- package/dist/test/tools/advanced.test.js.map +1 -0
- package/dist/test/tools/balance.test.d.ts +2 -0
- package/dist/test/tools/balance.test.d.ts.map +1 -0
- package/dist/test/tools/balance.test.js +167 -0
- package/dist/test/tools/balance.test.js.map +1 -0
- package/dist/test/tools/contract-info.test.d.ts +2 -0
- package/dist/test/tools/contract-info.test.d.ts.map +1 -0
- package/dist/test/tools/contract-info.test.js +286 -0
- package/dist/test/tools/contract-info.test.js.map +1 -0
- package/dist/test/tools/contract.test.d.ts +2 -0
- package/dist/test/tools/contract.test.d.ts.map +1 -0
- package/dist/test/tools/contract.test.js +234 -0
- package/dist/test/tools/contract.test.js.map +1 -0
- package/dist/test/tools/logs.test.d.ts +2 -0
- package/dist/test/tools/logs.test.d.ts.map +1 -0
- package/dist/test/tools/logs.test.js +196 -0
- package/dist/test/tools/logs.test.js.map +1 -0
- package/dist/test/tools/signatures.test.d.ts +2 -0
- package/dist/test/tools/signatures.test.d.ts.map +1 -0
- package/dist/test/tools/signatures.test.js +112 -0
- package/dist/test/tools/signatures.test.js.map +1 -0
- package/dist/tools/advanced.d.ts +75 -0
- package/dist/tools/advanced.d.ts.map +1 -0
- package/dist/tools/advanced.js +234 -0
- package/dist/tools/advanced.js.map +1 -0
- package/dist/tools/balance.d.ts +55 -0
- package/dist/tools/balance.d.ts.map +1 -0
- package/dist/tools/balance.js +146 -0
- package/dist/tools/balance.js.map +1 -0
- package/dist/tools/batch.d.ts +122 -0
- package/dist/tools/batch.d.ts.map +1 -0
- package/dist/tools/batch.js +243 -0
- package/dist/tools/batch.js.map +1 -0
- package/dist/tools/contract-info.d.ts +79 -0
- package/dist/tools/contract-info.d.ts.map +1 -0
- package/dist/tools/contract-info.js +450 -0
- package/dist/tools/contract-info.js.map +1 -0
- package/dist/tools/contract.d.ts +79 -0
- package/dist/tools/contract.d.ts.map +1 -0
- package/dist/tools/contract.js +140 -0
- package/dist/tools/contract.js.map +1 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +27 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/logs.d.ts +39 -0
- package/dist/tools/logs.d.ts.map +1 -0
- package/dist/tools/logs.js +231 -0
- package/dist/tools/logs.js.map +1 -0
- package/dist/tools/signatures.d.ts +83 -0
- package/dist/tools/signatures.d.ts.map +1 -0
- package/dist/tools/signatures.js +93 -0
- package/dist/tools/signatures.js.map +1 -0
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +22 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +183 -0
- package/dist/utils.js.map +1 -0
- package/package.json +35 -23
- package/src/client.ts +160 -0
- package/src/index.ts +96 -0
- package/src/tools/advanced.ts +262 -0
- package/src/tools/balance.ts +176 -0
- package/src/tools/contract-info.ts +582 -0
- package/src/tools/contract.ts +180 -0
- package/src/tools/index.ts +35 -0
- package/src/tools/logs.ts +291 -0
- package/src/tools/signatures.ts +126 -0
- package/src/types.ts +29 -0
- package/src/utils.ts +222 -0
- package/dist/hypersync-client.darwin-arm64-7fegfwn5.node +0 -0
package/README.md
CHANGED
|
@@ -1,37 +1,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Web3 Tools MCP Server
|
|
2
2
|
|
|
3
|
-
A Model Context Protocol (MCP) server that provides comprehensive blockchain interaction capabilities using
|
|
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.
|
|
4
4
|
|
|
5
|
-
## 📦 Installation
|
|
5
|
+
## 📦 Installation & Setup
|
|
6
6
|
|
|
7
|
-
###
|
|
8
|
-
|
|
9
|
-
npm install -g web3-tools-mcp
|
|
10
|
-
```
|
|
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.
|
|
11
9
|
|
|
12
|
-
###
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
web3-tools-mcp
|
|
16
|
-
```
|
|
10
|
+
### MCP Client Configuration
|
|
11
|
+
Add to your MCP client configuration (e.g., Claude Desktop `config.json`):
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
}
|
|
21
31
|
```
|
|
22
32
|
|
|
23
|
-
|
|
24
|
-
|
|
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:
|
|
25
41
|
```bash
|
|
26
|
-
|
|
27
|
-
export ALCHEMY_API_KEY=your_key_here
|
|
28
|
-
export INFURA_API_KEY=your_key_here
|
|
29
|
-
export HYPERSYNC_API_KEY=your_key_here
|
|
30
|
-
web3-tools-mcp
|
|
42
|
+
npm install -g web3-tools-mcp
|
|
31
43
|
```
|
|
32
44
|
|
|
33
|
-
|
|
34
|
-
Add to your MCP client configuration (e.g., Claude Desktop):
|
|
45
|
+
Then use in your MCP config:
|
|
35
46
|
```json
|
|
36
47
|
{
|
|
37
48
|
"mcp": {
|
|
@@ -39,8 +50,8 @@ Add to your MCP client configuration (e.g., Claude Desktop):
|
|
|
39
50
|
"web3-tools": {
|
|
40
51
|
"command": "web3-tools-mcp",
|
|
41
52
|
"args": [
|
|
42
|
-
"--etherscan-api-key", "
|
|
43
|
-
"--
|
|
53
|
+
"--etherscan-api-key", "YOUR_ETHERSCAN_API_KEY",
|
|
54
|
+
"--hypersync-api-key", "YOUR_HYPERSYNC_API_KEY"
|
|
44
55
|
]
|
|
45
56
|
}
|
|
46
57
|
}
|
|
@@ -48,6 +59,36 @@ Add to your MCP client configuration (e.g., Claude Desktop):
|
|
|
48
59
|
}
|
|
49
60
|
```
|
|
50
61
|
|
|
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
|
+
|
|
51
92
|
## 🌟 Key Features
|
|
52
93
|
|
|
53
94
|
- **Multi-chain Support**: Works with Ethereum mainnet, Base, Arbitrum, Polygon, Optimism, Celo, and localhost
|
|
@@ -77,173 +118,51 @@ Add to your MCP client configuration (e.g., Claude Desktop):
|
|
|
77
118
|
### 1. ABI Signature Tools
|
|
78
119
|
|
|
79
120
|
#### `get_function_signature`
|
|
80
|
-
Generate 4-byte function selectors from ABI definitions.
|
|
81
|
-
|
|
82
|
-
**Parameters:**
|
|
83
|
-
- `functionAbi` (string): Function ABI (e.g., `"function transfer(address to, uint256 amount)"`)
|
|
84
|
-
|
|
85
|
-
**Example:**
|
|
86
|
-
```json
|
|
87
|
-
{
|
|
88
|
-
"name": "get_function_signature",
|
|
89
|
-
"arguments": {
|
|
90
|
-
"functionAbi": "function balanceOf(address owner) view returns (uint256)"
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
```
|
|
121
|
+
Generate 4-byte function selectors from ABI definitions. Supports batch operations for multiple functions at once.
|
|
94
122
|
|
|
95
123
|
#### `get_event_signature`
|
|
96
|
-
Generate 32-byte event signatures (topic0) from ABI definitions.
|
|
97
|
-
|
|
98
|
-
**Parameters:**
|
|
99
|
-
- `eventAbi` (string): Event ABI (e.g., `"event Transfer(address indexed from, address indexed to, uint256 value)"`)
|
|
124
|
+
Generate 32-byte event signatures (topic0) from ABI definitions. Supports batch operations for multiple events at once.
|
|
100
125
|
|
|
101
126
|
#### `get_error_signature`
|
|
102
|
-
Generate 4-byte error selectors from ABI definitions.
|
|
103
|
-
|
|
104
|
-
**Parameters:**
|
|
105
|
-
- `errorAbi` (string): Error ABI (e.g., `"error InsufficientBalance(uint256 available, uint256 required)"`)
|
|
127
|
+
Generate 4-byte error selectors from ABI definitions. Supports batch operations for multiple errors at once.
|
|
106
128
|
|
|
107
129
|
### 2. Contract Interaction Tools
|
|
108
130
|
|
|
109
131
|
#### `call_contract_function`
|
|
110
|
-
Call view/pure functions on smart contracts.
|
|
111
|
-
|
|
112
|
-
**Parameters:**
|
|
113
|
-
- `chain` (enum): Blockchain network (`mainnet`, `base`, `arbitrum`, `polygon`, `optimism`, `celo`, `localhost`)
|
|
114
|
-
- `contractAddress` (string): Contract address to call
|
|
115
|
-
- `functionAbi` (string): Function ABI definition
|
|
116
|
-
- `args` (array, optional): Function arguments
|
|
117
|
-
- `blockNumber` (string, optional): Specific block number to query
|
|
118
|
-
|
|
119
|
-
**Example:**
|
|
120
|
-
```json
|
|
121
|
-
{
|
|
122
|
-
"name": "call_contract_function",
|
|
123
|
-
"arguments": {
|
|
124
|
-
"chain": "mainnet",
|
|
125
|
-
"contractAddress": "0xA0b86a33E6441c1e4e9c08975a0c8246e8dB8C4F",
|
|
126
|
-
"functionAbi": "function balanceOf(address owner) view returns (uint256)",
|
|
127
|
-
"args": ["0x742d35Cc6cF36C3e0C37d3f6D1D5e4f2C8F3E8A9"]
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
```
|
|
132
|
+
Call view/pure functions on smart contracts. Supports batch operations for executing multiple calls efficiently across different contracts and chains.
|
|
131
133
|
|
|
132
134
|
#### `get_contract_abi`
|
|
133
|
-
Get comprehensive contract information including ABI, proxy detection, and verification status from Etherscan.
|
|
135
|
+
Get comprehensive contract information including ABI, proxy detection, compilation info, creation info, and verification status from Etherscan. Includes smart caching for performance.
|
|
134
136
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
- `address` (string): Contract address
|
|
137
|
+
#### `get_contract_source_code`
|
|
138
|
+
Retrieve verified contract source code from Etherscan with proxy support and flexible output options (full source, summary, or metadata only). Features smart caching.
|
|
138
139
|
|
|
139
|
-
#### `
|
|
140
|
-
|
|
140
|
+
#### `get_contract_source_file`
|
|
141
|
+
Retrieve specific source file from cached contract data. Use after calling `get_contract_source_code` with full source option.
|
|
141
142
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
- `address` (string): Address to check
|
|
143
|
+
#### `is_contract`
|
|
144
|
+
Check if an address is a smart contract or EOA (Externally Owned Account). Returns contract status and bytecode length.
|
|
145
145
|
|
|
146
146
|
### 3. Balance Query Tools
|
|
147
147
|
|
|
148
148
|
#### `get_balance`
|
|
149
|
-
Get native token balance for
|
|
150
|
-
|
|
151
|
-
**Parameters:**
|
|
152
|
-
- `chain` (enum): Blockchain network
|
|
153
|
-
- `address` (string): Address to check
|
|
154
|
-
- `blockNumber` (string, optional): Specific block number
|
|
155
|
-
|
|
156
|
-
#### `get_token_balance`
|
|
157
|
-
Get ERC20/ERC777 token balance for an address.
|
|
158
|
-
|
|
159
|
-
**Parameters:**
|
|
160
|
-
- `chain` (enum): Blockchain network
|
|
161
|
-
- `tokenAddress` (string): Token contract address
|
|
162
|
-
- `holderAddress` (string): Address to check balance for
|
|
163
|
-
- `blockNumber` (string, optional): Specific block number
|
|
164
|
-
|
|
165
|
-
#### `batch_native_balances`
|
|
166
|
-
Get native token balances for multiple addresses in a single call.
|
|
167
|
-
|
|
168
|
-
**Parameters:**
|
|
169
|
-
- `chain` (enum): Blockchain network
|
|
170
|
-
- `addresses` (array): Array of addresses to check
|
|
171
|
-
- `blockNumber` (string, optional): Specific block number
|
|
172
|
-
|
|
173
|
-
#### `batch_token_balances`
|
|
174
|
-
Get multiple token balances for multiple addresses efficiently.
|
|
175
|
-
|
|
176
|
-
**Parameters:**
|
|
177
|
-
- `chain` (enum): Blockchain network
|
|
178
|
-
- `queries` (array): Array of balance queries with `tokenAddress`, `holderAddress`, and optional `label`
|
|
179
|
-
- `blockNumber` (string, optional): Specific block number
|
|
149
|
+
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.
|
|
180
150
|
|
|
181
151
|
### 4. Event Log Tools
|
|
182
152
|
|
|
183
153
|
#### `get_logs`
|
|
184
|
-
Query contract events with decoded output and parameter filtering. Automatically falls back to Hypersync for supported chains when needed.
|
|
185
|
-
|
|
186
|
-
**Parameters:**
|
|
187
|
-
- `chain` (enum): Blockchain network
|
|
188
|
-
- `eventAbi` (string): Event ABI definition for decoding
|
|
189
|
-
- `address` (string, optional): Contract address to filter logs
|
|
190
|
-
- `fromBlock` (string, optional): Start block number
|
|
191
|
-
- `toBlock` (string, optional): End block number
|
|
192
|
-
- `eventArgs` (object, optional): Filter by indexed event parameters
|
|
193
|
-
|
|
194
|
-
**Example:**
|
|
195
|
-
```json
|
|
196
|
-
{
|
|
197
|
-
"name": "get_logs",
|
|
198
|
-
"arguments": {
|
|
199
|
-
"chain": "mainnet",
|
|
200
|
-
"eventAbi": "event Transfer(address indexed from, address indexed to, uint256 value)",
|
|
201
|
-
"address": "0xA0b86a33E6441c1e4e9c08975a0c8246e8dB8C4F",
|
|
202
|
-
"fromBlock": "18000000",
|
|
203
|
-
"toBlock": "18001000",
|
|
204
|
-
"eventArgs": {
|
|
205
|
-
"from": "0x742d35Cc6cF36C3e0C37d3f6D1D5e4f2C8F3E8A9"
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
```
|
|
154
|
+
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.
|
|
210
155
|
|
|
211
|
-
### 5.
|
|
212
|
-
|
|
213
|
-
#### `batch_contract_calls`
|
|
214
|
-
Execute multiple contract calls in a single batch operation.
|
|
215
|
-
|
|
216
|
-
**Parameters:**
|
|
217
|
-
- `chain` (enum): Blockchain network
|
|
218
|
-
- `calls` (array): Array of contract calls with `contractAddress`, `functionAbi`, `args`, and optional `label`
|
|
219
|
-
- `blockNumber` (string, optional): Specific block number
|
|
220
|
-
|
|
221
|
-
### 6. Advanced Tools
|
|
156
|
+
### 5. Advanced Tools
|
|
222
157
|
|
|
223
158
|
#### `get_storage_at`
|
|
224
|
-
Read raw storage data from a contract with ABI-based decoding.
|
|
225
|
-
|
|
226
|
-
**Parameters:**
|
|
227
|
-
- `chain` (enum): Blockchain network
|
|
228
|
-
- `address` (string): Contract address
|
|
229
|
-
- `slot` (string): Storage slot to read (hex string)
|
|
230
|
-
- `abiType` (string): ABI type for decoding (`uint256`, `address`, `bool`, `bytes32`, etc.)
|
|
231
|
-
- `blockNumber` (string, optional): Specific block number
|
|
159
|
+
Read raw storage data from a contract with ABI-based decoding. Supports various types like uint256, address, bool, bytes32, etc.
|
|
232
160
|
|
|
233
161
|
#### `get_block_info`
|
|
234
|
-
Get comprehensive block information including timestamp, hash, and formatted dates.
|
|
235
|
-
|
|
236
|
-
**Parameters:**
|
|
237
|
-
- `chain` (enum): Blockchain network
|
|
238
|
-
- `blockNumber` (string, optional): Block number to query (defaults to latest)
|
|
162
|
+
Get comprehensive block information including timestamp, hash, parent hash, and formatted dates. Defaults to latest block if not specified.
|
|
239
163
|
|
|
240
164
|
#### `trace_transaction`
|
|
241
|
-
Trace a transaction to see detailed execution information including internal calls, state changes, and gas usage.
|
|
242
|
-
|
|
243
|
-
**Parameters:**
|
|
244
|
-
- `chain` (enum): Blockchain network
|
|
245
|
-
- `transactionHash` (string): Transaction hash to trace
|
|
246
|
-
- `traceType` (enum, optional): Type of trace (`trace`, `vmTrace`, `stateDiff`)
|
|
165
|
+
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).
|
|
247
166
|
|
|
248
167
|
## ⚙️ Configuration
|
|
249
168
|
|
|
@@ -260,7 +179,7 @@ The server supports multiple configuration options through environment variables
|
|
|
260
179
|
|
|
261
180
|
**Example:**
|
|
262
181
|
```bash
|
|
263
|
-
|
|
182
|
+
npx web3-tools-mcp --custom-rpc '{"mainnet": "https://my-custom-rpc.com", "base": "https://base-rpc.com"}'
|
|
264
183
|
```
|
|
265
184
|
|
|
266
185
|
## 🔧 Technical Features
|
|
@@ -285,114 +204,28 @@ bun index.ts --custom-rpc '{"mainnet": "https://my-custom-rpc.com", "base": "htt
|
|
|
285
204
|
- **Balance Batching**: Query multiple balances in parallel
|
|
286
205
|
- **Result Aggregation**: Organized results with success/failure tracking
|
|
287
206
|
|
|
288
|
-
## 🚀 Usage Examples
|
|
289
|
-
|
|
290
|
-
### Basic Contract Call
|
|
291
|
-
```json
|
|
292
|
-
{
|
|
293
|
-
"name": "call_contract_function",
|
|
294
|
-
"arguments": {
|
|
295
|
-
"chain": "mainnet",
|
|
296
|
-
"contractAddress": "0xA0b86a33E6441c1e4e9c08975a0c8246e8dB8C4F",
|
|
297
|
-
"functionAbi": "function name() view returns (string)",
|
|
298
|
-
"args": []
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### Event Log Analysis
|
|
304
|
-
```json
|
|
305
|
-
{
|
|
306
|
-
"name": "get_logs",
|
|
307
|
-
"arguments": {
|
|
308
|
-
"chain": "base",
|
|
309
|
-
"eventAbi": "event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to)",
|
|
310
|
-
"fromBlock": "10000000",
|
|
311
|
-
"toBlock": "latest"
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
### Batch Balance Queries
|
|
317
|
-
```json
|
|
318
|
-
{
|
|
319
|
-
"name": "batch_token_balances",
|
|
320
|
-
"arguments": {
|
|
321
|
-
"chain": "mainnet",
|
|
322
|
-
"queries": [
|
|
323
|
-
{
|
|
324
|
-
"tokenAddress": "0xA0b86a33E6441c1e4e9c08975a0c8246e8dB8C4F",
|
|
325
|
-
"holderAddress": "0x742d35Cc6cF36C3e0C37d3f6D1D5e4f2C8F3E8A9",
|
|
326
|
-
"label": "USDC Balance"
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
"tokenAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
|
|
330
|
-
"holderAddress": "0x742d35Cc6cF36C3e0C37d3f6D1D5e4f2C8F3E8A9",
|
|
331
|
-
"label": "WETH Balance"
|
|
332
|
-
}
|
|
333
|
-
]
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
```
|
|
337
|
-
|
|
338
207
|
## 📋 Requirements
|
|
339
208
|
|
|
340
|
-
- **Runtime**:
|
|
209
|
+
- **Runtime**: Node.js v20.0.0 or higher
|
|
210
|
+
- **Package Manager**: npm (recommended) or yarn/pnpm
|
|
341
211
|
- **Dependencies**: viem, @envio-dev/hypersync-client, @modelcontextprotocol/sdk
|
|
342
212
|
- **Network Access**: Internet connection for blockchain RPC calls
|
|
343
213
|
|
|
344
214
|
## 🧪 Testing
|
|
345
215
|
|
|
346
|
-
The server includes a comprehensive test suite
|
|
216
|
+
The server includes a comprehensive test suite with 70 tests covering all functionality:
|
|
347
217
|
|
|
348
218
|
### Running Tests
|
|
349
219
|
|
|
350
220
|
```bash
|
|
351
221
|
# Run all tests
|
|
352
|
-
|
|
222
|
+
npm test
|
|
353
223
|
|
|
354
224
|
# Run tests in watch mode
|
|
355
|
-
|
|
225
|
+
npm run test:watch
|
|
356
226
|
|
|
357
|
-
# Run tests with
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
# Run type checking
|
|
361
|
-
bun run lint
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
### Test Coverage
|
|
365
|
-
|
|
366
|
-
The test suite covers:
|
|
367
|
-
|
|
368
|
-
- **ABI Signature Generation**: Function, event, and error signatures
|
|
369
|
-
- **Contract Interactions**: Detecting contracts vs EOAs, calling view functions
|
|
370
|
-
- **Balance Queries**: Native and token balances, batch operations
|
|
371
|
-
- **Block Information**: Latest and historical block data
|
|
372
|
-
- **Multi-chain Support**: Testing across different networks
|
|
373
|
-
- **Error Handling**: Invalid inputs, network failures, malformed requests
|
|
374
|
-
- **Data Type Handling**: BigInt serialization, address normalization
|
|
375
|
-
- **Performance**: Batch vs individual operation timing
|
|
376
|
-
|
|
377
|
-
### Example Usage
|
|
378
|
-
|
|
379
|
-
```bash
|
|
380
|
-
# Run example demonstrations
|
|
381
|
-
bun run examples
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
The examples file demonstrates:
|
|
385
|
-
- Function signature generation
|
|
386
|
-
- Contract vs EOA detection
|
|
387
|
-
- Smart contract function calls
|
|
388
|
-
- Balance queries
|
|
389
|
-
- Block information retrieval
|
|
390
|
-
|
|
391
|
-
### Test Structure
|
|
392
|
-
|
|
393
|
-
```
|
|
394
|
-
test.ts # Main test suite
|
|
395
|
-
examples.ts # Usage examples and demonstrations
|
|
227
|
+
# Run tests with UI
|
|
228
|
+
npm run test:ui
|
|
396
229
|
```
|
|
397
230
|
|
|
398
231
|
## 🔗 Related Tools
|