Skip to main content
Glama

Convex MCP server

Official
by get-convex
helpers.ts1.04 kB
import { PaginationResult } from "convex/server"; import { internal } from "./_generated/api"; import { Doc, TableNames } from "./_generated/dataModel"; import { ActionCtx, QueryCtx, internalQuery } from "./_generated/server"; export async function paginate<T extends TableNames>( ctx: ActionCtx, table: T, batchSize: number, callback: (documents: Doc<T>[]) => Promise<void>, ): Promise<void> { let isDone = false; let cursor = null; while (!isDone) { const result: PaginationResult<Doc<T>> = (await ctx.runQuery( internal.helpers.paginateQuery, { table, cursor, numItems: batchSize, }, )) as any; await callback(result.page); ({ isDone, continueCursor: cursor } = result); } } export const paginateQuery = internalQuery( async <T extends TableNames>( ctx: QueryCtx, args: { table: T; cursor: any; numItems: number }, ) => { return await ctx.db .query(args.table) .paginate({ cursor: args.cursor, numItems: args.numItems }); }, );

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