MCP Server for PostgreSQL

Created By
JaviMaligno5 months ago
MCP server with 14 tools for PostgreSQL database operations. Query databases, explore schemas, analyze tables, list indexes/constraints, and get performance statistics. Features security-first design with SQL injection prevention and read-only mode by default. Works with Claude Desktop, Claude Code, and any MCP-compatible client.
Overview

What is PostgreSQL MCP?

PostgreSQL MCP is a server designed for PostgreSQL database operations, providing a suite of 14 tools for querying databases, exploring schemas, analyzing tables, and obtaining performance statistics. It emphasizes security with features like SQL injection prevention and a read-only mode by default.

How to use PostgreSQL MCP?

To use PostgreSQL MCP, install it via pipx or pip, configure it with your PostgreSQL credentials, and then interact with it through compatible clients like Claude Code or Claude Desktop.

Key features of PostgreSQL MCP?

  • Query Execution: Execute SQL queries with read-only protection.
  • Schema Exploration: List schemas, tables, views, and functions.
  • Table Analysis: Describe structure, indexes, constraints, and statistics.
  • Performance Tools: Analyze query performance and table health.
  • Security First: SQL injection prevention and credential protection.
  • Guided Workflows: MCP prompts for exploration and query building.

Use cases of PostgreSQL MCP?

  1. Executing read-only SQL queries against a PostgreSQL database.
  2. Exploring database schemas and structures.
  3. Analyzing table performance and generating documentation.

FAQ from PostgreSQL MCP?

  • Can PostgreSQL MCP handle write operations?

Yes, write operations can be enabled, but are blocked by default for security.

  • Is PostgreSQL MCP free to use?

Yes, PostgreSQL MCP is open-source and free to use.

  • How does PostgreSQL MCP ensure security?

It implements multiple security layers including SQL injection prevention and read-only mode by default.

Server Config

{
  "mcpServers": {
    "postgres": {
      "command": "postgresql-mcp",
      "env": {
        "POSTGRES_HOST": "localhost",
        "POSTGRES_PORT": "5432",
        "POSTGRES_USER": "your-user",
        "POSTGRES_PASSWORD": "your-password",
        "POSTGRES_DB": "your-database"
      }
    }
  }
}
Project Info
Created At
5 months ago
Updated At
5 months ago
Author Name
JaviMaligno
Star
-
Language
-
License
-

Recommend Servers

View All
Alloy

2 days ago