Skip to main content
Glama
by wubbyweb
test-demo.jsโ€ข2.15 kB
#!/usr/bin/env node import { spawn } from 'child_process'; import { setTimeout } from 'timers/promises'; console.log('๐Ÿš€ Testing MCP Demo Project\n'); // Test 1: Verify build works console.log('๐Ÿ“ฆ Testing build...'); const buildResult = spawn('npm', ['run', 'build'], { stdio: 'inherit' }); await new Promise((resolve, reject) => { buildResult.on('close', (code) => { if (code === 0) { console.log('โœ… Build successful\n'); resolve(); } else { console.log('โŒ Build failed\n'); reject(new Error(`Build failed with code ${code}`)); } }); }); // Test 2: Test TypeScript compilation console.log('๐Ÿ” Testing TypeScript...'); const typeResult = spawn('npm', ['run', 'typecheck'], { stdio: 'inherit' }); await new Promise((resolve, reject) => { typeResult.on('close', (code) => { if (code === 0) { console.log('โœ… TypeScript check successful\n'); resolve(); } else { console.log('โŒ TypeScript check failed\n'); reject(new Error(`TypeScript check failed with code ${code}`)); } }); }); // Test 3: Start SSE server for testing console.log('๐ŸŒ Starting SSE server...'); const sseServer = spawn('npm', ['run', 'start:sse'], { stdio: ['pipe', 'pipe', 'inherit'], detached: false }); // Wait for server to start await setTimeout(2000); // Test 4: Test health endpoint console.log('๐Ÿฅ Testing health endpoint...'); try { const response = await fetch('http://localhost:3000/health'); if (response.ok) { const health = await response.json(); console.log('โœ… Health check passed:', health); } else { console.log('โŒ Health check failed:', response.status); } } catch (error) { console.log('โŒ Health check error:', error.message); } // Cleanup console.log('\n๐Ÿงน Cleaning up...'); sseServer.kill('SIGTERM'); console.log('\n๐ŸŽ‰ Demo tests completed!'); console.log('\n๐Ÿ“‹ Manual testing commands:'); console.log(' npm run demo:stdio # Test STDIO mode'); console.log(' npm run demo:sse # Test SSE mode'); console.log(' npm run start:sse # Start SSE server'); console.log(' npm run client:sse # Run SSE client');

Latest Blog Posts

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/wubbyweb/mcp-demo'

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