forked from pinkycollie/deaf-first-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-mcp.mjs
More file actions
executable file
·53 lines (42 loc) · 1.22 KB
/
Copy pathtest-mcp.mjs
File metadata and controls
executable file
·53 lines (42 loc) · 1.22 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env node
// Simple test script for MCP servers
import { spawn } from 'child_process';
const serverPath = process.argv[2];
if (!serverPath) {
console.error('Usage: node test-mcp.mjs <path-to-mcp-server.js>');
process.exit(1);
}
console.log(`Testing MCP Server: ${serverPath}`);
const server = spawn('node', [serverPath]);
// Send a list tools request
const listToolsRequest = JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'tools/list',
params: {}
}) + '\n';
let output = '';
server.stdout.on('data', (data) => {
output += data.toString();
console.log('Server response:', data.toString());
});
server.stderr.on('data', (data) => {
console.log('Server log:', data.toString());
});
server.on('close', (code) => {
console.log(`Server exited with code ${code}`);
if (output.includes('tools')) {
console.log('✓ MCP Server is working!');
} else {
console.log('✗ MCP Server may have issues');
}
});
// Give server time to start
setTimeout(() => {
console.log('Sending list tools request...');
server.stdin.write(listToolsRequest);
// Give it time to respond then close
setTimeout(() => {
server.kill();
}, 2000);
}, 1000);