Skip to main content
Glama
middleware.ts738 B
import { getSessionCookie } from "better-auth/cookies" import { type NextRequest, NextResponse } from "next/server" export async function middleware(request: NextRequest) { // Check cookie for optimistic redirects for protected routes // Use getSession in your RSC to protect a route via SSR or useAuthenticate client side const sessionCookie = getSessionCookie(request) if (!sessionCookie) { const redirectTo = request.nextUrl.pathname + request.nextUrl.search return NextResponse.redirect(new URL(`/auth/sign-in?redirectTo=${redirectTo}`, request.url)) } return NextResponse.next() } export const config = { // Protected routes matcher: ["/auth/settings", "/admin/:path*", "/web/dashboard", "/web/submit"] }

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