
PlainQuery | MCP DB Agent
io.github.Jarvis-27由 GitHub 账号 Jarvis-27 发布v1.0.1更新于 Oct 24, 2026
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
发布方自己的服务:Plain Insurance
概览
托管型 MCP 服务器,让助手用自然语言向已连接的 PostgreSQL 数据库提问,并返回结构化 JSON 结果。
- 可以做什么
- 用自然语言向已连接的 PostgreSQL 数据库提问,获得结构化 JSON 答案。
- 服务器会读取并缓存表结构,由 LLM 生成 SQL,做安全校验后以只读方式带超时执行,出错时自动重试。
- 通过 REST API 管理账户:注册、验证邮箱、连接或更新数据库,以及创建、列出、轮换和删除 API 密钥。
- 生成可直接粘贴的 VS Code、Cursor 和通用 HTTP MCP 客户端配置。
- 查看用量、仪表盘和账单状态,并发起 Stripe 结账或客户门户会话。
- 适用场景
- 适合希望助手直接回答 PostgreSQL 数据问题、而不必自己写 SQL 的场景,例如统计数量、消费最高的客户或按月平均值等临时报表。也适合倾向使用托管服务而非自建查询工具的团队。
- 运行要求
- 通过 streamable HTTP 连接 plainquery.in 远程端点,托管方式无需本地安装。需要已验证邮箱的账户、已连接的 PostgreSQL 数据库,以及在 X-API-Key 请求头中发送的 API 密钥(视服务器认证模式也可用 OAuth 2.1 bearer token)。自托管需要 Python 3.12+、uv、Node.js 20+ 与 pnpm,以及 ANTHROPIC_API_KEY 或 GROQ_API_KEY 等 LLM 密钥。
安装
在 SourceWeft 中
- 打开 控制台中的 PlainQuery | MCP DB Agent,将其添加到工作区。
- 连接 X-API-Key 凭据。它们会被私密存储,绝不会在公开页面上展示。
- 为需要使用其工具的对话启用该服务。
Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。
交给智能体安装
把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。
阅读 https://sourceweft.com/mcp/io.github.Jarvis-27%2Fmcp-db-agent/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。其他 MCP 客户端
把它添加到你客户端的 mcpServers 配置中。
{
"mcpServers": {
"plainquery-db-agent": {
"type": "http",
"url": "https://plainquery.in/mcp/",
"headers": {
"X-API-Key": "<YOUR_API_KEY>"
}
}
}
}README
PlainQuery
Ask your database questions in plain English. PlainQuery connects PostgreSQL databases to Claude, Cursor, or VS Code — and answers with real, structured data instead of guesses.
[PlainQuery demo — querying a database in plain English from an MCP client]
What it does
You connect a database once. Then, from any MCP client, you ask questions like:
"How many orders did we ship in March?" "Which 5 customers spent the most last year?" "What's the average order value by month?"
PlainQuery introspects your schema, generates SQL with an LLM, validates it for safety, runs it, and returns structured JSON. If a query fails, it reads the error and retries automatically.
Why PlainQuery
- Natural language, real answers — no SQL required; results come from your actual data, not a hallucination.
- Read-only and safe by design — every query is checked before it runs: writes (
INSERT/UPDATE/DELETE/DDL) are blocked, dangerous functions and patterns are scanned out, and aLIMITis injected automatically. - Self-correcting — when a generated query errors, the agent feeds the error back to the LLM and retries (up to a configurable limit).
- Schema-aware — automatically introspects and caches your schema, so questions map to the right tables and columns.
- Works with any MCP client — Claude Desktop, Cursor, VS Code Copilot, or anything that speaks MCP.
- Secure multi-tenant hosting — database URLs and LLM keys are Fernet-encrypted at rest; user-supplied connection strings are SSRF-guarded; every request is tenant-scoped.
- Hosted or self-hosted — use the managed service, or run the whole stack yourself with Docker.
- Bring your own LLM — Anthropic Claude or Groq.
How it works
Architecture
Quick start
Option 1 — Use the hosted service (no install)
- Sign up at
https://plainquery.inand verify your email. - Connect your PostgreSQL database and create an API key.
- Add the server to your MCP client (see Connect your MCP client).
That's it — start asking questions.
Option 2 — Run it yourself
See Self-hosting & local development below.
Connect your MCP client
PlainQuery is published on the official MCP Registry as io.github.Jarvis-27/mcp-db-agent, so registry-aware clients can discover it directly.
To configure a client manually, point it at the MCP endpoint and pass your API key:
The backend can also generate ready-to-paste config for VS Code, Cursor, and generic HTTP clients — call POST /api/v1/account/setup-payloads (see Setup payloads). MCP clients can authenticate with an OAuth 2.1 bearer token or an API key, depending on MCP_AUTH_MODE.
Self-hosting & local development
Prerequisites
- Python 3.12+
uv- Node.js 20+ and
pnpmfor the frontend - At least one LLM API key (
ANTHROPIC_API_KEYorGROQ_API_KEY)
Backend
Edit .env with at least:
CREDENTIAL_ENCRYPTION_KEYSREGISTRATION_OPEN=true- one LLM provider key plus
LLM_PROVIDER
Run the backend:
The backend mounts:
- REST API at
http://localhost:8000/api - MCP endpoint at
http://localhost:8000/mcp
Frontend
Open http://localhost:3000, sign up, complete setup, link your OAuth identity via account settings, then connect an MCP client at http://localhost:8000/mcp. The client will complete the OAuth flow automatically, or you can use an API key in api_key_only / hybrid mode.
Runtime model
- Backend API: FastAPI/Starlette at
src.app:app - Frontend: Next.js app in
frontend/ - Auth: passwordless email verification and login links
- MCP auth: OAuth 2.1 bearer tokens (
oauth_only), API keys (api_key_only), or both (hybrid) — set viaMCP_AUTH_MODE - Setup payloads:
POST /api/v1/account/setup-payloads - Billing: Stripe Checkout, Customer Portal, and webhook-confirmed Free/Pro entitlements
The product model is single-account and user-scoped:
signup → verify email → connect database → link OAuth identity → use /mcp → upgrade with Stripe
Security
- User-supplied database URLs are validated against SSRF, path traversal, private IPs, and DNS rebinding before any connection attempt.
- Database URLs and LLM keys are Fernet-encrypted at rest, with support for key rotation.
- Generated SQL is validated before execution: single-statement guard, forbidden-function scan, dangerous-pattern scan, write/DDL block, table-existence check, and automatic
LIMITinjection. - Per-request context scoping prevents cross-tenant data leaks.
- Per-user rate limits and fallback-LLM quotas limit cost abuse.
Important environment variables
See .env.example for the current full set.
API surface
Auth
POST /api/v1/auth/signupGET /api/v1/auth/verify-emailPOST /api/v1/auth/request-login-linkGET /api/v1/auth/exchange-login-linkPOST /api/v1/auth/logout
Account (session-authenticated)
All account routes use session token auth (x-session-token: <session-token> or Authorization: Bearer <session-token>):
GET /api/v1/accountGET /api/v1/account/statusPUT /api/v1/account/databaseGET /api/v1/account/api-keysPOST /api/v1/account/api-keysDELETE /api/v1/account/api-keys/{id}POST /api/v1/account/api-keys/{id}/rotatePOST /api/v1/account/setup-payloadsGET /api/v1/account/dashboardGET /api/v1/account/usage/recent
Billing
GET /api/v1/account/billingPOST /api/v1/account/billing/checkout-sessionPOST /api/v1/account/billing/portal-sessionPOST /api/v1/billing/webhook
Stripe webhooks are the source of truth for plan transitions. Checkout or
subscription activation moves a user to plan_code=pro; canceled, unpaid, or
past-due states restrict paid entitlements without deleting database setup.
OAuth MCP account linking (session-authenticated)
GET /api/v1/account/mcp-oauth/statusPOST /api/v1/account/mcp-oauth/startGET /api/v1/account/mcp-oauth/callbackDELETE /api/v1/account/mcp-oauth/link
MCP
POST /mcp- Auth: OAuth 2.1 bearer token, API key, or both — controlled by
MCP_AUTH_MODE
Setup payloads
POST /api/v1/account/setup-payloads returns client configuration material for VS Code, Cursor, generic HTTP MCP clients, and the current ChatGPT placeholder.
The backend never stores raw API keys after creation. A raw key is only embedded in setup payloads when you explicitly send it in the request.
Tests
Deployment smoke test
After each hosted deploy, verify the public MCP OAuth discovery surface:
The smoke test checks the unauthenticated /mcp challenge, protected resource
metadata, ChatGPT/Claude well-known discovery routes, and issuer metadata. To
also verify authenticated MCP initialize, tools/list, and resources/list,
pass a linked user's access token with --access-token or
MCP_SMOKE_ACCESS_TOKEN.
Docker
Run the hosted HTTP stack:
The container image serves only the hosted HTTP runtime. The MCP endpoint remains http://localhost:8000/mcp.
License
MIT © 2026 PlainQuery
来源:README.md,提交 90db627
工具
0版本历史
1- v1.0.1最新Sep 16, 2026
评分
已满足适用检查项的 60%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通必需25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式必需10 分
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
其他 Plain 集成
Plain Insurance
insurance.plain官方发布者
为丹麦公司提供商业保险报价、有效保单以及待审核的未签署报价。AI 翻译
Plain-AyI
由 GitHub 账号 AyodejiOO 发布
Plain-AyI 的只读连接器,提供开源 AI 项目的大白话指南,让助手搜索、浏览并解释这些项目。

Plain Ballot
由 GitHub 账号 n8peace 发布
按地址查看美国选民的选票,每位候选人的立场都附有确切引文和来源。AI 翻译
PlainHub
由 GitHub 账号 ricrio-inc 发布
在 PlainHub 浏览器编辑器中打开 GitHub 文件、差异和仓库,并在仓库里维护由代理消息与决策卡组成的 Markdown 共享账本。

Plain Mcp
由 GitHub 账号 mrfentmen 发布
让助手查询 Plain GraphQL API,获取客户、会话和会话详情。