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 { v } from "convex/values";
import { query } from "./_generated/server";
import { mutationWithSession } from "./lib/sessions";
export const list = query({
args: {},
handler: async (ctx) => {
const messages = await ctx.db.query("messages").collect();
return Promise.all(
messages.map(async (message) => {
const { author, ...messageBody } = message;
const name = (await ctx.db.get(author))!.name;
return { author: name, ...messageBody };
}),
);
},
});
export const send = mutationWithSession({
args: { body: v.string() },
handler: async (ctx, { body }) => {
let userId = ctx.user?._id;
if (!userId) {
const { sessionId } = ctx;
userId = await ctx.db.insert("users", { name: "Anonymous", sessionId });
}
await ctx.db.insert("messages", { body, author: userId });
},
});