Skip to main content
Glama

MCP Content Analyzer

by DuncanDam
test-connection.js2.48 kB
#!/usr/bin/env node import { spawn } from 'child_process'; import { join, dirname } from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const rootDir = join(__dirname, '..'); function testMCPConnection() { return new Promise((resolve, reject) => { console.log('🧪 Testing MCP server connection...\n'); const child = spawn('node', ['dist/index.js'], { cwd: rootDir, stdio: ['pipe', 'pipe', 'pipe'] }); let output = ''; let errorOutput = ''; child.stdout.on('data', (data) => { output += data.toString(); }); child.stderr.on('data', (data) => { errorOutput += data.toString(); }); // Send a test message setTimeout(() => { const testMessage = { jsonrpc: '2.0', id: 1, method: 'tools/list' }; child.stdin.write(JSON.stringify(testMessage) + '\n'); }, 1000); // Check response setTimeout(() => { child.kill(); if (output.includes('tools') || output.includes('my-mcp')) { console.log('✅ MCP server is responding correctly!'); console.log('\nServer capabilities detected:'); console.log(' - MCP protocol communication ✓'); console.log(' - Tool registration ✓'); if (output.includes('test_connection')) { console.log(' - Test connection tool ✓'); } if (output.includes('analyze_content_workflow')) { console.log(' - Content analysis workflow ✓'); } console.log('\n🎉 Your MCP Content Analyzer is ready to use with Claude Desktop!'); resolve(true); } else { console.log('❌ MCP server connection test failed'); console.log('\nOutput:', output); console.log('\nErrors:', errorOutput); console.log('\nTroubleshooting:'); console.log('1. Make sure you built the project: npm run build'); console.log('2. Check if Claude Desktop configuration is correct'); console.log('3. Restart Claude Desktop completely'); resolve(false); } }, 3000); child.on('error', (error) => { console.error('❌ Failed to start MCP server:', error.message); reject(error); }); }); } async function main() { try { await testMCPConnection(); } catch (error) { console.error('❌ Test failed:', error.message); process.exit(1); } } main();

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/DuncanDam/my-mcp'

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