-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathexplore_mcp.mjs
More file actions
69 lines (61 loc) · 1.67 KB
/
Copy pathexplore_mcp.mjs
File metadata and controls
69 lines (61 loc) · 1.67 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
61
62
63
64
65
66
67
68
69
const MCP_URL = 'https://mcp.ateam-ai.com/mcp';
async function listTools() {
console.log('Initializing MCP session...');
const initRes = await fetch(MCP_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
id: 0,
method: 'initialize',
params: {
protocolVersion: '2024-11-05',
capabilities: {},
clientInfo: { name: 'explore-script', version: '1.0.0' }
}
})
});
const sessionId = initRes.headers.get('mcp-session-id');
await initRes.json();
// Send initialized notification
await fetch(MCP_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'mcp-session-id': sessionId
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'notifications/initialized'
})
});
console.log('Listing tools from ' + MCP_URL + '...');
const res = await fetch(MCP_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'mcp-session-id': sessionId
},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'tools/list',
params: {}
})
});
const data = await res.json();
if (data.error) {
console.error('MCP Error:', JSON.stringify(data.error, null, 2));
return;
}
const tools = data.result.tools;
console.log('Found ' + tools.length + ' tools:');
tools.forEach(t => {
if (t.name.startsWith('ateam_git') || t.name.includes('git')) {
console.log('- ' + t.name + ': ' + t.description);
}
});
console.log('\nAll tools:');
tools.forEach(t => console.log('- ' + t.name));
}
listTools().catch(console.error);