Skip to main content
Glama

DSP Booking MCP Server

by hrz8
routes.ts1.19 kB
import express from 'express'; import type { TransportMap } from '../transports/types.js'; import { handleStatelessRequest, handleStatefulRequest } from './handler.js'; import { RUN_IN_LAMBDA } from '../utils/config.js'; export function clientToServerHandler(transports: TransportMap): express.RequestHandler { return async (req, res) => { if (RUN_IN_LAMBDA) { return handleStatelessRequest(req, res); } else { return handleStatefulRequest(req, res, transports); } }; } export function serverToClientHandler(transports: TransportMap): express.RequestHandler { return async (req, res) => { if (RUN_IN_LAMBDA) { res.status(405).json({ jsonrpc: '2.0', error: { code: -32000, message: 'Method not allowed in Lambda stateless mode.', }, id: null, }); return; } const sessionId = req.headers['mcp-session-id'] as string | undefined; const transport = sessionId ? transports.get(sessionId) : undefined; if (!sessionId || !transport) { res.status(400).send('Invalid or missing session ID'); return; } await transport.handleRequest(req, res); }; }

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/hrz8/mcp-openapi'

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