--- id: postgres-mcp version: "0.3.0" license: MIT license_treatment: permissive maintenance: aging --- # postgres-mcp — PostgreSQL Tuning and Analysis Tool License: permissive · Maintenance: aging · Downloads: 202.4K/mo ## What it is and what it does Postgres MCP is a Model Context Protocol server that exposes PostgreSQL database operations to AI agents and assistants. It acts as a bridge between AI tools (like Claude, Cursor, or Windsurf) and your database, enabling agents to analyze schemas, review query performance, explore index tuning opportunities, and execute SQL safely. The package wraps psycopg and pglast to provide schema-aware SQL generation, EXPLAIN plan analysis, and database health diagnostics including index health, connection utilization, buffer cache, and replication lag. It runs as a standalone server via Docker or Python (3.12+) and supports both stdio and SSE transports for flexible deployment. Access control is configurable: unrestricted mode for development allows full read/write access, while restricted mode limits operations to read-only transactions and resource constraints suitable for production. The package depends on attrs, humanize, instructor, mcp, pglast, psycopg-pool, and psycopg. Use it for: - Debugging slow ORM queries by asking an AI agent to review EXPLAIN plans and suggest indexes without manual analysis. - Exploring hypothetical index scenarios to find the best solution for a workload before committing schema changes. - Running health checks on production databases (in restricted mode) to identify connection leaks, vacuum issues, or replication lag. - Generating context-aware SQL from natural language prompts based on detailed schema understanding. - Automating routine database maintenance tasks through AI agents while enforcing read-only constraints in production. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A Model Context Protocol server that connects AI agents to PostgreSQL databases for analysis, tuning, and safe query execution with health checks and index optimization. Yes, if you are actively using an MCP-compatible AI assistant (Claude, Cursor, Windsurf) and want to give it safe, structured access to PostgreSQL for tuning and analysis. The low install friction and permissive license are favorable. However, verify current maintenance status before relying on it in production—the package is aging with no recent commit history visible, and support clarity is needed. ## Install pip install postgres-mcp uv add postgres-mcp poetry add postgres-mcp ## Installing postgres-mcp Before you install: Low friction installation via pipx or uv; package is aging (455 days since release) with no recent commits tracked, so maintenance status is unclear—verify active support before production use. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions, suitable for both development and commercial projects. Quickstart: # Install via pipx pipx install postgres-mcp # Or via uv uv pip install postgres-mcp # Configure in Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json): # { # "mcpServers": { # "postgres": { # "command": "postgres-mcp", # "args": ["--access-mode=unrestricted"], # "env": {"DATABASE_URI": "postgresql://user:pass@localhost:5432/dbname"} # } # } # } # Then use in Claude or other MCP client to query and analyze your database. Requires Python 3.12 or higher; requires a running PostgreSQL database with valid connection credentials; requires an MCP-compatible AI assistant (Claude, Cursor, Windsurf, etc.) to interact with the server. Verify before relying: - Whether the package is actively maintained—repo commit history and current maintainer status are not available in the fact sheet. - Performance characteristics when analyzing large databases or thousands of possible indexes. - Specific constraints or limitations of restricted mode for production environments. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 202.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags postgres mcp server, database tuning ai agent, sql explain plan analysis, index optimization tool, postgres health monitoring, safe database access control, ai-assisted query optimization, mcp-server, ai-agent-integration, database-analysis [View on SkillFed](https://skillfed.io/packages/postgres-mcp) · [View on PyPI](https://pypi.org/project/postgres-mcp/)