Skip to main content
Glama

Context Pods

by conorluddy
test-connection.mjsโ€ข3.52 kB
#!/usr/bin/env node /** * Context-Pods Meta-MCP Server Connection Test * Tests connectivity and basic functionality of the MCP server */ import { spawn } from 'child_process'; import { fileURLToPath } from 'url'; import { dirname, join } from 'path'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const projectRoot = dirname(__dirname); async function delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async function testMCPConnection() { console.log('๐Ÿ” Testing Context-Pods Meta-MCP Server connection...\n'); // Start the server console.log('๐Ÿš€ Starting MCP server...'); const serverProcess = spawn('node', ['packages/server/dist/src/index.js'], { cwd: projectRoot, stdio: ['pipe', 'pipe', 'pipe'] }); let serverOutput = ''; let serverReady = false; serverProcess.stdout.on('data', (data) => { serverOutput += data.toString(); console.log('๐Ÿ“ก Server:', data.toString().trim()); if (data.toString().includes('started successfully')) { serverReady = true; } }); serverProcess.stderr.on('data', (data) => { console.log('โš ๏ธ Server error:', data.toString().trim()); }); // Wait for server to start let attempts = 0; while (!serverReady && attempts < 30) { await delay(1000); attempts++; if (attempts % 5 === 0) { console.log(`โณ Waiting for server to start... (${attempts}/30)`); } } if (!serverReady) { console.log('โŒ Server failed to start within 30 seconds'); serverProcess.kill(); process.exit(1); } console.log('โœ… Server is running!\n'); // Test MCP protocol console.log('๐Ÿ”Œ Testing MCP protocol...'); try { // Send initialize request const initRequest = { jsonrpc: '2.0', id: 1, method: 'initialize', params: { protocolVersion: '2024-11-05', capabilities: { tools: {} }, clientInfo: { name: 'context-pods-test-client', version: '1.0.0' } } }; serverProcess.stdin.write(JSON.stringify(initRequest) + '\n'); // Wait for response await delay(2000); // Test listing tools const toolsRequest = { jsonrpc: '2.0', id: 2, method: 'tools/list', params: {} }; console.log('๐Ÿ“‹ Requesting available tools...'); serverProcess.stdin.write(JSON.stringify(toolsRequest) + '\n'); // Wait for response await delay(2000); // Test listing resources const resourcesRequest = { jsonrpc: '2.0', id: 3, method: 'resources/list', params: {} }; console.log('๐Ÿ“š Requesting available resources...'); serverProcess.stdin.write(JSON.stringify(resourcesRequest) + '\n'); // Wait for response await delay(2000); console.log('\nโœ… MCP protocol test completed!'); console.log('๐ŸŽ‰ Context-Pods Meta-MCP Server is working correctly.'); } catch (error) { console.log('โŒ MCP protocol test failed:', error.message); } finally { // Clean up console.log('\n๐Ÿ›‘ Stopping server...'); serverProcess.kill(); // Wait a moment for cleanup await delay(1000); console.log('โœ… Test completed.'); } } // Handle process termination process.on('SIGINT', () => { console.log('\n๐Ÿ›‘ Test interrupted by user'); process.exit(0); }); // Run the test testMCPConnection().catch(error => { console.error('โŒ Test failed:', error); process.exit(1); });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/conorluddy/ContextPods'

If you have feedback or need assistance with the MCP directory API, please join our Discord server