Postgres MCP server
io.github.sparta2025/postgres-mcp·v0.4.2PostgreSQL MCP server with 15 tools (SQL, EXPLAIN, health, indexes) plus a Gradio UI with LLM chat.
0 stars72 downloads/wk
Reviews
Write oneNobody has reviewed Postgres yet.
If you have run it, two minutes of your experience saves the next person an afternoon.
Postgres tools (16, 1 write)
write = sends, deletes, buys or postsRead from the package source without running it. The installed server may list more.
_humanize_param_typeПревращает Python-аннотацию в человекочитаемое описание для UI.
analyze_db_healthDatabase health overview.
analyze_index_performanceAnalyze index usage and find unused/duplicate indexes.
execute_sqlwrite actionExecute a SQL query.
explain_queryGet query execution plan.
format_sql_queryFormat/beautify a SQL query for readability.
get_active_queriesList currently running queries and their duration.
get_database_infoGet general database information: version, size, extensions, server settings.
get_database_locksShow current database locks and blocking queries.
get_object_detailsGet columns of a table or view.
get_table_sizesShow table sizes including indexes and total.
get_top_queriesTop queries by resource usage (requires pg_stat_statements extension).
list_objectsList tables/views/sequences in a schema.
list_schemasList all schemas in the database.
list_toolsList all available MCP tools of this server with their descriptions.
manage_encryption_keyManage the Data Encryption Certificate (Fernet key) for stored secrets.
Public scan report
scanner v0.1.10 · 2026-11-01 · same rubric, same numbers if you re-run it
- Code scan64 source files scanned25/25
- –Live reliabilityno gateway calls yet and no remote to proben/a
- –Tool poisoningtools not inspected (local package is not executed); not countedn/a
- Auth qualitystatic API keys via environment variables6/15
- Maintenancelast push 72 days ago12/15
- Maintainer identityregistry namespace matches repository owner; GitHub account older than a year8/10
How Postgres compares
Against every graded Databases MCP server, from our own scans and uptime checks. Updated after each scan run.
- Safety score
- 78/100
- higher than 47% of 802 Databases servers
- Tools
- 16
- the typical Databases server has 8
- Tools that change things
- 6%
- typical: 10%. Fewer write tools means less an agent can break
- Downloads a week
- 72
- more than 48% of 328 Databases servers with a package
What its tools let an agent do: 15 read · 1 run or deploy
Install Postgres in Claude Code, Cursor or VS Code
claude mcp add postgres-mcp -- uvx postgres-mcp-pro
What the publisher says
From the Postgres repository's README, as published. We do not edit it. Read it on GitHub
📘 Postgres MCP Pro — сервер MCP для PostgreSQL
<!-- mcp-name: io.github.sparta2025/postgres-mcp -->
🔎 Обзор
Postgres MCP Pro — это open-source сервер Model Context Protocol (MCP), предназначенный для помощи разработчикам и AI-агентам на всех этапах разработки: от начального кода и тестирования до деплоя и продакшн-оптимизации.
🙌 Основано на crystaldba/postgres-mcp (MIT, © 2025 Crystal Corp / Johann Schleier-Smith).
Форк развивается и поддерживается sparta2025 — автономный MCP-сервер, Gradio-оболочка, LLM-чат с tool-calling, сертификаты шифрования.
📚 Полная документация: docs/DOCUMENTATION.md — развёртывание (Docker/облако), Gradio-оболочка, подключение клиентов (stdio/SSE), все инструменты и переменные окружения.
Отличается от простого подключения к базе данных следующими возможностями:
- Анализ состояния БД: индекс, буферный кэш, autovacuum, последовательности, репликация и др.
- Оптимизация индексов: автоматический подбор лучших индексов с помощью промышленных алгоритмов.
- Планы выполнения: EXPLAIN и симуляция с гипотетическими индексами.
- Интеллект схемы: генерация SQL с учётом структуры базы.
- Безопасное выполнение SQL: поддержка режима только для чтения и защита в продакшне.
Поддерживает транспорты: stdio и SSE.
Запуск проекта и причины его создания
📺 Демонстрация
От медленного к молниеносному AI сгенерировал приложение на SQLAlchemy ORM — но оно было слишком медленным. Postgres MCP Pro с Cursor решил проблему за считанные минуты.
- 🚀 Оптимизация ORM-запросов, индексации и кэширования
- 🛠️ Исправление сломанной страницы
- 🧠 Улучшение вывода "топ-фильмов" путём анализа данных и корректировки запросов
👉 Подробнее: movie-app.md
⚡ Быстрый старт
Требования:
- Доступ к вашей базе данных PostgreSQL
- Docker или Python 3.12+
Удостоверьтесь в доступе:
Пример — подключение через psql или pgAdmin
💡 Для запуска через docker compose заранее создайте пустые файлы хранилищ
подключений (иначе Docker смонтирует каталоги вместо файлов):
bash
touch connections.json llm_connections.json
Установка
🐳 Docker
docker pull crystaldba/postgres-mcp🐍 Python (через pipx)
pipx install postgres-mcp-proили через uv:
uv pip install postgres-mcp-proКонсольная команда после установки — postgres-mcp
(автономный MCP-сервер, stdio по умолчанию; --transport sse для SSE).
⚙️ Настройка AI-ассистента (на примере Claude Desktop)
Откройте конфигурационный файл:
- MacOS: ~/Library/Application Support/Claude/claudedesktopconfig.json
- Windows: %APPDATA%/Claude/claudedesktopconfig.json
Пример конфигурации:
Через Docker
Shortened. The full README is on GitHub.
Nothing above is checked by us. What we check is on the safety report.
Postgres: common questions
- Is Postgres MCP server safe?
- Mostly: it is graded B (78/100). Read the Postgres safety report
- How do I install Postgres?
- It runs on your machine. Copy the Claude Code, Cursor, VS Code or Claude Desktop config from the install section.
- Does Postgres need an API key?
- Yes. The registry entry asks for
DATABASE_URL. - Is Postgres maintained?
- The last commit was 75 days ago (2026-08-21). The latest release is v0.4.2.
- What can I use instead of Postgres?
- Servers from other publishers that do the same job: PostgreSQL MCP Server, DB Explorer MCP server and DBHub MCP server.
- How does Postgres compare with other Databases MCP servers?
- safety score 78/100 (higher than 47% of 802 Databases servers); tools 16 (the typical Databases server has 8); tools that change things 6% (typical: 10%. Fewer write tools means less an agent can break). Full comparison.
Alternatives to Postgres
Same job from other publishers: the closest match first, then the best rated.
- PostgreSQL MCP ServerPostgreSQL MCP server - query, schema introspection, explain, and health checks for AI assistantsnot reviewedEstablishedB
- DB ExplorerRead-only SQL for PostgreSQL, MySQL and SQLite: schema, safe SELECTs, EXPLAIN, index advicenot reviewedGrowingB
- DBHubToken-efficient database MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLitenot reviewedWidely usedA
- FaucetSQL database to MCP tools and REST API: PostgreSQL, MySQL, SQL Server, Oracle, SQLite, Snowflake.not reviewedEstablishedA
- PostgreSQLMCP server for PostgreSQL: local, Docker, RDS, Neon, Supabase, or behind an SSH bastion.not reviewedEstablishedB