Open
Description
I'm having an awesome time with Convex and the MCP server. However I am looking for assistance with using the MCP server to call functions requiring user authentication.
Take for example this query:
export const listThreads = query({
args: {
paginationOpts: paginationOptsValidator,
},
handler: async (ctx, args) => {
const userId = await getAuthUserId(ctx);
if (userId === null) {
throw new Error("User must be authenticated to list threads.");
}
return await ctx.db
.query("userThreads")
.withIndex("by_user", (thread) => thread.eq("userId", userId))
.order("desc")
.paginate(args.paginationOpts);
},
});
When an LLM attempts to use the MCP server to call this function it will get the User must be authenticated to request threads
error because it does not operate as a user.
Is there some way for the MCP server to authenticate and act as a user in order to call these sorts of authenticated functions? It's unclear whether this is supported/possible
Metadata
Metadata
Assignees
Labels
No labels