New: Earn 20% as an AgentAlley affiliate. Share your link and earn on every sale you refer. Join now New: Earn 20% as an affiliate. Join now

Query tables, run migrations

Supabase MCP Server

by supabase-community · Apache-2.0 license · ★ 2,917 on GitHub · updated Sep 21

Supabase MCP Server cover

Connects your Supabase projects: query tables, run migrations, read logs and manage branches from your AI.

# Supabase MCP Server

[![MCP Registry Version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fregistry.modelcontextprotocol.io%2Fv0.1%2Fservers%2Fcom.supabase%252Fmcp%2Fversions%2Flatest&query=%24.server.version&label=MCP%20Registry&logo=modelcontextprotocol)](https://registry.modelcontextprotocol.io/?q=com.supabase%2Fmcp)

> Connect your Supabase projects to Cursor, Claude, Windsurf, and other AI assistants.

![supabase-mcp-demo](https://github.com/user-attachments/assets/3fce101a-b7d4-482f-9182-0be70ed1ad56)

The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (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](https://supabase.com/mcp#available-tools).

## Setup

### 1. Follow our security best practices

Before setting up the MCP server, we recommend you read our [security best practices](https://supabase.com/docs/guides/ai-tools/mcp#security-risks) to understand the risks of connecting an LLM to your Supabase projects and how to mitigate them.


### 2. Configure your MCP client

Overview

[](https://registry.modelcontextprotocol.io/?q=com.supabase%2Fmcp)

Manual install (npx, ZIP)
Claude Codemkdir -p ~/.claude/agents && curl -sL https://raw.githubusercontent.com/supabase-community/supabase-mcp/4cc6660f656673eb83f3b80b0c3ae7030b3d2772/README.md \ -o ~/.claude/agents/README.md
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\agents" | Out-Null; Invoke-WebRequest "https://raw.githubusercontent.com/supabase-community/supabase-mcp/4cc6660f656673eb83f3b80b0c3ae7030b3d2772/README.md" -OutFile "$HOME\.claude\agents\README.md"

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • README.md7.9 KB
Read the files here
supabase-community/4cc66601 file
Shared references13SKILL.md reads these from elsewhere in the repo. Not in the ZIP.Get them on GitHub ↗
README.md
Show the full text166 lines

Supabase MCP Server

MCP Registry Version

Connect your Supabase projects to Cursor, Claude, Windsurf, and other AI assistants.

supabase-mcp-demo

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: When true, omits project_id from tool input schemas and excludes account-level tools — use when connecting to a server configured with project_ref. Defaults to false.
  • readOnly: When true, excludes mutating tools — use when connecting to a server configured with read_only=true. Defaults to false.
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 structuredContent in MCP tool results. AI SDK falls back to parsing JSON from content text.

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

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.

1# Supabase MCP Server
2 
3[![MCP Registry Version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fregistry.modelcontextprotocol.io%2Fv0.1%2Fservers%2Fcom.supabase%252Fmcp%2Fversions%2Flatest&query=%24.server.version&label=MCP%20Registry&logo=modelcontextprotocol)](https://registry.modelcontextprotocol.io/?q=com.supabase%2Fmcp)
4 
5> Connect your Supabase projects to Cursor, Claude, Windsurf, and other AI assistants.
6 
7![supabase-mcp-demo](https://github.com/user-attachments/assets/3fce101a-b7d4-482f-9182-0be70ed1ad56)
8 
9The [Model Context Protocol](https://modelcontextprotocol.io/introduction) (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](https://supabase.com/mcp#available-tools).
10 
11## Setup
12 
13### 1. Follow our security best practices
14 
15Before setting up the MCP server, we recommend you read our [security best practices](https://supabase.com/docs/guides/ai-tools/mcp#security-risks) to understand the risks of connecting an LLM to your Supabase projects and how to mitigate them.
16 
17 
18### 2. Configure your MCP client
19 
20To configure the Supabase MCP server on your client, visit our [setup documentation](https://supabase.com/docs/guides/getting-started/mcp#step-2-configure-your-ai-tool). You can also generate a custom MCP URL for your project by visiting the [MCP connection tab](https://supabase.com/dashboard/project/_?showConnect=true&connectTab=mcp) in the Supabase dashboard.
21 
22Your 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.
23 
24Most MCP clients require the following information:
25 
26```json
27{
28 "mcpServers": {
29 "supabase": {
30 "type": "http",
31 "url": "https://mcp.supabase.com/mcp"
32 }
33 }
34}
35```
36 
37If 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).
38 
39#### CLI
40 
41If you're running Supabase locally with [Supabase CLI](https://supabase.com/docs/guides/local-development/cli/getting-started), 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.
42 
43#### Self-hosted
44 
45For [self-hosted Supabase](https://supabase.com/docs/guides/self-hosting/docker), check the [Enabling MCP server](https://supabase.com/docs/guides/self-hosting/enable-mcp) page. Currently, the MCP Server in self-hosted environments offers a limited subset of tools and no OAuth 2.1.
46 
47## Configuration options and tools
48 
49See the [Supabase MCP Server](https://supabase.com/mcp) docs for the full list of [available tools](https://supabase.com/mcp#available-tools) and [configuration options](https://supabase.com/mcp#configuration-options).
50 
51The docs also feature an interactive URL builder to populate configuration options for you.
52 
53## Usage with AI SDK's MCP Client
54 
55The `@supabase/mcp-server-supabase` package exports `createToolSchemas()` to populate input and output schemas for Vercel AI SDK's [MCP client](https://ai-sdk.dev/docs/ai-sdk-core/mcp-tools). This allows Supabase MCP tools to be treated as static tools with client-side validation and inferred TypeScript types for their inputs and outputs.
56 
57```ts
58import { createToolSchemas } from '@supabase/mcp-server-supabase';
59import { createMCPClient } from '@ai-sdk/mcp';
60import { streamText } from 'ai';
61 
62const mcpClient = await createMCPClient({
63 transport: {
64 type: 'http',
65 url: 'https://mcp.supabase.com/mcp',
66 },
67});
68 
69const tools = await mcpClient.tools({
70 schemas: createToolSchemas(),
71});
72 
73const result = streamText({ model, tools, prompt: '...' });
74 
75for (const step of await result.steps) {
76 for (const toolResult of step.staticToolResults) {
77 if (toolResult.toolName === 'get_project_url') {
78 toolResult.input; // { project_id: string }
79 toolResult.output; // { url: string }
80 }
81 }
82}
83```
84 
85`createToolSchemas()` accepts similar filtering options as the MCP server's URL parameters:
86 
87- `features`: Restrict to specific [feature groups](https://supabase.com/mcp#configuration-options) (e.g. `['database', 'docs']`). Defaults to all default feature groups.
88- `projectScoped`: When `true`, omits `project_id` from tool input schemas and excludes account-level tools — use when connecting to a server configured with `project_ref`. Defaults to `false`.
89- `readOnly`: When `true`, excludes mutating tools — use when connecting to a server configured with `read_only=true`. Defaults to `false`.
90 
91```ts
92const mcpClient = await createMCPClient({
93 transport: {
94 type: 'http',
95 url: 'https://mcp.supabase.com/mcp?project_ref=<project-ref>&read_only=true&features=database,docs',
96 },
97});
98 
99const tools = await mcpClient.tools({
100 schemas: createToolSchemas({
101 features: ['database', 'docs'],
102 projectScoped: true,
103 readOnly: true,
104 }),
105});
106```
107 
108> [!NOTE]
109> This server does not send `structuredContent` in MCP tool results. AI SDK falls back to parsing JSON from `content` text.
110 
111For more information, see [Schema Definition](https://ai-sdk.dev/docs/ai-sdk-core/mcp-tools#schema-definition) and [Typed Tool Outputs](https://ai-sdk.dev/docs/ai-sdk-core/mcp-tools#typed-tool-outputs) in the AI SDK docs.
112 
113## Self-hosting the MCP endpoint
114 
115The `@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`.
116 
117The 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.
118 
119When `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.
120 
121A 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.
122 
123```ts
124import { createServer } from 'node:http';
125import { toNodeHandler } from '@modelcontextprotocol/node';
126import { createSupabaseMcpHandler } from '@supabase/mcp-server-supabase';
127import { createSupabaseApiPlatform } from '@supabase/mcp-server-supabase/platform/api';
128 
129const server = createServer((req, res) => {
130 const accessToken = getAccessTokenFromRequest(req); // your own auth
131 
132 const handler = createSupabaseMcpHandler({
133 platform: createSupabaseApiPlatform({ accessToken }),
134 });
135 
136 // `close()` aborts in-flight exchanges, so close on `res` finishing rather
137 // than when the handler resolves, which would cut streaming responses short.
138 res.on('close', () => {
139 handler.close().catch((error) => console.error(error));
140 });
141 
142 toNodeHandler(handler)(req, res).catch((error) => console.error(error));
143});
144```
145 
146`toNodeHandler` comes from `@modelcontextprotocol/node`, which is not a dependency of this package. Install it alongside.
147 
148## Other MCP servers
149 
150### `@supabase/mcp-server-postgrest`
151 
152The PostgREST MCP server allows you to connect your own users to your app via REST API. See more details on its [project README](./packages/mcp-server-postgrest).
153 
154## Resources
155 
156- [**Model Context Protocol**](https://modelcontextprotocol.io/introduction): Learn more about MCP and its capabilities.
157- [**From development to production**](/docs/production.md): Learn how to safely promote changes to production environments.
158 
159## For developers
160 
161See [CONTRIBUTING](./CONTRIBUTING.md) for details on how to contribute to this project.
162 
163## License
164 
165This project is licensed under Apache 2.0. See the [LICENSE](./LICENSE) file for details.
166 
View all files on GitHub →

Details

Updated
Sep 21, 2026
License
Apache-2.0
Stars on the repo
★ 2,917
Checked
Source
supabase-community/supabase-mcp ↗
Creator
supabase-community · 1 listing
View creator

Similar MCP servers

See all →
SkillTests in real browsers via Chrome DevTools MCPBrowser testing with devtoolsaddyosmani/agent-skills · by addyosmaniTests in real browsers via Chrome DevTools MCP. Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze network requests, profile performance, or verify visual output with real runtime data. Requires the chrome-devtools MCP server to be configured.★ 98.7k GitHub starsMCPThis MCP server attempts to exercise all the featuresEverything MCP Servermodelcontextprotocol/servers · by modelcontextprotocolThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test…★ 90.5k GitHub starsMCPA Model Context Protocol server that provides web contentFetch MCP Servermodelcontextprotocol/servers · by modelcontextprotocolA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content…★ 90.5k GitHub starsMCPNode.js server implementing Model Context ProtocolFilesystem MCP Servermodelcontextprotocol/servers · by modelcontextprotocolNode.js server implementing Model Context Protocol (MCP) for filesystem operations.★ 90.5k GitHub starsSkillAbout libraries, frameworks, API referencesContext7 MCPupstash/context7 · by upstashThis skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.★ 62.3k GitHub starsSkillUses Chrome DevTools via MCP for efficient debuggingChromeDevTools/chrome-devtools-mcp · by ChromeDevToolsUses Chrome DevTools via MCP for efficient debugging, troubleshooting and browser automation. Use when debugging web pages, automating browser interactions, analyzing performance, or inspecting network requests. This skill does not apply to `--slim` mode (MCP configuration).★ 52.4k GitHub stars