-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest-mcp.ts
More file actions
57 lines (49 loc) · 1.26 KB
/
test-mcp.ts
File metadata and controls
57 lines (49 loc) · 1.26 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
54
55
56
57
#!/usr/bin/env bun
/**
* Test MCP API directly
*/
const testData = {
jsonrpc: "2.0",
id: 1,
method: "tools.list",
params: {}
};
async function testMCPAPI() {
try {
const response = await fetch('http://localhost:3000', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(testData)
});
const result = await response.json();
console.log('✅ MCP API Test Results:');
console.log('Status:', response.status);
console.log('Response:', JSON.stringify(result, null, 2));
// Test tool call
const toolCallData = {
jsonrpc: "2.0",
id: 2,
method: "tools.call",
params: {
name: "get_events",
arguments: { limit: 5 }
}
};
const toolResponse = await fetch('http://localhost:3000', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(toolCallData)
});
const toolResult = await toolResponse.json();
console.log('\n✅ Tool Call Test Results:');
console.log('Status:', toolResponse.status);
console.log('Response:', JSON.stringify(toolResult, null, 2));
} catch (error) {
console.log('❌ Test Failed:', error.message);
}
}
testMCPAPI();