a2a mcp
☰
Back to MCP Servers
postgresql mcp logo
mcp-server536

postgresql mcp

Postgres MCP Pro is a powerful Model Context Protocol (MCP) server for PostgreSQL, providing configurable read/write access, advanced performance analysis, index tuning, explain plans, and safe SQL execution for AI agents.

Overview

PostgreSQL MCP (commonly referred to as Postgres MCP Pro) is an open-source Model Context Protocol (MCP) server designed to give AI agents secure and intelligent access to PostgreSQL databases.

It goes far beyond basic query execution by offering configurable read-only or read/write modes, comprehensive performance diagnostics, automated index recommendations, and production-grade safety features. Built to support the full development lifecycle — from schema exploration and coding to testing, deployment, and ongoing maintenance.

Popular implementations include the original Anthropic reference (now deprecated/archived due to security considerations), community forks, and enhanced versions like Postgres MCP Pro by Crystal DBA.

Features

  • Configurable Access Modes: Strict read-only transactions (prevents modifications) or controlled read/write with transaction safety.
  • Schema & Data Exploration: List tables, inspect schemas, columns, indexes, constraints, and run natural language-powered queries.
  • Performance Analysis: Health checks for buffer cache, vacuum status, replication lag, connection utilization, sequence limits, and more.
  • Index Tuning & Explain Plans: Advanced index recommendation engine that tests thousands of combinations; support for hypothetical indexes and detailed query explain plans.
  • Safe SQL Execution: Read-only wrappers, query validation, and safeguards against dangerous operations.
  • AI-Agent Optimized: Tools designed for low token usage, clear output formatting, and seamless integration with Claude, Cursor, Gemini, and other MCP clients.
  • Docker & Easy Deployment: Official Docker image for consistent, dependency-free runs.
  • Extensible: Supports community Postgres, RDS, Aurora, and most PostgreSQL v12+ instances.

Use Cases

  • AI-Assisted Database Development: Let your AI agent explore schemas, suggest optimal queries, or generate migrations in natural language.
  • Performance Tuning: Ask "Analyze slow queries" or "Recommend indexes for this table" — receive actionable insights with explain plans.
  • Production Monitoring: Run health checks, detect bloat, or monitor vacuum/autovacuum without manual SQL.
  • Safe Data Analysis: Grant read-only access for reporting, analytics, or customer support agents without risking data integrity.
  • Full Development Workflow: From initial project setup and testing to deployment and ongoing optimization — all driven by conversational AI.

Installation & Quick Start

Pull and run the official image:

docker run -p 8080:8080 crystaldba/postgres-mcp --connection-string "postgresql://user:pass@localhost:5432/mydb"

Python / uv Installation

uv pip install postgres-mcp
uv run postgres-mcp "postgresql://user:password@localhost:5432/dbname"

Configuration for Clients (Claude Desktop, Cursor, etc.)

Add to your MCP config (e.g., ~/.cursor/mcp.json or Claude settings) with the appropriate command/args pointing to the running server.

Full documentation, connection examples, and security best practices are available in the repository.

Security Notes

  • Prefer read-only mode for untrusted agents.
  • The original Anthropic reference implementation had a known SQL injection vulnerability (patched in forks and later versions).
  • Always use connection strings with least-privilege users and consider network-level restrictions.
  • GitHub (Postgres MCP Pro): crystaldba/postgres-mcp
  • Other notable implementations: pgEdge Postgres MCP, AWS Labs Aurora MCP, various community forks.
  • Model Context Protocol: Official MCP specification.

Postgres MCP turns your database into a first-class tool for AI agents, making intelligent data interaction as simple as chatting with your assistant.

Tags

mcppostgresqlpostgresmcp-serversqldatabaseai-agentindex-tuningperformance-analysisclaudecursor

Related Entries

Keep exploring similar tools and resources in this category.

Browse MCP Servers
PaidSync.ai logo

PaidSync.ai

MCP Servers

PaidSync.ai is a hosted MCP server for paid advertising that exposes 610+ tools across 14 advertising, analytics, tagging, and commerce platforms. It supports read/write workflows from AI clients including ChatGPT, Claude, Gemini, Cursor, Claude Code, and Codex, with a free plan.

Hyper3D MCP logo

Hyper3D MCP

MCP Servers

Hyper3D MCP is Hyper3D's hosted Rodin MCP server for creating 3D assets from natural-language instructions or supported references, checking asynchronous generation progress, and retrieving model download links inside AI coding clients. Official setup is documented for Codex, Claude Code, and Kimi Code CLI.

Semrush MCP Server logo

Semrush MCP Server

MCP Servers

Semrush MCP connects AI assistants to Semrush APIs for keyword, backlink, website traffic and market research.

Browserbase MCP Server logo

Browserbase MCP Server

MCP Servers

Browserbase MCP gives AI agents browser automation tools powered by Stagehand and Browserbase browser sessions.

SerpApi MCP Server logo

SerpApi MCP Server

MCP Servers

SerpApi MCP exposes search engine results to AI assistants through SerpApi, supporting live research and structured search data retrieval.

Similarweb MCP Server logo

Similarweb MCP Server

MCP Servers

Similarweb MCP brings website traffic and digital market intelligence into AI assistants for competitive research.

a2a mcp

Search the directory

Find entries, skills, articles, and categories. Use arrow keys to select and Enter to open.