-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-server.js
More file actions
52 lines (41 loc) Β· 1.3 KB
/
test-server.js
File metadata and controls
52 lines (41 loc) Β· 1.3 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
/**
* Simple test to verify the MCP server is working
*/
import http from 'http';
function testServer() {
console.log('π Testing LangGPT Prompt Assistant server...\n');
// Test if server is responding
const options = {
hostname: 'localhost',
port: 3000,
path: '/',
method: 'GET'
};
const req = http.request(options, (res) => {
console.log(`β
Server is responding! Status: ${res.statusCode}`);
console.log(`π‘ Headers:`, res.headers);
let data = '';
res.on('data', (chunk) => {
data += chunk;
});
res.on('end', () => {
console.log(`π Response: ${data}`);
});
});
req.on('error', (error) => {
console.log('β Server connection failed:', error.message);
console.log('\nπ‘ This is expected - MCP servers don\'t serve web pages.');
console.log('π― Try running: node test-simple.js');
});
req.setTimeout(5000, () => {
console.log('β° Request timed out');
req.destroy();
});
req.end();
}
// Test the server
testServer();
console.log('\nπ Alternative testing options:');
console.log('1. Run: node test-simple.js (recommended)');
console.log('2. Use an MCP client to connect to the server');
console.log('3. Check server logs in your terminal');