Documentation menu

Architecture

anymrkt is a Next.js 15 application with the App Router, backed by Supabase Postgres. Authentication is handled by NextAuth v5 (Google OAuth + credentials). The MCP server is a first-class HTTP endpoint at /mcp that exposes 90+ tools across six products.

Request flow

  1. Incoming HTTP request hits proxy.ts (not middleware.ts — renamed in Next 16).
  2. proxy.ts checks the public-route allowlist. Paths not on the list redirect to /auth/signin.
  3. Authenticated routes resolve the session via NextAuth, then query Supabase with next_auth.uid() as the RLS identity.
  4. MCP endpoint resolves the bearer token, validates DPoP if bound, and builds a per-connection server instance.

Key components

ComponentPathDescription
Routing gateproxy.tsPublic allowlist; redirect to signin for protected routes.
MCP serverapp/mcp/route.tsSSE/HTTP endpoint; builds per-request server.
MCP authlib/mcp/auth.tsToken resolution, DPoP, permission checks.
MCP builderlib/mcp/server.tsTool registration; filtering per token.

Sub-articles