Skip to main content
Glama

oferty-spike-mcp

Spike #1 of the "Online Offers" project: will the built-in OAuth 2.1 server of Supabase Auth (beta) work with the Claude app through Dynamic Client Registration.

The code is throwaway. Zero tests, zero error handling beyond what the spike itself diagnoses, zero real MCP tools. All that remains after completion is a notes file with conclusions.

What's here

File

Role

src/server.js

HTTP routing, Host validation, lazy auth, discovery

src/mcp.js

MCP server v2 + ping() tool returning the token's identity

src/verifier.js

Two paths: static Bearer (Claude Code) and Supabase token (Claude app)

src/consent.js

Consent page — the only thing we actually write ourselves

src/supabase-metadata.js

Fetching AS metadata at startup, fail fast

We use SDK v2 (@modelcontextprotocol/server + @modelcontextprotocol/node). @modelcontextprotocol/sdk is legacy v1 — most online tutorials describe exactly that one.

Related MCP server: Remote MCP Server on Cloudflare

Environment variables

See .env.example. All four are required; the process won't start without them.

Local run

npm ci
APP_ORIGIN=http://localhost:3000 SUPABASE_URL=https://twoj.supabase.co \
  SUPABASE_ANON_KEY=... SPIKE_STATIC_TOKEN=... npm start

Endpoints

  • POST /mcp — Streamable HTTP, stateless

  • GET /.well-known/oauth-protected-resource/mcp — RFC 9728

  • GET /.well-known/oauth-authorization-server — Supabase metadata, passed through verbatim

  • GET /oauth/consent?authorization_id=… — consent page

  • GET /healthz — process liveness, deliberately does not ping Supabase

Diagnostics

Without a token, POST /mcp responds with 401 and a WWW-Authenticate header pointing to the Protected Resource Metadata — that's how you know lazy auth is working.

When you suspect a connector reconnection issue (the most suspicious part of the spike), supabase.auth.oauth.listGrants() and revokeGrant({ clientId }) come in handy — they let you view and delete a saved grant without touching the database by hand.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables Claude.ai to connect to a Hermes MCP server via OAuth 2.1 authorization code flow with PKCE, acting as a reverse proxy and single-user authorization gateway.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables remote MCP server deployment on Cloudflare Workers with OAuth login, supporting tool calling via SSE from clients like MCP Inspector or Claude Desktop.
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    A proof-of-concept HTTP MCP server requiring OAuth 2.0 authentication before tool use. Demonstrates the full authentication flow with Claude Code, including discovery, client registration, PKCE authorization, and bearer token verification.
    -