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 { query } from "./_generated/server";
import { api } from "./_generated/api";
export const getName = query(async function ({ auth }) {
const user = await auth.getUserIdentity();
if (user !== null) {
return user.name ?? "No name provided";
}
return null;
});
export const getIdentifier = query(async function ({ auth }) {
const user = await auth.getUserIdentity();
if (user !== null) {
return user.tokenIdentifier;
}
return null;
});
// If "objects" is empty, returns the current time without reading `ctx.auth`.
// Then the query can be cached across users.
// If "objects" is not empty, returns the auth token identifier, which cannot
// be cached across users.
export const conditionallyCheckAuth = query(async function (ctx) {
const objects = await ctx.db.query("objects").collect();
if (objects.length === 0) {
return new Date().toString();
}
const user = await ctx.auth.getUserIdentity();
return user?.tokenIdentifier ?? "No user";
});
export const conditionallyCheckAuthInSubquery = query(
async function (ctx): Promise<string> {
return await ctx.runQuery(api.auth.conditionallyCheckAuth);
},
);