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
import { useEffect, useReducer } from "react";
let oncePerSecondTimer: ReturnType<typeof setInterval>;
let nextId = 1;
const callbacks = new Map<number, () => void>();
function callCallbacks() {
for (const cb of callbacks.values()) {
cb();
}
}
export function useRefresh(timeout = 1000) {
const [, forceUpdate] = useReducer((x) => x + 1, 0);
useEffect(() => {
const id = nextId++;
if (callbacks.size === 0) {
oncePerSecondTimer = setInterval(callCallbacks, timeout);
}
callbacks.set(id, forceUpdate);
return () => {
callbacks.delete(id);
if (callbacks.size === 0) {
clearInterval(oncePerSecondTimer);
}
};
}, [forceUpdate, timeout]);
}