Supabase
MCP server for interacting with the Supabase platform
作者提供的说明(英文原文)
Safe SQL gateway for AI agents: SELECT-only validation, access policies, masking, audit trail, evals
这三项永远不会合并成一个分数:意见、测量和人气是不同的东西。
我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。
选择你使用的 AI 应用,然后复制设置。
QUERYPILOT_DATABASE_URL, QUERYPILOT_DIALECT, QUERYPILOT_MAX_ROWS, QUERYPILOT_TIMEOUT_SECONDS, QUERYPILOT_ACCESS_POLICY_JSON, QUERYPILOT_MCP_TRANSPORT标为机密的值是你账户的钥匙。千万不要分享给别人,也不要粘贴到聊天里。
你需要
你用的是哪个应用?
在上方选择你的应用。我们会记住它,下次按钮会显示“安装到 …”。
打开 Claude Desktop → Settings → Developer → Edit Config,把下面的内容粘贴到 claude_desktop_config.json
{
"mcpServers": {
"querypilot": {
"command": "uvx",
"args": [
"querypilot",
"mcp"
],
"env": {
"QUERYPILOT_DATABASE_URL": "your-value",
"QUERYPILOT_DIALECT": "your-value",
"QUERYPILOT_MAX_ROWS": "your-value",
"QUERYPILOT_TIMEOUT_SECONDS": "your-value",
"QUERYPILOT_ACCESS_POLICY_JSON": "your-value",
"QUERYPILOT_MCP_TRANSPORT": "your-value"
}
}
}
}在终端中运行这条命令
claude mcp add querypilot --env QUERYPILOT_DATABASE_URL=your-value --env QUERYPILOT_DIALECT=your-value --env QUERYPILOT_MAX_ROWS=your-value --env QUERYPILOT_TIMEOUT_SECONDS=your-value --env QUERYPILOT_ACCESS_POLICY_JSON=your-value --env QUERYPILOT_MCP_TRANSPORT=your-value -- uvx querypilot mcp运行前请先填写空着的值。
粘贴到项目中的 .cursor/mcp.json,或 ~/.cursor/mcp.json
{
"mcpServers": {
"querypilot": {
"command": "uvx",
"args": [
"querypilot",
"mcp"
],
"env": {
"QUERYPILOT_DATABASE_URL": "your-value",
"QUERYPILOT_DIALECT": "your-value",
"QUERYPILOT_MAX_ROWS": "your-value",
"QUERYPILOT_TIMEOUT_SECONDS": "your-value",
"QUERYPILOT_ACCESS_POLICY_JSON": "your-value",
"QUERYPILOT_MCP_TRANSPORT": "your-value"
}
}
}
}浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。
粘贴到项目中的 .vscode/mcp.json
{
"servers": {
"querypilot": {
"type": "stdio",
"command": "uvx",
"args": [
"querypilot",
"mcp"
],
"env": {
"QUERYPILOT_DATABASE_URL": "your-value",
"QUERYPILOT_DIALECT": "your-value",
"QUERYPILOT_MAX_ROWS": "your-value",
"QUERYPILOT_TIMEOUT_SECONDS": "your-value",
"QUERYPILOT_ACCESS_POLICY_JSON": "your-value",
"QUERYPILOT_MCP_TRANSPORT": "your-value"
}
}
}
}浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。
这个服务器在你的电脑上运行,而 ChatGPT 只能连接互联网上的服务器。请选择其他应用。
你的选择通过 Cookie 保存在这台设备上,无需账户。
QUERYPILOT_DIALECT envQUERYPILOT_MAX_ROWS envQUERYPILOT_TIMEOUT_SECONDS envQUERYPILOT_ACCESS_POLICY_JSON envQUERYPILOT_MCP_TRANSPORT env这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月7日
注册名称已通过 GitHub 账户 nickklos10 验证,该账户拥有此仓库
我们还没有从 GitHub 读取这个仓库
我们还没有从 GitHub 读取这个仓库
它在你的电脑上运行,没有互联网端点
在你的电脑上运行,改用本地设置
它在你的电脑上运行;我们只能读取互联网端点的工具列表
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
它在 1 项适用的基础检查中通过了 1 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
你需要填写:QUERYPILOT_DATABASE_URL
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
GitHub 仓库最后更新于–,最新版本(0.1.1)于4个月前进入注册中心。
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Python (uv)。
同一分类中有:Supabase, MongoDB MCP Server, Elasticsearch MCP Server
同一分类中其他作者的服务器,按星标数排序。
如何看卡片:★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
MCP server for interacting with the Supabase platform
MongoDB Model Context Protocol Server
MCP server for interacting with Elasticsearch
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
Safe, measurable SQL for AI agents.
QueryPilot sits between an LLM agent and your database. It gives the agent read-only, policy-checked SQL tools for any SQLAlchemy database. It grounds the model in your real schema, feeds errors back so the model can fix its SQL, and ships an eval harness that proves the SQL is correct and stays correct.
pip install querypilot
querypilot demo
querypilot demo writes a small SaaS database (querypilot-demo.db), runs a validated query against it and shows a blocked DELETE. Then try:
querypilot schema --db sqlite:///querypilot-demo.db # list tables
querypilot schema --db sqlite:///querypilot-demo.db invoices # columns, keys, sample values querypilot sql --db sqlite:///querypilot-demo.db "SELECT customer_nme FROM customers"
querypilot ask --db sqlite:///querypilot-demo.db "Which customers have the highest ARR?"
ask uses OpenAI or Anthropic when OPENAI_API_KEY or ANTHROPIC_API_KEY is set (--generator openai-compatible covers Ollama, vLLM and LM Studio). Without a key it falls back to an offline demo generator.
For your own database, querypilot init --db postgresql://analyst@db.internal/prod writes a querypilot.yaml that holds the connection, business hints, column descriptions and access policy. Every command, the MCP server and QueryPilot.from_config() read it, so you can drop --db from then on.
In Python:
from querypilot import QueryPilot
qp = QueryPilot.connect("postgresql://analyst@db.internal/prod") # dialect inferred from the URL
result = qp.execute_sql("SELECT plan, COUNT(*) FROM subscriptions GROUP BY plan") print(result.sql) # rewritten with a LIMIT, validated against the live schema print(result.rows)
QueryPilot.connect(url) infers the SQL dialect from the URL and introspects tables, views, primary and foreign keys, and comments. It also accepts a SQLAlchemy Engine.
| Database | URL | Install |
|---|---|---|
| SQLite | sqlite:///app.db | included |
| PostgreSQL | postgresql://user:pass@host/db | included |
| DuckDB | duckdb:///analytics.duckdb | pip install "querypilot[duckdb]" |
| MySQL / MariaDB | mysql+pymysql://user:pass@host/db | pip install "querypilot[mysql]" |
| SQL Server | mssql+pyodbc://… | pip install "querypilot[mssql]" |
| Snowflake | snowflake://user@account/db/schema | pip install "querypilot[snowflake]" |
| BigQuery | bigquery://project/dataset | pip install "querypilot[bigquery]" |
| Redshift | redshift+psycopg2://… | pip install "querypilot[redshift]" |
| Trino / Oracle / Databricks | trino://…, oracle+oracledb://…, databricks://… | querypilot[trino], [oracle], [databricks] |
Every query is validated with sqlglot for the target dialect. Validation means one statement, SELECT only, and known tables and columns. It also blocks dangerous functions for each engine, such as pg_read_file, DuckDB's read_csv, MySQL's LOAD_FILE and SQL Server's xp_cmdshell. Execution then adds the engine's own guard: a read-only transaction on Postgres, MySQL and Oracle, a read-only connection on DuckDB, and a statement timeout where the engine supports one. Every query runs in a transaction that is always rolled back. For warehouses that have no read-only session mode, connect with a read-only role.
Every integration exposes the same small toolset. Results are compact JSON, and errors come back as {"ok": false, "error": ..., "hints": [...]} rather than as exceptions, so the agent can correct itself.
| Tool | What it does |
|---|---|
list_tables | Tables and views the policy allows, with comments |
describe_table | Columns, types, keys, comments and sample values for the named tables |
search_schema | Finds tables and columns relevant to a question |
validate_sql | Checks SQL and returns the rewritten form, errors and "did you mean" hints |
run_sql | Validates and runs SQL, returning rows with a truncated flag at max_rows |
ask_database | Natural language → validated SQL → rows (only when an LLM generator is configured) |
MCP (Claude Code, Claude Desktop, Cursor, VS Code, Windsurf):
querypilot mcp-config claude-code --db postgresql://analyst@db/prod
querypilot mcp-config cursor --db sqlite:///app.db # prints the mcpServers JSON block
The generated config uses the absolute path to uvx, which avoids the common spawn uvx ENOENT failure. Pass --runner python to launch the current environment instead. Every tool carries the MCP readOnlyHint annotation. querypilot mcp --transport streamable-http --port 8000 serves the same tools over HTTP.
OpenAI / Anthropic tool calling:
tools = qp.as_openai_tools() # Chat Completions; qp.toolkit().openai_responses_tools() for Responses
tools = qp.as_anthropic_tools() result = qp.handle_tool_call(tool_call.name, tool_call.arguments) # dict or JSON string in, dict out
Agent frameworks:
from querypilot.integrations import (
as_langchain_tools, # LangChain / LangGraph StructuredTools as_llamaindex_tools, # LlamaIndex FunctionTools as_openai_agents_tools, # OpenAI Agents SDK FunctionTools as_claude_agent_mcp_server, # Claude Agent SDK in-process MCP server claude_agent_allowed_tools, as_functions, # plain typed functions: Pydantic AI, smolagents, CrewAI, ADK )
tools = as_langchain_tools(qp, naming="langchain") # sql_db_list_tables, sql_db_schema, sql_db_query, ...
naming="langchain" reuses the tool names from the community SQLDatabaseToolkit (no longer maintained), so existing prompts keep working. Install the matching extra: querypilot[langchain], [llamaindex], [openai-agents], [claude-agent] or [mcp]. See examples/07_frameworks.py.
querypilot proxy (prototype)The proxy needs no SDK. It is a Postgres wire-protocol server that applies the same validator and access policy to every statement, whatever the client. That covers psql, psycopg, SQLAlchemy and LangChain, an existing MCP database server, Cursor or Claude Code, and BI tools. Point the client's connection string at the proxy instead of the database:
pip install "querypilot[proxy]"
querypilot proxy --upstream postgresql://readonly@db/prod --listen 127.0.0.1:6543 --policy querypilot.yaml
psql "postgresql://agent@127.0.0.1:6543/prod" -c "SELECT email FROM customers" npx -y @modelcontextprotocol/server-postgres postgresql://agent@127.0.0.1:6543/prod # unchanged MCP server
Every statement then gets the following:
SET of anything outside a small allowlist are rejected. Allowed statements run in a READ ONLY transaction on a session that defaults to read-only, so COMMIT; DROP TABLE … is rejected.row_filters hold under joins, subqueries and CTEs, and LIMIT is capped at max_rows.masking_rules apply by output position, so upper(email) AS contact is masked too.HINT, for example Column 'nope' does not exist. Columns of orders: id, customer_id, ….--audit-log, with the client's SQL, the SQL that ran, the row count, and the client user and application.Driver handshakes, SET/SHOW of formatting settings, and catalog queries for psql \d and ORM reflection pass through an allowlist. Catalog queries that could read data, such as pg_stats or query_to_xml(...), are rejected. The policy file is a normal querypilot.yaml, and its database_url is used when you omit --upstream. Off loopback, set QUERYPILOT_PROXY_PASSWORD. Protocol coverage, known gaps (no TLS termination yet, no server-side cursors), and the reasons it fails closed are in docs/proxy.md.
querypilot trace and hooksSome query tools can't sit behind QueryPilot, for example Palantir Foundry's MCP SQL tool. For those, QueryPilot reads what the agent did instead. trace import pairs every query tool call in Claude Code transcripts with its result. hooks install logs new calls live. trace doctor reports the failure rate by class, retry chains, latency and stalls, and says for each problem whether it is best fixed in the tool, the prompt, or the data:
querypilot trace doctor # reads ~/.claude/projects
querypilot trace doctor --output report.md # redacted, shareable querypilot hooks install --guard --max-rows 200
With --guard, a PreToolUse hook validates each query against schemas cached from the agent's own schema calls. It denies unknown columns with a "did you mean" reply before the query reaches the warehouse, blocks date arithmetic on DATE columns stored as epoch milliseconds, and enforces a row cap. Foundry's tool is mapped by default; map any other with --tool NAME=SQL_FIELD[:DIALECT]. Recovered retry chains export to eval replay as a regression suite. See docs/trace.md and the first Foundry report.
When QueryPilot writes the SQL itself (ask, ask_database, evals), it uses the techniques with the largest measured gains in the text-to-SQL literature. The sources and numbers are in docs/research/developer-needs.md.
hints= and descriptions= to connect(), or set them in querypilot.yaml, for definitions such as "revenue means paid invoices only".schema_token_budget (default 6000 tokens) the full schema is sent. Above it, QueryPilot sends the relevant tables plus the foreign-key bridge tables that join them.from querypilot import AnthropicSQLGenerator, QueryPilot
qp = QueryPilot.connect( "duckdb:///analytics.duckdb", generator=AnthropicSQLGenerator(), hints=["Revenue means SUM(amount_cents) / 100 over invoices with status = 'paid'"], descriptions={"accounts.segment": "smb, midmarket or enterprise"}, ) answer = qp.ask("Revenue by se
只显示了开头部分;其余内容请在仓库中阅读