PostgreSQL MCP 服务器
一个提供 PostgreSQL 数据库管理功能的 MCP 服务器,支持分析、配置和调试。
快速入门
前置条件
- Node.js >= 18.0.0
- PostgreSQL 数据库连接
安装步骤
- 克隆仓库
- 安装依赖:运行
npm install
- 构建项目:运行
npm run build
- 配置 MCP 设置文件: 添加以下内容到设置文件中: { "mcpServers": { "postgresql-mcp": { "command": "node", "args": ["/path/to/postgresql-mcp-server/build/index.js"], "disabled": false, "alwaysAllow": [] } } }
开发命令
- 启动开发服务器:
npm run dev
- 运行代码检查:
npm run lint
- 执行测试:
npm test
功能示例
数据库分析
{ "connectionString": "postgresql://user:password@localhost:5432/dbname", "analysisType": "performance" }
获取安装指南
{ "platform": "linux", "version": "15", "useCase": "production" }
数据库调试
{ "connectionString": "postgresql://user:password@localhost:5432/dbname", "issue": "performance", "logLevel": "debug" }