Get the FREE Ultimate OpenClaw Setup Guide →

postgresql

MCP server from nahmanmate/postgresql-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio nahmanmate-postgresql-mcp-server node /path/to/postgresql-mcp-server/build/index.js

How to use

This PostgreSQL MCP Server exposes three core capabilities: analyze_database, get_setup_instructions, and debug_database. You can feed it a PostgreSQL connection string to analyze performance, configuration, and security, receiving targeted recommendations for optimization. Use get_setup_instructions to obtain platform-specific installation and configuration steps for PostgreSQL, including security considerations and post-install tasks. If you encounter issues with connections, performance, locks, or replication, the debug_database tool helps diagnose common PostgreSQL problems with adjustable log verbosity. Typical workflows involve running analyze_database to assess a live database, following get_setup_instructions to provision or tune PostgreSQL, and using debug_database to troubleshoot any arising issues.

How to install

Prerequisites:

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

Installation via Smithery (automatic):

  1. Install the MCP server using Smithery:
npx -y @smithery/cli install @nahmanmate/postgresql-mcp-server --client claude

Manual installation:

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

Notes:

  • Replace /path/to/... with the actual path to the built index.js file.
  • Ensure your MCP runner has access to the Node.js process and the target PostgreSQL instances.

Additional notes

Tips and considerations:

  • Ensure secure connection strings when providing credentials (use SSL/TLS where possible).
  • When using analyze_database, specify a clear analysisType (configuration, performance, or security) to tailor the report.
  • For get_setup_instructions, select platform (linux/macos/windows) and optional version/useCase to customize the guidance.
  • In debug_database, you can adjust logLevel (info, debug, trace) to capture sufficient details for troubleshooting.
  • Review the security considerations in the README, including authentication methods and role-based access control.
  • If integrating with MCP settings, keep your index.js path up to date after builds and re-run MCP registration if needed.

Related MCP Servers

Sponsor this space

Reach thousands of developers