JP

jamesjohnsdev/postgresql-mcp-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

24 stars 44 forks 质量 63 趋势 10AGPL-3.0

jamesjohnsdev/postgresql-mcp-server 是从 https://github.com/jamesjohnsdev/postgresql-mcp-server. 导入的 MCP 服务器候选

概览

jamesjohnsdev/postgresql-mcp-server 是从 https://github.com/jamesjohnsdev/postgresql-mcp-server. 导入的 MCP 服务器候选

概述(AI 翻译)

一台模型上下文协议(MCP)服务器,提供PostgreSQL数据库管理功能。该服务器协助分析现有PostgreSQL设置,提供实现指导,并调试数据库问题。

特色

1.数据库分析(analyze_database)

分析PostgreSQL数据库配置和性能指标:

  • 配置分析
  • 性能指标
  • 安全评估
  • 优化建议

2.设置说明(get_setup_instructions)

提供 PostgreSQL 安装和配置的逐步指导:

  • 平台专用安装步骤
  • 配置建议
  • 安全最佳实践
  • 安装后任务

3.数据库调试(debug_database)

调试常见的PostgreSQL问题:

  • 连接问题
  • 性能瓶颈
  • 锁冲突
  • 复制状态

先修条件

  • Node.js >= 18.0.0
  • PostgreSQL 服务器(用于目标数据库操作)
  • 目标PostgreSQL实例的网络访问

安装

通过Smithery安装

通过 Smithery 自动安装 PostgreSQL MCP Server for Claude Desktop:

手动安装

  1. 克隆仓库

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

PostgreSQL MCP Server

A Model Context Protocol (MCP) server that provides PostgreSQL database management capabilities. This server assists with analyzing existing PostgreSQL setups, providing implementation guidance, and debugging database issues.

Features

1. Database Analysis (analyze_database)

Analyzes PostgreSQL database configuration and performance metrics:

  • Configuration analysis
  • Performance metrics
  • Security assessment
  • Recommendations for optimization
// Example usage
{
  "connectionString": "postgresql://user:password@localhost:5432/dbname",
  "analysisType": "performance" // Optional: "configuration" | "performance" | "security"
}

2. Setup Instructions (get_setup_instructions)

Provides step-by-step PostgreSQL installation and configuration guidance:

  • Platform-specific installation steps
  • Configuration recommendations
  • Security best practices
  • Post-installation tasks
// Example usage
{
  "platform": "linux", // Required: "linux" | "macos" | "windows"
  "version": "15", // Optional: PostgreSQL version
  "useCase": "production" // Optional: "development" | "production"
}

3. Database Debugging (debug_database)

Debug common PostgreSQL issues:

  • Connection problems
  • Performance bottlenecks
  • Lock conflicts
  • Replication status
// Example usage
{
  "connectionString": "postgresql://user:password@localhost:5432/dbname",
  "issue": "performance", // Required: "connection" | "performance" | "locks" | "replication"
  "logLevel": "debug" // Optional: "info" | "debug" | "trace"
}

Prerequisites

  • Node.js >= 18.0.0
  • PostgreSQL server (for target database operations)
  • Network access to target PostgreSQL instances

Installation

Installing via Smithery

To install PostgreSQL MCP Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @nahmanmate/postgresql-mcp-server --client claude

Manual Installation

  1. Clone the repository
  2. Install dependencies:
    npm install
    
  3. Build the server:
    npm run build
    
  4. Add to MCP settings file:
    {
      "mcpServers": {
        "postgresql-mcp": {
          "command": "node",
          "args": ["/path/to/postgresql-mcp-server/build/index.js"],
          "disabled": false,
          "alwaysAllow": []
        }
      }
    }
    

Development

  • npm run dev - Start development server with hot reload
  • npm run lint - Run ESLint
  • npm test - Run tests

Security Considerations

  1. Connection Security
    • Uses connection pooling
在 GitHub 查看完整 README

安装

npx -y @smithery/cli install @nahmanmate/postgresql-mcp-server --client claude
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "postgresql-mcp": { "command": "node", "args": ["/path/to/postgresql-mcp-server/build/index.js"], "disabled": false, "alwaysAllow": [] } } }