call518/MCP-PostgreSQL-Ops
让 AI 用自然语言只读诊断 PostgreSQL
解决什么问题
没有它,AI 助手无法直接查看 PostgreSQL 的慢查询、锁、膨胀等诊断证据。
- 只读工具,禁止任意 SQL
- 诊断慢查询、锁与膨胀
- 无需扩展,兼容 PG 12–18
适用客户端
- claude-desktop
- cli
安装命令
docker compose up -d docker compose ps --all # wait for mcp-server to be healthy and init to exit 0 docker compose -f docker-compose.custom-db.yml up -d uvx --python 3.12 mcp-postgresql-ops --type stdio 一键配置
{
"mcpServers": {
"mcp-postgresql-ops": {
"command": "uv",
"args": [
"run",
"python",
"-m",
"mcp_postgresql_ops"
],
"env": {
"POSTGRES_HOST": "127.0.0.1",
"POSTGRES_PORT": "15432",
"POSTGRES_USER": "postgres",
"POSTGRES_PASSWORD": "changeme",
"POSTGRES_DB": "ecommerce"
}
}
}
} {
"mcpServers": {
"Postgresql-A": {
"command": "uvx",
"args": [
"--python",
"3.12",
"mcp-postgresql-ops"
],
"env": {
"POSTGRES_HOST": "a.foo.com",
"POSTGRES_PORT": "5432",
"POSTGRES_USER": "postgres",
"POSTGRES_PASSWORD": "postgres",
"POSTGRES_DB": "postgres"
}
},
"Postgresql-B": {
"command": "uvx",
"args": [
"--python",
"3.12",
"mcp-postgresql-ops"
],
"env": {
"POSTGRES_HOST": "b.bar.com",
"POSTGRES_PORT": "5432",
"POSTGRES_USER": "postgres",
"POSTGRES_PASSWORD": "postgres",
"POSTGRES_DB": "postgres"
}
}
}
} {
"mcpServers": {
"mcp-postgresql-ops": {
"type": "streamable-http",
"url": "http://your-server:8000/mcp",
"headers": {
"Authorization": "Bearer replace-with-a-strong-random-secret"
}
}
}
} 安全标记
- 需要 API Key: 未标注
- 本地运行: 是
- 访问网络: 是
- 需要 root: 否
维护状态
| 最近提交 | 2026-12-05(0d) |
|---|---|
| Star | 165 |
| 待处理 issue | 0 |
| 协议 | MIT |
| 已归档 | 否 |
| 数据抓取于 | 2026-12-05 |
原文摘录
以下为仓库 README 原文,未做改写,用于核对上面的摘要。
MCP-PostgreSQL-Ops lets Claude, OpenWebUI, and other MCP clients inspect a PostgreSQL server through natural-language questions.