supabase-mcp
A secure remote MCP server for self-hosted Supabase installations, enabling database schema management, SQL queries, and interaction with local Supabase services like Auth, Storage, and Edge Functions.
README
Supabase MCP
A secure remote Model Context Protocol server for the complete API surface of one self-hosted Supabase installation.
This project deliberately has no Supabase Cloud or Management API integration. It does not know about organizations, hosted projects, billing, branches, regions, or access tokens for api.supabase.com.
The production shape is a single Bun/TypeScript binary behind Caddy:
MCP client
│ HTTPS + OAuth 2.1 / scoped API key
▼
Caddy ── /mcp ──► supabase-mcp :4070
│
┌──────────────┼───────────────┐
▼ ▼ ▼
PostgreSQL local services control DB
+ pg-meta Auth/Storage/ OAuth, keys,
Realtime/Edge/ confirmations,
PostgREST/Logs audit
What is covered
- PostgreSQL schema discovery, policies, functions, extensions, advisors, migrations, parameterized read queries, and confirmed administrative SQL.
- The complete local PostgREST, GoTrue/Auth, Storage, pg-meta, Realtime HTTP, Edge Functions, and Logflare APIs through service-specific, fixed-origin request tools.
- Agent-friendly helpers for Auth users, Storage buckets/objects, Edge Function source/deployment, and live Realtime subscriptions.
- Streamable HTTP MCP with sessions, SSE, tools, resources, prompts, protocol-version checks, Origin checks, credential-bound sessions, TTL, and capacity limits.
- OAuth 2.1 Authorization Code with PKCE, Dynamic Client Registration, Protected Resource Metadata, refresh-token rotation, and optional login through the installation's own GoTrue OIDC provider.
- Scoped operator API keys, scope-filtered tool discovery, encrypted human confirmation for destructive operations, and durable audit records.
- OpenAPI 3.1, operator documentation,
llms.txt,llms-full.txt, CI, tests, and cross-compiled self-contained binaries.
The complete list of MCP tools is generated in docs/tools.md.
Quick start
Requirements: Bun 1.3+, PostgreSQL, and a self-hosted Supabase deployment.
bun install --frozen-lockfile
cp .env.example .env
# Fill every CHANGE_ME and point the service URLs at local/loopback services.
bun run dev
Check:
curl http://127.0.0.1:4070/health
curl http://127.0.0.1:4070/ready
curl http://127.0.0.1:4070/openapi.json
Configure an MCP client:
{
"mcpServers": {
"supabase": {
"type": "http",
"url": "https://supabase.example.com/mcp"
}
}
}
Standards-aware clients discover OAuth from the WWW-Authenticate challenge. For automation,
send an operator-created smcp_… key as either Authorization: Bearer … or X-API-Key: ….
OAuth access tokens are accepted only as Bearer tokens.
Security model
There are two PostgreSQL connections:
DATABASE_URLstores only MCP control-plane state (smcp_*tables).SUPABASE_TARGET_DATABASE_URLreaches the Supabase database for privileged operations.SUPABASE_TARGET_READONLY_DATABASE_URLshould use a read-only database role.
API keys and OAuth tokens are HMAC-hashed at rest. OAuth grants created through an API key remain
live-bound to that key: expiry or revocation invalidates their access and refresh tokens. Pending
destructive payloads are encrypted with AES-256-GCM. Tools are absent from tools/list unless the
credential has their scope. Service request tools select only an operator-configured base URL and
cannot become arbitrary network proxies. Supabase service-role and Logflare keys are never returned.
Destructive calls use a two-step flow:
- The tool returns
human_confirmation_required, aconfirmation_id, and an expiring review URL. - A human approves the exact encrypted operation in the browser.
- The client retries the same tool and arguments with
confirmation_id.
Changing any argument invalidates the approval. Approval does not execute anything by itself.
Read docs/security.md before exposing the service to a network.
Scopes
| Scope | Capability |
|---|---|
supabase:metadata:read |
Schemas, tables, policies, functions, extensions, migrations, advisors |
supabase:data:read / supabase:data:write |
SQL reads and PostgREST data operations |
supabase:database:write |
Administrative SQL and pg-meta mutations |
supabase:auth:read / supabase:auth:write |
Local GoTrue APIs |
supabase:storage:read / supabase:storage:write |
Local Storage APIs |
supabase:functions:read / supabase:functions:write |
Edge Function invocation and lifecycle |
supabase:realtime:read / supabase:realtime:write |
Realtime subscriptions, messages, and HTTP API |
supabase:logs:read |
Local Logflare query API |
supabase:config:read |
Non-secret endpoint and capability information |
supabase:secrets:read |
Reserved for explicit secret-reading extensions; no secret is exposed by default |
supabase:config:write |
Reserved; host configuration remains GitOps-managed |
supabase:admin |
Administrative ceiling; normalized to every supported scope |
Build
bun run gate
bun run build:binary
SUPABASE_MCP_BUN_TARGET=bun-linux-x64 OUTFILE=dist/supabase-mcp-linux-x64 ./build-binary.sh
./dist/supabase-mcp --version
bun build --compile embeds the runtime and dependencies. The service needs only the binary, environment file, and access to PostgreSQL/local Supabase endpoints.
HTTP endpoints
GET /health,GET /ready,GET /versionGET|POST|DELETE /mcp- OAuth metadata under
/.well-known/*; endpoints under/mcp/oauth/* GET /docs,GET /openapi.json,GET /llms.txt,GET /llms-full.txt- scoped operator API under
/api/v1/* - expiring human reviews under
/mcp/confirm/:id
See docs/operators.md, docs/architecture.md, and the generated OpenAPI document.
Development
bun run format
bun run gate
Unit and contract tests do not require Supabase. Integration and E2E tests are separated because they require local services. Contributions must preserve the fixed-origin upstream boundary and must not add Supabase Cloud APIs.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。