import { useState } from "react";
import type * as WasmCronModule from "saffron";
let globalWasmCronP: Promise<typeof WasmCronModule>;
let globalWasmCron: typeof WasmCronModule.WasmCron;
/**
* Hax to load the Saffron WebAssembly module only in the browser because
* I haven't figured out how to bundle Saffron for Node.js in Next.js.
*/
export function useWasmCron(): typeof WasmCronModule.WasmCron | undefined {
const [wasmCron, setWasmCron] = useState<
typeof WasmCronModule.WasmCron | undefined
>(() => globalWasmCron);
if (wasmCron) return wasmCron;
if (!globalWasmCronP && typeof window !== "undefined") {
globalWasmCronP = import("saffron");
void globalWasmCronP.then((module) => {
globalWasmCron = module.WasmCron;
});
}
void globalWasmCronP.then(() => {
setWasmCron(() => globalWasmCron);
});
return wasmCron;
}
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/get-convex/convex-backend'
If you have feedback or need assistance with the MCP directory API, please join our Discord server