-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest-netlify-endpoints.ts
More file actions
60 lines (51 loc) Β· 1.59 KB
/
test-netlify-endpoints.ts
File metadata and controls
60 lines (51 loc) Β· 1.59 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
58
59
60
#!/usr/bin/env bun
/**
* Test MCP API at proper Netlify endpoints
*/
const testData = {
jsonrpc: "2.0",
id: 1,
method: "tools.list",
params: {}
};
async function testMCPAPI() {
try {
console.log('π Testing MCP API endpoints...');
// Test health function
console.log('\nπ Testing /api/health:');
const healthResponse = await fetch('https://dflow.opensvm.com/api/health');
const healthStatus = healthResponse.status;
const healthText = await healthResponse.text();
console.log('Status:', healthStatus);
console.log('Response:', healthText);
// Test MCP function
console.log('\nπ Testing /api/mcp:');
const response = await fetch('https://dflow.opensvm.com/api/mcp', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(testData)
});
const status = response.status;
const text = await response.text();
console.log('Status:', status);
console.log('Response:', text.substring(0, 500) + (text.length > 500 ? '...' : ''));
if (status === 200) {
try {
const result = JSON.parse(text);
console.log('β
MCP API Working!');
console.log('Tools available:', result.result?.tools?.length || 0);
} catch (parseError) {
console.log('β Invalid JSON response');
}
} else if (status === 404) {
console.log('β 404 - Function not deployed');
} else {
console.log('β Unexpected status:', status);
}
} catch (error) {
console.log('β Test Failed:', error.message);
}
}
testMCPAPI();