-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-mcp.js
More file actions
37 lines (29 loc) · 908 Bytes
/
Copy pathtest-mcp.js
File metadata and controls
37 lines (29 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { spawn } from 'child_process';
import { readFileSync } from 'fs';
// Test the MCP server
async function testMCPServer() {
console.log('Testing MCP Server...');
const mcpProcess = spawn('node', ['dist/main.js'], {
stdio: ['pipe', 'pipe', 'pipe']
});
// Send a test request
const testRequest = {
jsonrpc: "2.0",
id: 1,
method: "tools/list",
params: {}
};
mcpProcess.stdin.write(JSON.stringify(testRequest) + '\n');
mcpProcess.stdout.on('data', (data) => {
console.log('MCP Response:', data.toString());
});
mcpProcess.stderr.on('data', (data) => {
console.error('MCP Error:', data.toString());
});
// Wait a bit then close
setTimeout(() => {
mcpProcess.kill();
console.log('Test completed');
}, 2000);
}
testMCPServer().catch(console.error);