
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,取得客戶、對話串與對話串詳細資料。