这是一个提供 PostgreSQL 数据库管理能力的模型上下文协议(MCP)服务器。此服务器有助于分析现有的 PostgreSQL 设置,提供实施指导,并调试数据库问题。
<a href="https://glama.ai/mcp/servers/bnw58zblt1"><img width="380" height="200" src="https://gips1.baidu.com/it/u=1827175268,720922555&fm=3081&app=3081&f=PNG?w=760&h=400" alt="PostgreSQL Server MCP 服务器" /></a>
analyze_database)分析 PostgreSQL 数据库配置和性能指标:
// 示例用法
{
"connectionString": "postgresql://user:password@localhost:5432/dbname",
"analysisType": "performance" // 可选: "configuration" | "performance" | "security"
}
get_setup_instructions)提供逐步的 PostgreSQL 安装和配置指导:
// 示例用法
{
"platform": "linux", // 必需: "linux" | "macos" | "windows"
"version": "15", // 可选: PostgreSQL 版本
"useCase": "production" // 可选: "development" | "production"
}
debug_database)调试常见的 PostgreSQL 问题:
// 示例用法
{
"connectionString": "postgresql://user:password@localhost:5432/dbname",
"issue": "performance", // 必需: "connection" | "performance" | "locks" | "replication"
"logLevel": "debug" // 可选: "info" | "debug" | "trace"
}
要通过 Smithery 自动安装 PostgreSQL MCP 服务器到 Claude Desktop:
npx -y @smithery/cli install @nahmanmate/postgresql-mcp-server --client claude
npm install
npm run build
{
"mcpServers": {
"postgresql-mcp": {
"command": "node",
"args": ["/path/to/postgresql-mcp-server/build/index.js"],
"disabled": false,
"alwaysAllow": []
}
}
}
npm run dev - 启动具有热重载的开发服务器npm run lint - 运行 ESLintnpm test - 运行测试连接安全
查询安全性
身份验证
服务器实现了全面的错误处理:
评估包加载一个 mcp 客户端,然后运行 index.ts 文件,因此在测试之间不需要重新构建。您可以在此处查看完整的文档 这里。
OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/index.ts
本项目根据 AGPLv3 许可证发布 - 查看 LICENSE 文件获取详情。