MCP PostgreSQL 查询服务器
一个为 Claude Desktop 和其他 MCP 客户端设计的只读 PostgreSQL 数据库查询服务器。
快速入门
前置条件
- 安装 Node.js (v14 或更高版本) 和 npm。
- 准备 PostgreSQL 数据库连接信息。
安装步骤
- 克隆仓库: git clone https://github.com/RathodDarshil/mcp-postgres-query-server.git cd mcp-postgres-query-server
- 安装依赖: npm install
- 构建项目: npm run build
配置 Claude Desktop
- 打开配置文件(Settings > Developer > Edit Config)。
- 添加以下内容到
mcpServers
部分: { "mcpServers": { "postgres-query": { "command": "node", "args": ["/path/to/dist/index.js", "postgresql://username:password@hostname:port/database"] } } } - 替换实际路径和数据库连接信息,保存并重启应用。
功能特性
- 只读 SQL 查询
- 自动超时保护(10 秒)
- JSON 格式返回结果