Skip to main content
Glama
getPayloadHash.jsโ€ข854 B
import { isArrayBuffer } from "@smithy/is-array-buffer"; import { toHex } from "@smithy/util-hex-encoding"; import { toUint8Array } from "@smithy/util-utf8"; import { SHA256_HEADER, UNSIGNED_PAYLOAD } from "./constants"; export const getPayloadHash = async ({ headers, body }, hashConstructor) => { for (const headerName of Object.keys(headers)) { if (headerName.toLowerCase() === SHA256_HEADER) { return headers[headerName]; } } if (body == undefined) { return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; } else if (typeof body === "string" || ArrayBuffer.isView(body) || isArrayBuffer(body)) { const hashCtor = new hashConstructor(); hashCtor.update(toUint8Array(body)); return toHex(await hashCtor.digest()); } return UNSIGNED_PAYLOAD; };

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/consigcody94/office-whisperer'

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