Purpose
Supabase MCP Server is used to connect Supabase projects to AI assistants (such as Cursor, Claude, Windsurf, etc.). It is based on the Model Context Protocol (MCP), which standardizes the way large language models (LLMs) communicate with external services such as Supabase. Through this server, AI assistants can directly interact with Supabase projects to perform tasks such as managing data tables, retrieving configuration, and querying data.
Main Capabilities
- Connect AI assistants to Supabase projects, enabling them to perform operations such as managing data tables, retrieving configuration, and querying data.
- Provide a complete list of tools and configuration options; see the Supabase MCP Server documentation for details.
- The documentation provides an interactive URL builder that can help generate configuration options.
- Support generating a custom MCP URL for a project through the MCP connection tab in the Supabase dashboard.
- Provide the @supabase/mcp-server-supabase package, which exports createToolSchemas(), used to populate input and output schemas for the Vercel AI SDK's MCP client, enabling Supabase MCP tools to be used as static tools, with support for client-side validation and TypeScript type inference.
- createToolSchemas() accepts filtering options similar to the MCP server URL parameters: features (restrict to specific feature groups, such as ['database', 'docs'], defaulting to all default feature groups), projectScoped (when true, omit project_id from tool input schemas and exclude account-level tools, suitable for connecting to a server configured with project_ref, defaulting to false), readOnly (when true, exclude mutation-type tools, suitable for connecting to a server configured with read_only=true, defaulting to false).
- This server does not send structuredContent in MCP tool results; the AI SDK falls back to parsing JSON from the content text.
- Support self-hosted MCP endpoints: @supabase/mcp-server-supabase package exports createSupabaseMcpHandler(), used to serve tools over HTTP from your own endpoint. It accepts the same SupabaseMcpServerOptions as createSupabaseMcpServer(), the most important of which is platform.
- This handler only supports the current protocol revision and uses legacy: 'reject' when created, so clients that only support the 2025-era protocol will receive HTTP 400 instead of being served.
- When platform carries per-request credentials, a handler should be created for each request and closed when the response completes. The handler captures the provided platform in a closure, so a shared handler will serve every request with that platform.
- When platform is intended to be shared (for example, a service account token), a long-lived handler is appropriate. It should be created once and close() should be called on shutdown, rather than closing on every response, because close() tears down the subscription router and rejects subsequent requests.
- toNodeHandler comes from @modelcontextprotocol/node; it is not a dependency of this package and must be installed separately.
- An observer can be passed to createSupabaseMcpServer to collect request lifecycle results and Supabase built-in facts. The server does not automatically forward request or response payloads to the observer. Supabase built-in facts use a closed set of bounded fields and values; custom facts are not automatically privacy-validated. Omitting observer skips all observation work. Failures in the observer, classifier, and sink do not change request behavior, but synchronous observer and classifier work may block requests.
- Other MCP servers: @supabase/mcp-server-postgrest allows connecting your own users to the application through the REST API; see its project README for details.
Usage
- Read the security best practices: before setting up the MCP server, it is recommended to first read the security best practices to understand the risks and mitigations of connecting an LLM to a Supabase project.
- Configure the MCP client: visit SettingsConfigure the Supabase MCP server for the documentation. You can also visit the MCP connection tab of the Supabase dashboard to generate a custom MCP URL for a project. The MCP client will automatically prompt you to log in to Supabase during setup, and you need to select the organization containing the target project. Most MCP clients require the following information (the specific fields are not listed in the original text). If the MCP client you are using is not listed in the documentation, please consult that client's MCP documentation and copy the above MCP information into its expected format (json, yaml, etc.).
- Local environment: If you use the Supabase CLI to run Supabase locally, you can access the MCP server through http://localhost:54321/mcp . Currently, the MCP server in the CLI environment only provides some tools and does not support OAuth 2.1.
- Self-hosted environment: For self-hosted Supabase, please see the "Enabling MCP server" page. Currently, the MCP server in a self-hosted environment only provides some tools and does not support OAuth 2.1.
Use cases
- Developers who want AI assistants to directly operate Supabase projects (manage data tables, retrieve configuration, query data).
- Users of AI assistants that support MCP, such as Cursor, Claude, and Windsurf.
- Developers who need to use Supabase MCP tools as static tools in a Vercel AI SDK MCP client and get client validation and TypeScript type inference.
- Developers who need a self-hosted MCP endpoint and provide tools over HTTP from their own endpoint.
- Scenarios where you want to connect your own users to the application through a REST API using @supabase/mcp-server-postgrest.
Limitations
- The local Supabase CLI environment and the self-hosted Supabase environment currently only provide some tools and do not support OAuth 2.1.
- The self-hosted handler only supports the current protocol revision, and clients that only support the 2025-era protocol will receive HTTP 400.
- This server does not send structuredContent in MCP tool results.
- The server does not automatically forward request or response payloads to the observer; custom facts are not automatically privacy-verified; synchronous observer and classifier work may block requests.
- Before use, read the security best practices to understand the risks of connecting LLMs to Supabase projects.
- The project uses the Apache 2.0 license, see the LICENSE file for details.
Other information
- The project provides a CONTRIBUTING file explaining how to contribute to the project.
- You can learn more about the Model Context Protocol and its capabilities, as well as how to safely roll out changes to production.