npm @supabase/mcp-server-supabasestreamable-httpApache-2.0updated 8d ago
Connect your Supabase projects to Cursor, Claude, Windsurf, and other AI assistants.
What can you do with Supabase?
Supabase MCP Server
Connect your Supabase projects to Cursor, Claude, Windsurf, and other AI assistants.
The Model Context Protocol (MCP) standardizes how Large Language Models (LLMs) talk to external services like Supabase. It connects AI assistants directly with your Supabase project and allows them to perform tasks like managing tables, fetching config, and querying data. See the full list of tools.
Setup
1. Follow our security best practices
Before setting up the MCP server, we recommend you read our security best practices to understand the risks of connecting an LLM to your Supabase projects and how to mitigate them.
2. Configure your MCP client
To configure the Supabase MCP server on your client, visit our setup documentation. You can also generate a custom MCP URL for your project by visiting the MCP connection tab in the Supabase dashboard.
Your MCP client will automatically prompt you to log in to Supabase during setup. Be sure to choose the organization that contains the project you wish to work with.
Most MCP clients require the following information:
{
"mcpServers": {
"supabase": {
"type": "http",
"url": "https://mcp.supabase.com/mcp"
}
}
}
If you don't see your MCP client listed in our documentation, check your client's MCP documentation and copy the above MCP information into their expected format (json, yaml, etc).
CLI
If you're running Supabase locally with Supabase CLI, you can access the MCP server at http://localhost:54321/mcp. Currently, the MCP Server in CLI environments offers a limited subset of tools and no OAuth 2.1.
Self-hosted
For self-hosted Supabase, check the Enabling MCP server page. Currently, the MCP Server in self-hosted environments offers a limited subset of tools and no OAuth 2.1.
Configuration options and tools
See the Supabase MCP Server docs for the full list of available tools and configuration options.
The docs also feature an interactive URL builder to populate configuration options for you.
Usage with AI SDK's MCP Client
The @supabase/mcp-server-supabase package exports createToolSchemas() to populate input and output schemas for Vercel AI SDK's MCP client. This allows Supabase MCP tools to be treated as static tools with client-side validation and inferred TypeScript types for their inputs and outputs.
import { createToolSchemas } from '@supabase/mcp-server-supabase';
import { createMCPClient } from '@ai-sdk/mcp';
import { streamText } from 'ai';
const mcpClient = await createMCPClient({
transport: {
type: 'http',
url: 'https://mcp.supabase.com/mcp',
},
});
const tools = await mcpClient.tools({
schemas: createToolSchemas(),
});
const result = streamText({ model, tools, prompt: '...' });
for (const step of await result.steps) {
for (const toolResult of step.staticToolResults) {
if (toolResult.toolName === 'get_project_url') {
toolResult.input; // { project_id: string }
toolResult.output; // { url: string }
}
}
}
createToolSchemas() accepts similar filtering options as the MCP server's URL parameters:
features: Restrict to specific feature groups (e.g.['database', 'docs']). Defaults to all default feature groups.projectScoped: Whentrue, omitsproject_idfrom tool input schemas and excludes account-level tools — use when connecting to a server configured withproject_ref. Defaults tofalse.readOnly: Whentrue, excludes mutating tools — use when connecting to a server configured withread_only=true. Defaults tofalse.
const mcpClient = await createMCPClient({
transport: {
type: 'http',
url: 'https://mcp.supabase.com/mcp?project_ref=<project-ref>&read_only=true&features=database,docs',
},
});
const tools = await mcpClient.tools({
schemas: createToolSchemas({
features: ['database', 'docs'],
projectScoped: true,
readOnly: true,
}),
});
[!NOTE] This server does not send
structuredContentin MCP tool results. AI SDK falls back to parsing JSON fromcontenttext.
For more information, see Schema Definition and Typed Tool Outputs in the AI SDK docs.
Self-hosting the MCP endpoint
The @supabase/mcp-server-supabase package exports createSupabaseMcpHandler() to serve the tools over HTTP from your own endpoint. It accepts the same SupabaseMcpServerOptions as createSupabaseMcpServer(), most importantly platform.
The handler speaks the current protocol revision only. It is created with legacy: 'reject', so a client that only speaks the 2025-era protocol receives an HTTP 400 instead of being served.
When platform carries a per-request credential, create the handler per request and close it when the response finishes. The handler closes over the platform you supply, so a shared one serves every request with that platform.
A long-lived handler is fine when the platform is meant to be shared, a service-account token for example. Create it once and close() it at shutdown rather than per response, since close() tears down the subscription router and refuses later requests.
import { createServer } from 'node:http';
import { toNodeHandler } from '@modelcontextprotocol/node';
import { createSupabaseMcpHandler } from '@supabase/mcp-server-supabase';
import { createSupabaseApiPlatform } from '@supabase/mcp-server-supabase/platform/api';
const server = createServer((req, res) => {
const accessToken = getAccessTokenFromRequest(req); // your own auth
const handler = createSupabaseMcpHandler({
platform: createSupabaseApiPlatform({ accessToken }),
});
// `close()` aborts in-flight exchanges, so close on `res` finishing rather
// than when the handler resolves, which would cut streaming responses short.
res.on('close', () => {
handler.close().catch((error) => console.error(error));
});
toNodeHandler(handler)(req, res).catch((error) => console.error(error));
});
toNodeHandler comes from @modelcontextprotocol/node, which is not a dependency of this package. Install it alongside.
Other MCP servers
@supabase/mcp-server-postgrest
The PostgREST MCP server allows you to connect your own users to your app via REST API. See more details on its project README.
Resources
- Model Context Protocol: Learn more about MCP and its capabilities.
- From development to production: Learn how to safely promote changes to production environments.
For developers
See CONTRIBUTING for details on how to contribute to this project.
License
This project is licensed under Apache 2.0. See the LICENSE file for details.
Install
Add Supabase to your client. Pick the one you use.
{
"servers": {
"mcp-server-supabase": {
"type": "http",
"url": "https://mcp.supabase.com/mcp"
}
}
}Add to `.vscode/mcp.json` in your workspace.
claude mcp add mcp-server-supabase -- npx -y @supabase/mcp-server-supabasecodex mcp add mcp-server-supabase -- npx -y @supabase/mcp-server-supabaseamp mcp add mcp-server-supabase -- npx -y @supabase/mcp-server-supabase{
"mcpServers": {
"mcp-server-supabase": {
"command": "npx",
"args": [
"-y",
"@supabase/mcp-server-supabase"
]
}
}
}Add to `claude_desktop_config.json`, then restart Claude Desktop.
{
"mcpServers": {
"mcp-server-supabase": {
"command": "npx",
"args": [
"-y",
"@supabase/mcp-server-supabase"
]
}
}
}Add to `~/.cursor/mcp.json`, or `.cursor/mcp.json` for a single project.
{
"mcpServers": {
"mcp-server-supabase": {
"command": "npx",
"args": [
"-y",
"@supabase/mcp-server-supabase"
]
}
}
}Add to `~/.codeium/windsurf/mcp_config.json`.
{
"mcpServers": {
"mcp-server-supabase": {
"command": "npx",
"args": [
"-y",
"@supabase/mcp-server-supabase"
]
}
}
}Add to `cline_mcp_settings.json` via the MCP Servers panel.
{
"mcpServers": {
"mcp-server-supabase": {
"command": "npx",
"args": [
"-y",
"@supabase/mcp-server-supabase"
]
}
}
}Add to `~/.gemini/settings.json`.
{
"mcpServers": {
"mcp-server-supabase": {
"type": "local",
"command": "npx",
"args": [
"-y",
"@supabase/mcp-server-supabase"
],
"tools": [
"*"
]
}
}
}Add to `~/.copilot/mcp-config.json`, or run `/mcp add` inside the CLI.
{
"context_servers": {
"mcp-server-supabase": {
"command": {
"path": "npx",
"args": [
"-y",
"@supabase/mcp-server-supabase"
]
}
}
}
}Add to your Zed `settings.json`.
npx -y @supabase/mcp-server-supabaseRun `goose configure`, choose **Add Extension → Command-line Extension**, and paste this command.
Score
84 / 100
Excellent
- Documentation25/25
- Maintenance25/25
- Trust16/20
- Capability3/15
- Install experience15/15
- Documents what it does and how to connect
- Has a resolvable package or endpoint
- Exposes at least one tool, prompt or resource
- README has substantive content
- Includes a code example
- Documents its configuration
- Mentions credentials or security posture
- Last commit 0 days ago
- Has a release history
- Repository is not archived
- Licensed Apache-2.0
- Namespace verified in the official MCP registry
- Claimed by its owner
- Published under an organisation
- 0 tool(s) documented
- Provides prompt templates
- Provides resources
- 18 documented install method(s)
- Published to a package registry
- Offers a hosted endpoint — no local install
Version history
| Versions | Published |
|---|---|
| 0.11.0Latest | Aug 20, 2026 |
| 0.10.0 | Aug 10, 2026 |
| 0.9.0 | Jul 17, 2026 |
| 0.8.3 | Jul 15, 2026 |
| 0.8.2 | Jun 8, 2026 |
| 0.8.1 | May 1, 2026 |
| 0.7.0 | Mar 2, 2026 |
| 0.6.3 | Feb 3, 2026 |
| 0.6.2 | Jan 27, 2026 |
| 0.6.1 | Jan 6, 2026 |
| 0.6.0 | Jan 6, 2026 |
| 0.5.10 | Dec 16, 2025 |
| 0.5.9 | Nov 3, 2025 |
| 0.5.6 | Oct 7, 2025 |
| 0.5.5 | Sep 18, 2025 |
| 0.5.4 | Sep 15, 2025 |