---
schema: rendered-html/v1
title: "Supabase 🤝 FastMCP - FastMCP"
source_url: https://gofastmcp.com/integrations/supabase
generated_at: 2026-06-11T19:42:18.818923+00:00
---




[FastMCP home page![light logo](images/gofastmcp__com__integrations__supabase__wordmark.avif)![dark logo](images/gofastmcp__com__integrations__supabase__wordmark-white.avif)](gofastmcp__com.md)







Auth

Supabase 🤝 FastMCP



















  - [Auth0](gofastmcp__com__integrations__auth0.md)
  - [AuthKit](gofastmcp__com__integrations__authkit.md)
  - [AWS Cognito](gofastmcp__com__integrations__aws-cognito.md)
  - [Azure (Entra ID)](gofastmcp__com__integrations__azure.md)
  - [Descope](gofastmcp__com__integrations__descope.md)
  - [Discord](gofastmcp__com__integrations__discord.md)
  - [Eunomia Auth](gofastmcp__com__integrations__eunomia-authorization.md)
  - [GitHub](gofastmcp__com__integrations__github.md)
  - [Google](gofastmcp__com__integrations__google.md)
  - [Keycloak

    NEW](gofastmcp__com__integrations__keycloak.md)
  - [Oracle](gofastmcp__com__integrations__oci.md)
  - [Permit.io](gofastmcp__com__integrations__permit.md)
  - [PropelAuth](gofastmcp__com__integrations__propelauth.md)
  - [Scalekit](gofastmcp__com__integrations__scalekit.md)
  - [Supabase](/integrations/supabase)
  - [WorkOS](gofastmcp__com__integrations__workos.md)




- [Consent UI Requirement](#consent-ui-requirement)
- [Configuration](#configuration)
  - [Prerequisites](#prerequisites)
  - [Step 1: Enable Supabase OAuth Server](#step-1-enable-supabase-oauth-server)
  - [Step 2: Get Supabase Project URL](#step-2-get-supabase-project-url)
  - [Step 3: FastMCP Configuration](#step-3-fastmcp-configuration)
- [Testing](#testing)
  - [Running the Server](#running-the-server)
  - [Testing with a Client](#testing-with-a-client)
- [Production Configuration](#production-configuration)

Auth

# Supabase 🤝 FastMCP


Secure your FastMCP server with Supabase Auth


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**](gofastmcp__com__servers__auth__remote-oauth.md) pattern, where Supabase handles user authentication and your FastMCP server validates the tokens.

Supabase Auth does not currently support [RFC 8707](https://www.rfc-editor.org/rfc/rfc8707.html) resource indicators, so FastMCP cannot validate that tokens were issued for the specific resource server.

## [​](#consent-ui-requirement) 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](https://supabase.com/docs/guides/auth/oauth-server/getting-started) for details on implementing the authorization page.

## [​](#configuration) Configuration

### [​](#prerequisites) Prerequisites

Before you begin, you will need:

1. A **[Supabase Account](https://supabase.com/)** with a project or a self-hosted **Supabase Auth** instance
2. **OAuth Server enabled** in your Supabase Dashboard (Authentication → OAuth Server)
3. **Dynamic Client Registration enabled** in the same settings
4. A **consent UI** hosted at your configured authorization path (see above)
5. Your FastMCP server’s URL (can be localhost for development, e.g., `http://localhost:8000`)

### [​](#step-1-enable-supabase-oauth-server) Step 1: Enable Supabase OAuth Server

In your Supabase Dashboard:

1. Go to **Authentication → OAuth Server**
2. Enable the **OAuth Server**
3. Set your **Site URL** to where your consent UI is hosted
4. Set the **Authorization Path** (e.g., `/oauth/callback`)
5. Enable **Allow Dynamic OAuth Apps** for MCP client registration

### [​](#step-2-get-supabase-project-url) Step 2: 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-3-fastmcp-configuration) Step 3: FastMCP Configuration

Create your FastMCP server using the `SupabaseProvider`:


from fastmcp.server.auth.providers.supabase import SupabaseProvider

auth = SupabaseProvider(
    project_url="https://abc123.supabase.co",
    base_url="http://localhost:8000",

mcp = FastMCP("Supabase Protected Server", auth=auth)

def protected_tool(message: str) -> str:
    """This tool requires authentication."""
    return f"Authenticated user says: {message}"

    mcp.run(transport="http", port=8000)

## [​](#testing) Testing

### [​](#running-the-server) Running the Server

Start your FastMCP server with HTTP transport to enable OAuth flows:

fastmcp run server.py --transport http --port 8000

### [​](#testing-with-a-client) Testing with a Client

Create a test client that authenticates with your Supabase-protected server:

client.py

import asyncio

async def main():
    async with Client("http://localhost:8000/mcp", auth="oauth") as client:
        print("Authenticated with Supabase!")

        result = await client.call_tool("protected_tool", {"message": "Hello!"})
        print(result)

    asyncio.run(main())

When you run the client for the first time:

1. Your browser will open to Supabase’s authorization endpoint
2. After authenticating, Supabase redirects to your consent UI
3. After you approve, the client receives the token and can make authenticated requests

## [​](#production-configuration) Production Configuration

For production deployments, load configuration from environment variables:


import os
from fastmcp.server.auth.providers.supabase import SupabaseProvider

auth = SupabaseProvider(
    project_url=os.environ["SUPABASE_PROJECT_URL"],
    base_url=os.environ.get("BASE_URL", "https://your-server.com"),

mcp = FastMCP(name="Supabase Secured App", auth=auth)

[Scalekit 🤝 FastMCP

Previous](gofastmcp__com__integrations__scalekit.md)[WorkOS 🤝 FastMCP

Next](gofastmcp__com__integrations__workos.md)






