2.13.0
This guide shows you how to secure your FastMCP server using Supabase Auth. This integration uses the Remote OAuth pattern, where Supabase handles user authentication and your FastMCP server validates the tokens.
Consent UI Requirement
Supabase’s OAuth Server delegates the user consent screen to your application. When an MCP client initiates authorization, Supabase authenticates the user and then redirects to your application at a configured callback URL (e.g.,https://your-app.com/oauth/callback?authorization_id=...). Your application must host a page that calls Supabase’s approveAuthorization() or denyAuthorization() APIs to complete the flow.
SupabaseProvider handles the resource server side (token verification and metadata), but you are responsible for building and hosting the consent UI separately. See Supabase’s OAuth Server documentation for details on implementing the authorization page.
Configuration
Prerequisites
Before you begin, you will need:- A Supabase Account with a project or a self-hosted Supabase Auth instance
- OAuth Server enabled in your Supabase Dashboard (Authentication → OAuth Server)
- Dynamic Client Registration enabled in the same settings
- A consent UI hosted at your configured authorization path (see above)
- Your FastMCP server’s URL (can be localhost for development, e.g.,
http://localhost:8000)
Step 1: Enable Supabase OAuth Server
In your Supabase Dashboard:- Go to Authentication → OAuth Server
- Enable the OAuth Server
- Set your Site URL to where your consent UI is hosted
- Set the Authorization Path (e.g.,
/oauth/callback) - Enable Allow Dynamic OAuth Apps for MCP client registration
Step 2: Get Supabase Project URL
In your Supabase Dashboard:- Go to Project Settings
- Copy your Project URL (e.g.,
https://abc123.supabase.co)
Step 3: FastMCP Configuration
Create your FastMCP server using theSupabaseProvider:
server.py
Testing
Running the Server
Start your FastMCP server with HTTP transport to enable OAuth flows:Testing with a Client
Create a test client that authenticates with your Supabase-protected server:client.py
- Your browser will open to Supabase’s authorization endpoint
- After authenticating, Supabase redirects to your consent UI
- After you approve, the client receives the token and can make authenticated requests
Production Configuration
For production deployments, load configuration from environment variables:server.py

