You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- (Replace with the absolute path to your evm-mcp-server/src/index.ts file)
223
+
- Command: `npx @mcpdotdirect/evm-mcp-server`
213
224
214
225
6. Click "Save"
215
226
216
227
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.
217
228
229
+
### Using mcp.json with Cursor
230
+
231
+
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:
232
+
233
+
```json
234
+
{
235
+
"mcpServers": {
236
+
"evm-mcp-server": {
237
+
"command": "npx",
238
+
"args": [
239
+
"-y",
240
+
"@mcpdotdirect/evm-mcp-server"
241
+
]
242
+
},
243
+
"evm-mcp-http": {
244
+
"command": "npx",
245
+
"args": [
246
+
"-y",
247
+
"@mcpdotdirect/evm-mcp-server",
248
+
"--http"
249
+
]
250
+
}
251
+
}
252
+
}
253
+
```
254
+
255
+
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:
256
+
257
+
1. Share MCP configurations with your team
258
+
2. Version control your MCP setup
259
+
3. Use different server configurations for different projects
260
+
261
+
### Example: HTTP Mode with SSE
262
+
263
+
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:
264
+
265
+
```json
266
+
{
267
+
"mcpServers": {
268
+
"evm-mcp-sse": {
269
+
"url": "http://localhost:3001/sse"
270
+
}
271
+
}
272
+
}
273
+
```
274
+
275
+
This connects directly to the HTTP server's SSE endpoint, which is useful for:
276
+
- Web applications that need to connect to the MCP server from the browser
277
+
- Environments where running local commands isn't ideal
278
+
- Sharing a single MCP server instance among multiple users or applications
279
+
280
+
To use this configuration:
281
+
1. Create a `.cursor` directory in your project root if it doesn't exist
282
+
2. Save the above JSON as `mcp.json` in the `.cursor` directory
283
+
3. Restart Cursor or open your project
284
+
4. Cursor will detect the configuration and offer to enable the server(s)
285
+
286
+
### Example: Using the MCP Server in Cursor
287
+
288
+
After configuring the MCP server with `mcp.json`, you can easily use it in Cursor. Here's an example workflow:
289
+
290
+
1. Create a new JavaScript/TypeScript file in your project:
291
+
292
+
```javascript
293
+
// blockchain-example.js
294
+
asyncfunctionmain() {
295
+
try {
296
+
// Get ETH balance for an address using ENS
297
+
console.log("Getting ETH balance for vitalik.eth...");
298
+
299
+
// When using with Cursor, you can simply ask Cursor to:
300
+
// "Check the ETH balance of vitalik.eth on mainnet"
301
+
// Or "Transfer 0.1 ETH from my wallet to vitalik.eth"
302
+
303
+
// Cursor will use the MCP server to execute these operations
304
+
// without requiring any additional code from you
305
+
306
+
// This is the power of the MCP integration - your AI assistant
307
+
// can directly interact with blockchain data and operations
308
+
} catch (error) {
309
+
console.error("Error:", error.message);
310
+
}
311
+
}
312
+
313
+
main();
314
+
```
315
+
316
+
2. With the file open in Cursor, you can ask Cursor to:
317
+
318
+
- "Check the current ETH balance of vitalik.eth"
319
+
- "Look up the price of USDC on Ethereum"
320
+
- "Show me the latest block on Optimism"
321
+
- "Check if 0x1234... is a contract address"
322
+
323
+
3. Cursor will use the MCP server to execute these operations and return the results directly in your conversation.
324
+
325
+
The MCP server handles all the blockchain communication while allowing Cursor to understand and execute blockchain-related tasks through natural language.
326
+
218
327
### Connecting using Claude CLI
219
328
220
329
If you're using Claude CLI, you can connect to the MCP server with just two commands:
221
330
222
331
```bash
223
332
# Add the MCP server
224
-
claude mcp add evm-mcp-server npx tsx /path/to/mcp-evm-server/src/index.ts
333
+
claude mcp add evm-mcp-server npx @mcpdotdirect/evm-mcp-server
225
334
226
335
# Start Claude with the MCP server enabled
227
336
claude
228
337
```
229
338
230
-
Replace `/path/to/mcp-evm-server/src/index.ts` with the absolute path to your project's src/index.ts file.
0 commit comments