-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtest-mcp-server.js
More file actions
46 lines (39 loc) · 1.1 KB
/
test-mcp-server.js
File metadata and controls
46 lines (39 loc) · 1.1 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
// Test script for the Archy MCP server
import { spawn } from 'child_process';
import { createInterface } from 'readline';
// Start the MCP server
const server = spawn('node', ['build/index.js']);
// Create readline interface for user input
const rl = createInterface({
input: process.stdin,
output: process.stdout
});
// Handle server output
server.stdout.on('data', (data) => {
console.log(`Server output: ${data}`);
});
server.stderr.on('data', (data) => {
console.error(`Server error: ${data}`);
});
// Example MCP request for generating a diagram from text
const generateDiagramRequest = {
jsonrpc: '2.0',
id: 1,
method: 'callTool',
params: {
name: 'generate_diagram_from_text',
arguments: {
description: 'A simple flowchart showing user login process',
diagramType: 'flowchart'
}
}
};
// Send the request to the server
console.log('Sending request to generate a diagram...');
server.stdin.write(JSON.stringify(generateDiagramRequest) + '\n');
// Wait for user input to exit
rl.question('Press Enter to exit...', () => {
server.kill();
rl.close();
process.exit(0);
});