Skip to main content
Glama
accepts.js649 B
// src/helper/accepts/accepts.ts import { parseAccept } from "../../utils/accept.js"; var defaultMatch = (accepts2, config) => { const { supports, default: defaultSupport } = config; const accept = accepts2.sort((a, b) => b.q - a.q).find((accept2) => supports.includes(accept2.type)); return accept ? accept.type : defaultSupport; }; var accepts = (c, options) => { const acceptHeader = c.req.header(options.header); if (!acceptHeader) { return options.default; } const accepts2 = parseAccept(acceptHeader); const match = options.match || defaultMatch; return match(accepts2, options); }; export { accepts, defaultMatch };

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/Valerio357/bet-mcp'

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