URL: https://gofastmcp.com/integrations/supabase
Title: Supabase 🤝 FastMCP - FastMCP

Documentation Index
Fetch the complete documentation index at:
/llms.txt
Use this file to discover all available pages before exploring further.
Skip to main content
Meet
Prefect Horizon
, the enterprise MCP gateway built by the team behind FastMCP
FastMCP
home page
v3
Prefect Horizon
PrefectHQ/fastmcp
25,596
PrefectHQ/fastmcp
25,596
Search...
Navigation
Auth
Supabase 🤝 FastMCP
Search the docs...
Ctrl
K
Documentation
Get Started
Welcome!
Installation
Quickstart
Servers
Overview
Core Components
Working with Tools
MCP Providers
Interactivity
Extensibility
Auth
Deployment
Apps
Overview
Quickstart
NEW
FastMCPApp
NEW
Interactive Tools
NEW
Generative UI
NEW
Custom HTML
Reference
Clients
Overview
Client-Only Package
Transports
fastmcp-remote
Operations
UPDATED
Authentication
UPDATED
Integrations
Auth
Auth0
AuthKit
AWS Cognito
Azure (Entra ID)
Descope
Discord
Eunomia Auth
GitHub
Google
Keycloak
NEW
Oracle
Permit.io
PropelAuth
Scalekit
Supabase
WorkOS
Web Frameworks
AI Assistants
AI SDKs
MCP.json
More
Settings
CLI
Upgrading
Development
What's New
FAQ
On this page
Consent UI Requirement
Configuration
Prerequisites
Step 1: Enable Supabase OAuth Server
Step 2: Get Supabase Project URL
Step 3: FastMCP Configuration
Testing
Running the Server
Testing with a Client
Production Configuration
Auth
Supabase 🤝 FastMCP
Copy page
Secure your FastMCP server with Supabase Auth
Copy page
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.
Supabase Auth does not currently support
RFC 8707
resource indicators, so FastMCP cannot validate that tokens were issued for the specific resource server.
​
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 the
SupabaseProvider
:
server.py
from
fastmcp
import
FastMCP
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
)
@
mcp
.
tool
def
protected_tool
(
message
:
str
)
->
str
:
"""
This tool requires authentication.
"""
return
f
"Authenticated user says:
{
message
}
"
if
__name__
==
"
__main__
"
:
mcp
.
run
(
transport
=
"
http
"
,
port
=
8000
)
​
Testing
​
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
Create a test client that authenticates with your Supabase-protected server:
client.py
from
fastmcp
import
Client
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
)
if
__name__
==
"
__main__
"
:
asyncio
.
run
(
main
())
When you run the client for the first time:
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
import
os
from
fastmcp
import
FastMCP
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
WorkOS 🤝 FastMCP
Next
Ctrl
+I
discord
github
website
x
Powered by
This documentation is built and hosted on Mintlify, a developer documentation platform
Assistant
Responses are generated using AI and may contain mistakes.
\n\n
\n
\n \n
\n
