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.

已验证STDIO仅桌面数据库开发者工具

概览

AI 生成的概览

面向 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 或密码文件,并能访问数据库网络。建议使用只读数据库用户。
安装前请注意
需要数据库凭据(POSTGRES_PASSWORD);建议使用只读用户,使数据库权限与防护措施相互印证。只读模式、行数上限和超时均为默认值,安装前应确认配置中未放宽。凭据只在启动时接受,不能通过工具调用传入。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Database Mcp Postgres,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

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_objects progressively 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:

json
{  "mcpServers": {    "sqlite": {      "command": "npx",      "args": ["-y", "@database-mcp/sqlite", "--dsn", "/absolute/path/to/database.db"]    }  }}

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

MIT

来源:README.md,提交 775af94

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v0.5.0最新Oct 17, 2026
  2. v0.4.2Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分