Skip to content

Commit df6d52d

Browse files
author
vcart
committed
feat: npm public release
1 parent b20a12d commit df6d52d

7 files changed

Lines changed: 262 additions & 28 deletions

File tree

.cursor/mcp.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
{
22
"mcpServers": {
3-
"evm": {
4-
"command": "node",
3+
"evm-mcp-server": {
4+
"command": "npx",
55
"args": [
6-
"${workspaceFolder}/build/index.js"
6+
"-y",
7+
"@mcpdotdirect/evm-mcp-server"
8+
]
9+
},
10+
"evm-mcp-http": {
11+
"command": "npx",
12+
"args": [
13+
"-y",
14+
"@mcpdotdirect/evm-mcp-server",
15+
"--http"
716
]
817
}
918
}

.npmignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Source code (since we're publishing built files)
2+
src/
3+
4+
# Development files
5+
.git/
6+
.github/
7+
.vscode/
8+
.idea/
9+
.cursor/
10+
mcp-context/
11+
*.tsbuildinfo
12+
13+
# Temp files
14+
tmp/
15+
temp/
16+
17+
# Test files
18+
test/
19+
tests/
20+
__tests__/
21+
*.spec.ts
22+
*.test.ts
23+
24+
# Docs (except README.md which is included in "files")
25+
docs/
26+
27+
# Build artifacts
28+
node_modules/
29+
coverage/
30+
bun.lock
31+
yarn.lock
32+
package-lock.json

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2025 Context Labs, Inc.
3+
Copyright (c) 2025 mcpdotdirect
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 113 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,19 @@ These values are hardcoded in the application. If you need to modify them, you c
171171

172172
## 🚀 Usage
173173

174-
### Running the Server
174+
### Using npx (No Installation Required)
175+
176+
You can run the MCP EVM Server directly without installation using npx:
177+
178+
```bash
179+
# Run the server in stdio mode (for CLI tools)
180+
npx @mcpdotdirect/evm-mcp-server
181+
182+
# Run the server in HTTP mode (for web applications)
183+
npx @mcpdotdirect/evm-mcp-server --http
184+
```
185+
186+
### Running the Server Locally
175187

176188
Start the server using stdio (for embedding in CLI tools):
177189

@@ -208,27 +220,122 @@ To connect to the MCP server from Cursor:
208220
5. Enter the following details:
209221
- Server name: `evm-mcp-server`
210222
- Type: `command`
211-
- Command: `npx tsx /path/to/mcp-evm-server/src/index.ts`
212-
- (Replace with the absolute path to your evm-mcp-server/src/index.ts file)
223+
- Command: `npx @mcpdotdirect/evm-mcp-server`
213224

214225
6. Click "Save"
215226

216227
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.
217228

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+
async function main() {
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+
218327
### Connecting using Claude CLI
219328

220329
If you're using Claude CLI, you can connect to the MCP server with just two commands:
221330

222331
```bash
223332
# 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
225334

226335
# Start Claude with the MCP server enabled
227336
claude
228337
```
229338

230-
Replace `/path/to/mcp-evm-server/src/index.ts` with the absolute path to your project's src/index.ts file.
231-
232339
### Example: Getting a Token Balance with ENS
233340

234341
```javascript

bin/cli.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env node
2+
3+
import { fileURLToPath } from 'url';
4+
import { dirname, resolve } from 'path';
5+
import { spawn } from 'child_process';
6+
import { createRequire } from 'module';
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = dirname(__filename);
10+
const require = createRequire(import.meta.url);
11+
12+
// Parse command line arguments
13+
const args = process.argv.slice(2);
14+
const httpMode = args.includes('--http') || args.includes('-h');
15+
16+
console.log(`Starting EVM MCP Server in ${httpMode ? 'HTTP' : 'stdio'} mode...`);
17+
18+
// Determine which file to execute
19+
const scriptPath = resolve(__dirname, '../build', httpMode ? 'http-server.js' : 'index.js');
20+
21+
try {
22+
// Check if the built files exist
23+
require.resolve(scriptPath);
24+
25+
// Execute the server
26+
const server = spawn('node', [scriptPath], {
27+
stdio: 'inherit',
28+
shell: false
29+
});
30+
31+
server.on('error', (err) => {
32+
console.error('Failed to start server:', err);
33+
process.exit(1);
34+
});
35+
36+
// Handle clean shutdown
37+
const cleanup = () => {
38+
if (!server.killed) {
39+
server.kill();
40+
}
41+
};
42+
43+
process.on('SIGINT', cleanup);
44+
process.on('SIGTERM', cleanup);
45+
process.on('exit', cleanup);
46+
47+
} catch (error) {
48+
console.error('Error: Server files not found. The package may not be built correctly.');
49+
console.error('Please try reinstalling the package or contact the maintainers.');
50+
console.error(error);
51+
process.exit(1);
52+
}

bun.lock

Lines changed: 7 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)