Skip to main content
Glama
health-server.ts1.19 kB
import http from 'http'; import { readFileSync } from 'fs'; const PORT = Number(process.env.PORT || 3000); function getStatus() { return { status: 'ok', uptime: process.uptime(), pid: process.pid, node: process.version, }; } const server = http.createServer((req, res) => { if (!req.url) { res.writeHead(400); res.end('Bad request'); return; } if (req.url === '/health' || req.url === '/status' || req.url === '/ping') { const body = JSON.stringify(getStatus()); res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(body); return; } if (req.url === '/' || req.url === '/about') { const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf-8')); const body = JSON.stringify({ name: pkg.name, version: pkg.version, description: pkg.description }); res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(body); return; } res.writeHead(404, { 'Content-Type': 'text/plain' }); res.end('Not found'); }); server.listen(PORT, () => { // eslint-disable-next-line no-console console.error(`Health server listening on port ${PORT}`); }); export {};

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/daanno/simplicate-mcp'

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