Skip to main content
Glama

mcp-graphql

headers.ts836 B
/** * Parse and merge headers from various sources * @param configHeaders - Default headers from configuration * @param inputHeaders - Headers provided by the user (string or object) * @returns Merged headers object */ export function parseAndMergeHeaders( configHeaders: Record<string, string>, inputHeaders?: string | Record<string, string>, ): Record<string, string> { // Parse headers if they're provided as a string let parsedHeaders: Record<string, string> = {}; if (typeof inputHeaders === "string") { try { parsedHeaders = JSON.parse(inputHeaders); } catch (e) { throw new Error(`Invalid headers JSON: ${e}`); } } else if (inputHeaders) { parsedHeaders = inputHeaders; } // Merge with config headers (config headers are overridden by input headers) return { ...configHeaders, ...parsedHeaders }; }

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/blurrah/mcp-graphql'

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