
Database Mcp Postgres
io.github.arifulislamat由 GitHub 帳號 arifulislamat 發布v0.5.0更新於 Oct 24, 2026
MCP server for PostgreSQL. Read-only by default, row caps, timeouts, secrets never logged.
概覽
針對 PostgreSQL 的 MCP 伺服器,讓 AI 助理以預設唯讀、附列數上限與逾時限制的方式執行 SQL 並檢視資料表結構。
- 可以做什麼
- 透過 execute_sql 對 PostgreSQL 資料庫執行 SQL 語句,預設啟用唯讀模式、列數上限與語句逾時。
- 透過 search_objects 探索結構:不帶參數時列出資料表,指定資料表名稱時回傳欄位、索引與外鍵。
- 連線資訊在啟動時透過命令列參數、YAML 設定檔或環境變數提供,不經由對話傳遞。
- 適用情境
- 適合讓助理檢視或查詢 PostgreSQL 資料庫,例如了解資料表結構、回答資料問題或草擬查詢,同時不希望給予寫入權限。對想要小而可預期工具面的分析師與開發者較為合適。
- 執行需求
- 以 stdio 本機程序執行,可透過 npm、PyPI(uvx)或 cargo 二進位檔安裝。需要 POSTGRES_HOST、POSTGRES_DATABASE、POSTGRES_USER,以及 POSTGRES_PASSWORD 或密碼檔案,並能連線至資料庫網路。建議使用唯讀資料庫使用者。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Database Mcp Postgres,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
database-mcp
[CI] [License: MIT] [npm] [PyPI] [crates.io] [Node >= 22]
MCP servers that give AI clients safe, structured access to SQL databases.
One installable package per database engine, in TypeScript (npm), Python
(PyPI), and Rust (crates.io). Every package exposes the same minimal
two-tool surface, execute_sql and search_objects, with guardrails on by
default: read-only mode, row caps, and statement timeouts.
Packages
All three lines are published and pass the same language-agnostic conformance suite against real databases in CI, so behavior is identical regardless of language. Every engine is also listed on the MCP Registry with all three install options: npm, PyPI, and cargo.
Rust crates are named database-mcp-rs-<engine> because the plain names are
taken on crates.io; the command each one installs is still
database-mcp-<engine>. Go is planned.
Design principles
- Two tools, no more. A tiny tool surface keeps the model's context window
clean.
search_objectsprogressively discloses schema: call it with no arguments to list tables, with a table name to get columns, indexes, and foreign keys. - Safe by default. Read-only mode is enforced in two layers: a conservative SQL guard, plus a session-level read-only setting in the database itself. Rows are capped (default 1000) and statements time out (default 30s).
- Configured at launch, never via chat. Connection details come from flags, a YAML config file, or environment variables. Credentials are never accepted through a tool call.
- Secrets never appear in logs. Passwords live in non-printable secret types, DSNs are sanitized before logging, and a redaction filter guards the log boundary.
Quick start
Pick your engine's package; each README has the full config surface. SQLite via npm:
Or via PyPI: use "command": "uvx" and
"args": ["database-mcp-sqlite", "--dsn", "/absolute/path/to/database.db"].
Or as a native binary, with no Node or Python runtime: run
cargo install database-mcp-rs-sqlite, then use
"command": "database-mcp-sqlite" with the same args minus the package
name.
Flags, environment variables, and YAML config are identical across all three lines.
Networked engines take credentials from the environment (MYSQL_*,
MARIADB_*, POSTGRES_*/DATABASE_URL, LIBSQL_URL/LIBSQL_AUTH_TOKEN),
*_FILE mounted secrets, or a YAML file via --config. Never from a chat
prompt.
Contributing
See CONTRIBUTING.md. The short version: the conformance
suite is the definition of done. A change is mergeable only when
conformance/run.mjs passes against every affected server.
License
來源:README.md,提交 775af94
工具
0版本歷史
2- v0.5.0最新Oct 17, 2026
- v0.4.2Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分