Skip to main content
Glama

MCP Server with SSE

by Fuglys
test-sse.jsโ€ข2.03 kB
// Test script voor SSE functionaliteit const http = require('http'); console.log('๐Ÿงช Testing MCP Server SSE functionality...\n'); // Test 1: Health check console.log('1๏ธโƒฃ Testing health endpoint...'); http.get('http://localhost:3000/health', (res) => { let data = ''; res.on('data', chunk => data += chunk); res.on('end', () => { console.log('โœ… Health check response:', JSON.parse(data)); console.log(''); // Test 2: SSE connection console.log('2๏ธโƒฃ Testing SSE endpoint...'); testSSE(); }); }).on('error', (err) => { console.error('โŒ Health check failed:', err.message); }); function testSSE() { const req = http.request({ hostname: 'localhost', port: 3000, path: '/sse', method: 'GET', headers: { 'Accept': 'text/event-stream', 'Cache-Control': 'no-cache' } }, (res) => { console.log('โœ… SSE connection established'); console.log('๐Ÿ“ก Listening for events...\n'); let eventCount = 0; res.on('data', (chunk) => { const data = chunk.toString(); if (data.startsWith('data:')) { eventCount++; try { const jsonData = JSON.parse(data.substring(5).trim()); console.log(`๐Ÿ“จ Event ${eventCount}:`, jsonData); } catch (e) { console.log(`๐Ÿ“จ Raw event ${eventCount}:`, data.trim()); } // Stop na 3 events if (eventCount >= 3) { console.log('\nโœ… SSE test completed successfully!'); req.destroy(); process.exit(0); } } else if (data.startsWith(':')) { console.log('๐Ÿ’“ Keep-alive ping received'); } }); res.on('error', (err) => { console.error('โŒ SSE error:', err); }); }); req.on('error', (err) => { console.error('โŒ SSE connection failed:', err.message); }); req.end(); // Timeout na 20 seconden setTimeout(() => { console.log('\nโฐ Test timeout - stopping'); process.exit(0); }, 20000); }

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/Fuglys/mcp-server'

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