Skip to main content
Glama

Convex MCP server

Official
by get-convex
router.tsx1.77 kB
import { createRouter as createTanStackRouter } from '@tanstack/react-router' import { routeTree } from './routeTree.gen' import { DefaultCatchBoundary } from './components/DefaultCatchBoundary' import { NotFound } from './components/NotFound' import { routerWithQueryClient } from '@tanstack/react-router-with-query' import { ConvexProvider, ConvexReactClient } from 'convex/react' import { ConvexQueryClient } from '@convex-dev/react-query' import { QueryClient } from '@tanstack/react-query' export function createRouter() { const CONVEX_URL = (import.meta as any).env.VITE_CONVEX_URL! if (!CONVEX_URL) { throw new Error('missing VITE_CONVEX_URL envar') } const convex = new ConvexReactClient(CONVEX_URL, { unsavedChangesWarning: false, }) const convexQueryClient = new ConvexQueryClient(convex) const queryClient: QueryClient = new QueryClient({ defaultOptions: { queries: { queryKeyHashFn: convexQueryClient.hashFn(), queryFn: convexQueryClient.queryFn(), }, }, }) convexQueryClient.connect(queryClient) // @snippet start example const router = routerWithQueryClient( createTanStackRouter({ routeTree, defaultPreload: 'intent', defaultErrorComponent: DefaultCatchBoundary, defaultNotFoundComponent: () => <NotFound />, context: { queryClient, convexClient: convex, convexQueryClient }, scrollRestoration: true, Wrap: ({ children }) => ( <ConvexProvider client={convexQueryClient.convexClient}> {children} </ConvexProvider> ), }), queryClient, ) // @snippet end example return router } declare module '@tanstack/react-router' { interface Register { router: ReturnType<typeof createRouter> } }

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