Supabase MCP — Database & Auth for AI Agents
Official Supabase MCP server. Connect AI agents to Supabase for database queries, auth management, storage, edge functions, and real-time subscriptions. 2.6K+ stars.
What it is
Supabase MCP is the official Model Context Protocol server built by Supabase. It lets AI coding assistants like Claude Code or Cursor interact with your Supabase project directly -- running SQL queries, managing authentication, accessing file storage, calling edge functions, and subscribing to real-time changes.
It targets developers who build applications on Supabase and want their AI agent to understand their database schema, write queries, debug issues, and manage backend resources without context-switching to the Supabase dashboard.
How it saves time or tokens
Instead of manually describing your database schema to the AI or copy-pasting query results, the MCP server gives the agent direct access. The agent can inspect your tables, understand relationships, write and test SQL queries, and even create database migrations. This eliminates the schema-description overhead that wastes both your time and prompt tokens.
How to use
- Add the Supabase MCP server to your editor configuration:
{
"mcpServers": {
"supabase": {
"command": "npx",
"args": [
"-y",
"@supabase/mcp-server-supabase@latest",
"--access-token",
"sbp_YOUR_TOKEN"
]
}
}
}
- Generate a personal access token at https://supabase.com/dashboard/account/tokens.
- Restart your AI editor.
- Ask the agent to interact with your Supabase project:
'Show me the schema of the users table and suggest an index for the email column.'
Example
| Capability | What the agent can do |
|---|---|
| Database | Read schema, run SQL, create migrations |
| Auth | List users, check policies, debug RLS |
| Storage | List buckets, manage files |
| Edge Functions | List and invoke functions |
| Real-time | Configure subscriptions |
Related on TokRepo
- Supabase MCP integration -- deep-dive into Supabase MCP setup
- AI tools for database -- database tools for AI agents
Common pitfalls
- The personal access token grants broad access to your Supabase project. Use a token scoped to development projects, not production, when experimenting with AI agents.
- Row Level Security (RLS) policies apply to SQL queries run through the MCP server. If your queries return empty results, check that the token's role has the necessary permissions.
- Schema changes made by the agent (CREATE TABLE, ALTER TABLE) are applied immediately. Review generated migrations before letting the agent execute them.
Frequently Asked Questions
Yes. This MCP server is built and maintained by Supabase under the @supabase npm organization. It is the official integration for connecting AI agents to Supabase projects. It follows the Model Context Protocol standard and works with any MCP-compatible editor.
The agent can run any SQL that the access token permits, including writes and schema changes. To protect production data, use a token scoped to your development or staging project. Never use a production token during development or experimentation with AI agents.
Yes. The MCP server can list your deployed edge functions and invoke them. This lets the AI agent trigger serverless functions as part of its workflow. You can use this to test edge functions, debug issues, or chain function calls during development.
The MCP server connects using your personal access token, which typically has service_role or anon level access depending on configuration. RLS policies are enforced based on this role. If you want the agent to see data as a specific user, configure the token accordingly.
The MCP server is designed for Supabase Cloud projects authenticated via personal access tokens. For self-hosted Supabase, you would need to configure the server to point to your self-hosted instance, which may require additional setup. Check the repository documentation for self-hosted configuration options.
Citations (3)
- Supabase MCP GitHub— Official Supabase MCP server
- Supabase Docs— Supabase documentation and platform
- MCP Official Docs— Model Context Protocol specification
Related on TokRepo
Source & Thanks
Created by Supabase. Licensed under Apache 2.0. supabase-community/supabase-mcp — 2,600+ GitHub stars