Skip to main content
Glama
nikhilkumaragarwal-shyftlabs

MCP Executor Server

index.ts1.04 kB
import express, { Request, Response } from 'express'; import { setupSSE, broadcastSSE } from './utils/sse.js'; import { executeCode } from './server.js'; // NOTE: For TypeScript, install @types/express for proper type support. const app = express(); app.use(express.json()); // SSE endpoint setupSSE(app); // Execute endpoint app.post('/execute', async (req: Request, res: Response) => { try { const { code, language = 'python', timeout = 30, libraries = [] } = req.body; const result = await executeCode({ code, language, timeout, libraries, sse: broadcastSSE }); res.json(result); } catch (error) { res.status(500).json({ error: error instanceof Error ? error.message : String(error) }); } }); // Health check app.get('/health', (req: Request, res: Response) => { res.status(200).json({ status: 'ok', message: 'MCP Executor server is healthy', timestamp: new Date().toISOString() }); }); const PORT = 3000; app.listen(PORT, () => { console.log(`MCP Executor HTTP server listening on port ${PORT}`); });

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/nikhilkumaragarwal-shyftlabs/MCP'

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