Prototype · Preview: every server in the official registry, synced every 30 minutes. Reviews and accounts come in a later step.
PopNx MCPMCP servers for people who use AI · explained in plain words

Postgres MCP

by sparta2025version 0.4.2i★ –iRuns on your computer
Registry nameio.github.sparta2025/postgres-mcp

Install

Overview

Description from the maker (original English)

PostgreSQL MCP server with 15 tools (SQL, EXPLAIN, health, indexes) plus a Gradio UI with LLM chat.

PopNx MCP’s three pillars

These three are never merged into one score: opinions, measurements and popularity are different things.

What you can do with it

We have not written a plain-language summary for this one yet. Below are the facts we read from the registry.

  • Connection: Runs on your computer
  • Transport: stdio
  • Category: Databases & datasets
  • You need to fill in: DATABASE_URL

Install

Pick the AI app you use, then copy the settings.

Before you install

  • Basic checks: 1 of 1 passed
  • Runs on your computer with your user’s permissions (files, network, apps).
  • You fill in yourself: DATABASE_URL

Values marked secret are keys to your account. Never share them or paste them into a chat.

You need

  • PyPIPython’s uv installed (for the uvx command)

Which app do you use?

Pick your app above. We remember it, so next time the button says “Install in …”.

Open Claude Desktop → Settings → Developer → Edit Config, and paste this into claude_desktop_config.json

{
  "mcpServers": {
    "postgres": {
      "command": "uvx",
      "args": [
        "postgres-mcp-pro"
      ],
      "env": {
        "DATABASE_URL": "your-value"
      }
    }
  }
}

Run this in your terminal

claude mcp add postgres --env DATABASE_URL=your-value -- uvx postgres-mcp-pro

Fill in the empty values before running it.

Open in Cursor

Or copy the settings yourself

Paste into .cursor/mcp.json in your project, or ~/.cursor/mcp.json

{
  "mcpServers": {
    "postgres": {
      "command": "uvx",
      "args": [
        "postgres-mcp-pro"
      ],
      "env": {
        "DATABASE_URL": "your-value"
      }
    }
  }
}

Your browser asks to open the app, then the app shows the settings and asks you to confirm. Key values are left empty for you to fill in.

Open in VS Code

Or copy the settings yourself

Paste into .vscode/mcp.json in your project

{
  "servers": {
    "postgres": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "postgres-mcp-pro"
      ],
      "env": {
        "DATABASE_URL": "your-value"
      }
    }
  }
}

Your browser asks to open the app, then the app shows the settings and asks you to confirm. Key values are left empty for you to fill in.

This one runs on your computer, and ChatGPT can only connect to servers on the internet. Pick another app.

Your choice stays on this device in a cookie; no account needed.

Values you fill in

  • DATABASE_URL secret required env
    PostgreSQL connection URL, e.g. postgresql://user:pass@localhost:5432/dbname

These settings are generated from the maker’s registry entry. If the README says otherwise, follow the README.

What it can do

Runs on your computer; the tool list appears in your AI app after you install it.

Basic checksi

We check information anyone can see; we have not read the code. Checks that do not apply are left out of the count. · Checked Nov 6, 2026

  • ✓ Pass

    Maker matches the repo

    The registry name was verified with the GitHub account sparta2025, which owns the repo

  • … Not checked yet

    Still maintained

    We have not read this repo from GitHub yet

  • … Not checked yet

    Has a licence

    We have not read this repo from GitHub yet

  • – Not applicable

    Endpoint responds

    This one runs on your computer; there is no internet endpoint

  • – Not applicable

    Sign-in with OAuth

    Runs on your computer and uses local settings instead

  • … Not checked yet

    No hidden instructions in tool descriptions

    Runs on your computer; we can only read tool lists from internet endpoints

Compared with others in Databases & datasetsi

  • More stars than 0% of the other 953 servers in this category
  • Published to the registry more recently than 26% of the other 953 servers in this category
  • Basic checks equal to or better than 100% of the other 953 servers in this category

Compared with every active server in this category in the registry. Stars count only when the publisher owns the repo.

Common questions

Is Postgres MCP safe?

It passed 1 of 1 applicable basic checks. We have not read the code. Before adding a key or token, see what access the server asks for and use a key with only the permissions you need.

What keys or codes does it need?

You need to fill in: DATABASE_URL

Does it run on my computer or in the cloud?

It runs on your computer. Your AI app starts it when needed, and data does not pass through the maker’s servers (unless it calls an online service itself).

Is it still maintained?

The GitHub repo last changed –, and the latest version (0.4.2) reached the registry 3 months ago.

Which apps can use it?

Apps that support MCP, such as Claude Desktop, Claude Code, Cursor and VS Code. You also need Python (uv) on your computer.

What can I use instead?

In the same category: Supabase, MongoDB MCP Server, Elasticsearch MCP Server

Alternatives

Servers in the same category from other makers, sorted by stars.

Reading a card:★ GitHub starsiThree pillars: reviews · checks · usageiUpdated = latest version published to the registryi

