Skip to main content
Glama

Convex MCP server

Official
by get-convex
modules.ts1.76 kB
import { ValidatorJSON } from "../../../../convex/dist/internal-cjs-types/values"; import { UdfType, Visibility } from "../frontend/common"; import { queryPrivateSystem } from "../secretSystemTables"; import { v } from "convex/values"; type FunctionSpec = { identifier: string; functionType: UdfType; visibility: Visibility; args?: ValidatorJSON; returns?: ValidatorJSON; }; type HttpFunctionSpec = { functionType: "HttpAction"; method: string; path: string; }; type FunctionSpecs = (FunctionSpec | HttpFunctionSpec)[]; export const DEFAULT_ARGS_VALIDATOR = '{ "type": "any" }'; export const DEFAULT_RETURN_VALIDATOR = '{ "type": "any" }'; export const apiSpec = queryPrivateSystem({ args: { componentId: v.optional(v.union(v.string(), v.null())), }, handler: async ({ db }): Promise<FunctionSpecs> => { const result: FunctionSpecs = []; for await (const module of db.query("_modules")) { const analyzeResult = module.analyzeResult; if (!analyzeResult) { // `Skipping ${module.path}` continue; } for (const fn of analyzeResult.functions || []) { result.push({ identifier: module.path + ":" + fn.name, functionType: fn.udfType, visibility: fn.visibility ?? { kind: "public" }, args: JSON.parse(fn.args ?? DEFAULT_ARGS_VALIDATOR), returns: JSON.parse(fn.returns ?? DEFAULT_RETURN_VALIDATOR) ?? JSON.parse(DEFAULT_RETURN_VALIDATOR), }); } for (const httpFn of analyzeResult.httpRoutes || []) { result.push({ functionType: "HttpAction", method: httpFn.route.method, path: httpFn.route.path, }); } } return result; }, });

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