MCP ConfigsApr 6, 2026·2 min read

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.

TL;DR
Supabase MCP connects AI agents to Supabase PostgreSQL databases, auth, storage, and edge functions via MCP.
§01

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.

§02

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.

§03

How to use

  1. 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..."
      }
    }
  }
}
  1. Get your keys from Supabase Dashboard > Settings > API.
  1. Restart your AI client and start querying your database.
§04

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;
§05

Related on TokRepo

§06

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

What Supabase services does the MCP server expose?+

The Supabase MCP server provides access to PostgreSQL queries (select, insert, update, delete), authentication user management, file storage operations, and edge function invocation.

Is the Supabase MCP server official?+

Yes. The @supabase/mcp-server package is published by Supabase and maintained as part of their official tooling for AI agent integrations.

Can Supabase MCP run SQL queries?+

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.

Does Supabase MCP support real-time subscriptions?+

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.

How do I secure my Supabase MCP connection?+

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)
🙏

Source & Thanks

Created by Supabase. Licensed under Apache 2.0.

supabase — ⭐ 78,000+

Thanks to Supabase for making backend-as-a-service AI-accessible.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.