Skip to main content
New in version 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.

Configuration

Prerequisites

Before you begin, you will need:
  1. A Supabase Account with a project or a self-hosted Supabase Auth instance
  2. Your FastMCP server’s URL (can be localhost for development, e.g., http://localhost:8000)

Step 1: Get Supabase Project URL

In your Supabase Dashboard:
  1. Go to Project Settings
  2. Copy your Project URL (e.g., https://abc123.supabase.co)

Step 2: FastMCP Configuration

Create your FastMCP server using the SupabaseProvider:
server.py

Testing

Running the Server

Start your FastMCP server with HTTP transport to enable OAuth flows:
Your server is now running and protected by Supabase authentication.

Testing with a Client

Create a test client that authenticates with your Supabase-protected server:
client.py
When you run the client for the first time:
  1. Your browser will open to Supabase’s authorization page
  2. After you authorize, you’ll be redirected back
  3. The client receives the token and can make authenticated requests

Production Configuration

For production deployments, load configuration from environment variables:
server.py