Skip to main content
Glama

Convex MCP server

Official
by get-convex
cursorRules.ts1.35 kB
import { internalQuery, internalAction, internalMutation, } from "./_generated/server"; import { v } from "convex/values"; import { internal } from "./_generated/api"; import { hashSha256 } from "./util/hash"; import { getLatestCursorRules } from "./util/cursorRules"; import { Doc } from "./_generated/dataModel"; export const refresh = internalAction({ args: {}, handler: async (ctx): Promise<Doc<"cursorRules"> | null> => { try { const rules = await getLatestCursorRules(); return await ctx.runMutation(internal.cursorRules.save, rules); } catch (error) { console.error("Failed to refresh Cursor rules:", error); return null; } }, }); export const getCached = internalQuery({ args: {}, handler: async (ctx) => { return await ctx.db.query("cursorRules").first(); }, }); export const save = internalMutation({ args: { content: v.string(), version: v.string() }, handler: async (ctx, { content, version }) => { // Delete existing entries const existing = await ctx.db.query("cursorRules").collect(); for (const entry of existing) { await ctx.db.delete(entry._id); } // Insert new entry const doc = await ctx.db.insert("cursorRules", { content, version, hash: await hashSha256(content), }); return (await ctx.db.get(doc))!; }, });

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