Supabase

by supabase

Supabase’s official server lets AI create tables, query data and review project settings in your Supabase database.

Computer or cloud★ 2,993Apache-2.0Updated yesterday
Install

MongoDB MCP Server

by mongodb-js

MongoDB Model Context Protocol Server

Runs on your computer★ 1,157Apache-2.0Updated 2 days ago
Install

README from the maker

Open the README

Copied from the maker’s repo as written. PopNx MCP has not reviewed or endorsed it. HTML, images and scripts are removed. Links lead off this site.

📘 Postgres MCP Pro — сервер MCP для PostgreSQL


🔎 Обзор

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


⚡ Быстрый старт

Требования:
  1. Доступ к вашей базе данных PostgreSQL
  2. 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/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json
Пример конфигурации:
Через Docker
{

"mcpServers": { "postgres": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "DATABASE_URI", "crystaldba/postgres-mcp", "--access-mode=unrestricted" ], "env": { "DATABASE_URI": "postgresql://username:password@localhost:5432/dbname" } } } }

Через pipx
{

"mcpServers": { "postgres": { "command": "postgres-mcp", "args": ["--access-mode=unrestricted"], "env": { "DATABASE_URI": "postgresql://username:password@localhost:5432/dbname" } } } }

Через uv
{

"mcpServers": { "postgres": { "command": "uv", "args": [ "run", "postgres-mcp", "--access-mode=unrestricted" ], "env": { "DATABASE_URI": "postgresql://username:password@localhost:5432/dbname" } } } }

Режимы доступа:
  • --access-mode=unrestricted: полный доступ (dev)
  • --access-mode=restricted: только чтение (prod)

⚠️ Флаг --access-mode поддерживает только легаси-сервер

(python -m postgres_mcp.server). Автономный MCP-сервер

(postgres_mcp.autonomous.mcp_server) всегда выполняет переданный SQL;

разграничение делайте на стороне пользователя БД.


🔄 SSE Transport

Чтобы использовать SSE:

docker run -p 8000:8000 \

-e DATABASE_URI=postgresql://username:password@localhost:5432/dbname \ crystaldba/postgres-mcp --access-mode=unrestricted --transport=sse

Пример для Cursor:

{

"mcpServers": { "postgres": { "type": "sse", "url": "http://localhost:8000/sse" } } }


🧩 Установка расширений (опционально)

Нужно для:

  • pg_stat_statements — для анализа запросов
  • hypopg — симуляция индексов
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;

CREATE EXTENSION IF NOT EXISTS hypopg;


🧪 Примеры использования

  • Проверка БД: "Check the health of my database..."
  • Медленные запросы: "What are the slowest queries..."
  • Рекомендации: "How can I make it faster?"
  • Индексы: "Suggest indexes to improve performance"
  • Оптимизация запроса: "Help me optimize this query: SELECT ..."

📡 MCP API (интерфейс)

Автономный сервер (postgres_mcp.autonomous.mcp_server) предоставляет 15 MCP tools:

ToolНазначение
list_schemasСписок схем БД
list_objectsСписок таблиц, представлений и т.п.
get_object_detailsПодробности по объекту
execute_sqlВыполнение SQL
explain_queryEXPLAIN план запроса
analyze_db_healthЗдоровье БД по множеству метрик
get_top_queriesСамые медленные запросы (pg_stat_statements)
analyze_index_performanceАнализ использования индексов
get_active_queriesВыполняющиеся запросы
get_table_sizesРазмеры таблиц/индексов
get_database_locksТекущие блокировки
format_sql_queryФорматирование SQL (sqlparse)
get_database_infoВерсия, размер БД, расширения, uptime
manage_encryption_keyУправление Fernet-сертификатами
list_toolsСписок всех инструментов сервера

📌 Отличия от других MCP-серверов

Postgres MCP ProДругие MCP-серверы
✅ Проверки здоровья с гарантией❌ Генерация LLM
✅ Оптимизация индексов алгоритмом❌ Гипотетические советы
✅ Симуляции EXPLAIN❌ "Попробуй сам"
✅ Детальный workload-анализ❌ Нет анализа запросов

🧠 Почему нужны инструменты MCP?

LLM отлично справляется с генерацией SQL, но медленно, дорого и непредсказуемо. Оптимизация БД давно решается алгоритмами. MCP Pro сочетает лучшее от LLM и классических алгоритмов.


🛠️ Технические заметки (ключевые моменты)

  • Индексы: использование pg_stat_statements, генерация кандидатов, анализ через hypopg
  • LLM-оптимизация: экспериментальная, с использованием OpenAI API (OPENAI_API_KEY)
  • Здоровье БД: адаптация проверок из PgHero
  • Библиотека подключения: psycopg3 с libpq
  • Безопасность SQL: чтение, защита от ROLLBACK; DROP ...
  • Интеграция со схемой: передаёт схему агенту через инструменты, а не ресурсы
  • Конфигурация соединений: через переменные среды
  • Dev-сборка: uv, pip, запуск с локальной БД
Ask PopNx