Supabase MCP — Postgres + Auth Server for AI Agents
MCP server for Supabase that gives AI agents access to PostgreSQL databases, authentication, storage, and edge functions. Query data, manage users, and build full-stack features. 4,000+ stars.
Safe staging for this asset
This asset is staged first. The copied prompt tells the agent to inspect the staged files and ask before activating scripts, MCP config, or global config.
npx -y tokrepo@latest install b141b1a9-a134-4be5-9708-93d48ccc7ff4 --target codexStages files first; activation requires review of the staged README and plan.
What it is
Supabase MCP is a Model Context Protocol server that connects AI agents to Supabase services. It provides access to PostgreSQL databases, authentication, file storage, and edge functions through the MCP tool interface.
Supabase MCP targets AI developers building agents that need to query databases, manage users, or interact with Supabase-hosted applications -- all through natural language commands in their AI client.
How it saves time or tokens
Instead of writing SQL queries manually or building API integrations, developers can ask their AI agent to query data, create users, or manage storage directly. The MCP server handles the Supabase API calls and returns structured results. Token estimate is approximately 2400 tokens per session.
How to use
- Add Supabase MCP to your
.mcp.json:
{
"mcpServers": {
"supabase": {
"command": "npx",
"args": ["-y", "@supabase/mcp-server"],
"env": {
"SUPABASE_URL": "https://your-project.supabase.co",
"SUPABASE_SERVICE_KEY": "eyJ..."
}
}
}
}
- Get your keys from Supabase Dashboard > Settings > API.
- Restart your AI client and start querying your database.
Example
-- Example queries the agent can execute via Supabase MCP:
-- 'Show me all users who signed up this week'
SELECT id, email, created_at
FROM auth.users
WHERE created_at >= NOW() - INTERVAL '7 days'
ORDER BY created_at DESC;
-- 'Count active projects by status'
SELECT status, COUNT(*) as total
FROM projects
WHERE deleted_at IS NULL
GROUP BY status;
Related on TokRepo
- MCP Supabase Integration -- Supabase MCP deep dive
- Database Tools -- Database management and query tools
Common pitfalls
- The SUPABASE_SERVICE_KEY has admin-level access. Never expose it in client-side code or public repositories.
- MCP tool calls execute real queries against your database. Use a development project for testing before connecting production.
- Row-level security (RLS) policies are bypassed when using the service key. Ensure your agent queries do not expose sensitive data.
Frequently Asked Questions
The Supabase MCP server provides access to PostgreSQL queries (select, insert, update, delete), authentication user management, file storage operations, and edge function invocation.
Yes. The @supabase/mcp-server package is published by Supabase and maintained as part of their official tooling for AI agent integrations.
Yes. The agent can execute arbitrary SQL queries against your Supabase PostgreSQL database. This includes SELECT, INSERT, UPDATE, DELETE, and DDL operations depending on the service key permissions.
The MCP protocol is request-response based. Real-time subscriptions (Supabase Realtime) are not supported through MCP. Use the Supabase client SDK directly for real-time features.
Use environment variables for the service key, never commit it to version control. Consider using a read-only database role for the service key if write access is not needed.
Citations (3)
- Supabase MCP GitHub— Supabase MCP server for AI agent database access
- Supabase Documentation— Supabase platform documentation
- MCP Specification— Model Context Protocol specification
Related on TokRepo
Source & Thanks
Discussion
Related Assets
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.
Postgres MCP Pro — Index Tuning + Safe SQL Tools
Postgres MCP Pro is an MCP server for PostgreSQL that runs safe SQL, explains plans, and recommends indexes so agents can tune databases faster.
Supabase MCP Server — Postgres + Admin Tools (API Key Gate)
Supabase MCP Server connects MCP clients to Supabase Postgres and admin APIs, using env-based config and an API key gate to reduce unsafe default exposure.
Apify MCP Server — 8,000+ Web Scrapers for Agents
Apify MCP Server connects agents to Apify Actors via a hosted endpoint (mcp.apify.com) or local run, turning thousands of web scrapers into callable tools.