
Pgmoat
io.github.Kitalon-Labs-LLC由 GitHub 账号 Kitalon-Labs-LLC 发布v0.1.2更新于 Nov 7, 2026
Governed, read-only Postgres access for AI agents: SQL safety, RLS, budgets, tamper-evident audit.
概览
一个让 AI 助手以受管控的只读方式访问 Postgres 数据库的 MCP 服务器,提供查询检查、隐藏列、预算限制和审计日志。
- 可以做什么
- 对 Postgres 数据库执行只读 SQL,并限制返回行数和查询超时
- 隐藏标记为隐藏的表和列,并标记敏感数据
- 将行级安全绑定到调用者身份,并写入防篡改审计日志
- 生成并校验配置文件、检查数据库角色是否存在不安全权限、验证审计哈希链,以及把可见表结构导出为 Markdown
- 适用场景
- 当助手需要基于生产或共享的 Postgres 数据库回答问题、且不应有任何写入路径,并希望获得限额、隐藏字段和审计记录而不是直接拿到数据库凭据时使用。
- 运行要求
- 需要 Node.js 22.12 或更高版本以及 Postgres 15 至 18,通过 stdio 在本地运行(npm 包或 Docker 镜像)。Postgres 连接 URL 通过 PGMOAT_DATABASE_URL 环境变量或命令行参数提供,建议使用专用只读角色。可选的 pgmoat.yaml 用于配置 schema、预算、描述和隐藏列。
安装
在 SourceWeft 中
- 打开 控制台中的 Pgmoat,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
pgmoat
[CI] [npm version] [License: MIT]
Governed Postgres access for AI agents.
pgmoat is an open-source MCP server that gives AI agents read-only access to Postgres. It checks every query with the real Postgres parser, hides the tables and columns you mark hidden, applies row limits and timeouts, binds Row-Level Security to the caller's identity, and writes a tamper-evident audit log.
Requires Node.js 22.12 or newer and Postgres 15 to 18.
Quickstart
Run it against your database with safe defaults, no config file needed:
Add it to Claude Code:
Or to Claude Desktop (claude_desktop_config.json):
Passing the URL through --url-env keeps the password out of process listings.
Use a dedicated read-only role. pgmoat checks the role at startup. With a pgmoat.yaml, it refuses to start if the role is a superuser (PGM-701), has BYPASSRLS while row-level security is configured (PGM-702), or owns a protected table without FORCE ROW LEVEL SECURITY (PGM-703), unless you pass --allow-unsafe-role; every audit entry then records the override. In zero-config mode (a URL and no config file) it warns and continues.
Add descriptions and hide sensitive data
A pgmoat.yaml looks like this:
Commands
Run pgmoat --help for all options.
What pgmoat does not do
- It does not stop prompt injection. It removes the write path, hides what you mark hidden, and labels returned data as untrusted, but an agent with other tools (web access, email) can still be tricked into sending readable data elsewhere.
- It does not replace Postgres permissions. The strongest control is a dedicated role with only the grants it needs.
- It does not make RLS policies correct. It sets the session variables your policies read. A flawed policy stays flawed.
- It does not guarantee audit delivery to a remote destination during an outage. It buffers, alarms, and records drops.
Docker
Contributing
See CONTRIBUTING.md. Report vulnerabilities privately as described in SECURITY.md.
Links
- Docs: https://kitalonlabs.com/pgmoat/docs
- Source and issues: https://github.com/Kitalon-Labs-LLC/pgmoat
- Security reports: [email protected]
License
MIT (c) 2026 Kitalon Labs
来源:README.md,提交 5d4fabd
工具
0版本历史
2- v0.1.2最新Nov 7, 2026
- v0.1.1Oct 25, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分