Skip to main content
Glama
links.ts1.2 kB
"use client"; import { httpBatchLink, loggerLink } from "@trpc/client"; import superjson from "superjson"; import { authClient } from "@/lib/auth-client"; /** * TRPC Nextjs Client - It will be used with react query */ export const trpcLinks = [ loggerLink({ enabled: (opts) => process.env.NODE_ENV === "development" || (opts.direction === "down" && opts.result instanceof Error), }), httpBatchLink({ // TODO: Change this to be a full URL exposed as a client side setting url: `${process.env.NEXT_PUBLIC_API_URL}/api/trpc`, maxURLLength: 14000, transformer: superjson, headers: async () => { const session = await authClient.getSession(); if (session instanceof Error || !session) { return {}; } // @ts-ignore - better-auth 类型定义问题 return { Authorization: `Bearer ${session.data?.session.token}`, "x-trpc-source": "client", }; }, // 添加错误处理 fetch: async (url, options) => { const response = await fetch(url, options); if (response.status === 401) { window.location.href = "/auth/sign-in"; } return response; }, }), ];

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/metacode0602/open-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server