Skip to main content
Glama

oferty-spike-mcp

「Oferty Online」プロジェクトのスパイク #1:Supabase Auth (beta) に組み込まれた OAuth 2.1 サーバーは、Dynamic Client Registration 経由で Claude アプリと通信できるか。

コードは使い捨てです。 テストはゼロ、スパイク自身が診断する以外のエラー処理もゼロ、実際の MCP ツールもゼロ。スパイク実行後に残るのは、結論をまとめたメモだけです。

ここにあるもの

ファイル

役割

src/server.js

HTTP ルーティング、Host 検証、lazy auth、discovery

src/mcp.js

MCP v2 サーバー + トークンから ID を返す ping() ツール

src/verifier.js

2 つのパス: 静的 Bearer (Claude Code) と Supabase トークン (Claude アプリ)

src/consent.js

同意ページ — 自分達で書く唯一のもの

src/supabase-metadata.js

起動時に AS メタデータを取得、フェイルファスト

SDK v2 (@modelcontextprotocol/server + @modelcontextprotocol/node) を使用しています。 @modelcontextprotocol/sdk はレガシー v1 で、Web 上のチュートリアルの大半はこちらを説明しています。

Related MCP server: Remote MCP Server on Cloudflare

環境変数

.env.example を参照してください。4 つすべて必須で、これらがないとプロセスは起動しません。

ローカルでの起動

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

エンドポイント

  • POST /mcp — Streamable HTTP、ステートレス

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

  • GET /.well-known/oauth-authorization-server — Supabase のメタデータをそのまま渡す

  • GET /oauth/consent?authorization_id=… — 同意ページ

  • GET /healthz — プロセスの死活状況。意図的に Supabase には ping しない

診断

トークンなしで POST /mcp を呼び出すと、Protected Resource Metadata を指す WWW-Authenticate ヘッダー付きの 401 が返ります。これで lazy authentication が機能していることがわかります。

connector の再接続に問題がある場合(スパイクで最も疑わしいポイント)は、supabase.auth.oauth.listGrants() と revokeGrant({ clientId }) を使うと便利です。保存された同意を、データベースを手で触らずに確認・削除できます。

Related MCP Connectors

  • Experimental MCP server for current empirical verification of explicit public HTTPS endpoint claims.

  • The Stytch MCP server is a reference implementation that demonstrates remote MCP server authentication and authorization using Stytch Connected Apps. It provides OAuth 2.1-compliant authorization (including PKCE), Dynamic Client Registration, and validates Stytch-issued access tokens to enable AI agents to securely interact with external services through permissioned access, supporting scopes like openid, email, profile, and manage:project_data.

  • Remote streamable-HTTP MCP server running on a single Cloudflare Worker. Your assistant gets live Airbnb, Amazon, Booking.com, Google Flights, Maps and Reddit data, social search on X, Instagram and TikTok, the Meta Ad Library, and image/video generation without any keys. Connect your own accounts to let it send WhatsApp or Telegram messages, work an IMAP inbox, manage Meta Ads campaigns and publish to X and LinkedIn. OAuth 2.1 with PKCE; stored credentials are AES-256-GCM encrypted.

  • Minimal streamable HTTP MCP server used for owned-account registry connectivity tests.

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
    C
    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.
    -
  • F
    license
    Not graded
    quality
    B
    maintenance
    A simple HTTP-based MCP server that provides demo tools (get_test_string, echo, check_maintenance), greeting prompts, and test resources, with optional OAuth 2.1 support.
    -