Skip to main content
Glama
aeiyannn

PostgreSQL MCP Server

by aeiyannn

MCP-сервер PostgreSQL

Сервер MCP (Model Context Protocol), который подключается к локальной базе данных PostgreSQL, позволяя ИИ-ассистентам запрашивать вашу базу данных и управлять ею.

Предоставляемые инструменты

Инструмент

Описание

query

Выполнение SQL-запросов только для чтения (SELECT, SHOW, EXPLAIN)

execute

Выполнение SQL-запросов на запись (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP)

list_tables

Список всех таблиц в схеме

describe_table

Отображение столбцов, типов, ключей и индексов для таблицы

list_schemas

Список всех пользовательских схем в базе данных

Related MCP server: PostgreSQL MCP Server

Ресурсы

  • schema-overview (postgres://schema/overview) — Обзор всей схемы базы данных в формате Markdown

Динамическое подключение через заголовки

Этот сервер поддерживает динамические подключения к PostgreSQL. Вы можете предоставить учетные данные базы данных через HTTP-заголовки в начальном запросе подключения SSE. Это позволяет одному развернутому экземпляру сервера обслуживать несколько разных баз данных.

Поддерживаемые заголовки

Заголовок

Описание

По умолчанию

x-pg-host

Хост PostgreSQL

PG_HOST или localhost

x-pg-port

Порт PostgreSQL

PG_PORT или 5432

x-pg-user

Пользователь PostgreSQL

PG_USER или postgres

x-pg-password

Пароль PostgreSQL

PG_PASSWORD или postgres

x-pg-database

База данных PostgreSQL

PG_DATABASE или postgres

x-pg-ssl

Использовать SSL (true/false)

PG_SSL или false

x-pg-ca-cert

CA-сертификат

PG_CA_CERT


Настройка в Antigravity / Cursor (VS Code)

Чтобы использовать этот сервер с Antigravity или Cursor, добавьте следующее в ваш mcp_config.json (обычно находится в %APPDATA%\antigravity\ или в настройках MCP вашей IDE):

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://postgree-mcp-dfadduf9bsdvdwa9.eastasia-01.azurewebsites.net/sse",
        "--header", "x-pg-host: pg-168600c0-aeiyankhan2-d42e.g.aivencloud.com",
        "--header", "x-pg-port: 26768",
        "--header", "x-pg-user: avnadmin",
        "--header", "x-pg-password: YOUR_PASSWORD",
        "--header", "x-pg-database: defaultdb",
        "--header", "x-pg-ssl: true"
      ]
    }
  }
}

Настройка в Claude Code CLI

Если вы используете Claude Code CLI, вы можете добавить этот сервер с помощью следующей команды:

1. Установите Claude Code (если еще не установлен)

npm install -g @anthropic-ai/claude-code

2. Добавьте MCP-сервер PostgreSQL

Выполните эту команду в своем терминале:

claude mcp add postgres -- npx mcp-remote https://postgree-mcp-dfadduf9bsdvdwa9.eastasia-01.azurewebsites.net/sse \
  --header "x-pg-host: pg-168600c0-aeiyankhan2-d42e.g.aivencloud.com" \
  --header "x-pg-port: 26768" \
  --header "x-pg-user: avnadmin" \
  --header "x-pg-password: YOUR_PASSWORD" \
  --header "x-pg-database: defaultdb" \
  --header "x-pg-ssl: true"

Настройка в Claude Desktop

Добавьте это в ваш claude_desktop_config.json:

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://postgree-mcp-dfadduf9bsdvdwa9.eastasia-01.azurewebsites.net/sse",
        "--header", "x-pg-host: pg-168600c0-aeiyankhan2-d42e.g.aivencloud.com",
        "--header", "x-pg-port: 26768",
        "--header", "x-pg-user: avnadmin",
        "--header", "x-pg-password: YOUR_PASSWORD",
        "--header", "x-pg-database: defaultdb",
        "--header", "x-pg-ssl: true"
      ]
    }
  }
}

Локальная настройка (для разработки)

1. Установите зависимости

npm install

2. Настройте базу данных по умолчанию (необязательно)

Вы по-прежнему можете использовать файл .env для локальной разработки:

PG_HOST=localhost
PG_PORT=5432
PG_USER=postgres
PG_PASSWORD=your_password_here
PG_DATABASE=your_database_name

3. Сборка и запуск

npm run build
npm start

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

После настройки вы можете спрашивать ИИ-ассистента о следующем:

  • "List all tables in my database"

  • "Describe the users table"

  • "SELECT * FROM orders WHERE created_at > '2025-01-01'"

  • "Create a new table called products"

A
license - permissive license
Not graded
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables Claude to interact with a local PostgreSQL database through SQL queries, schema inspection, and CRUD operations.
    8
    225
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to query and explore PostgreSQL databases with tools for executing SQL queries, listing tables, and describing table structures.
    MIT

View all related MCP servers

Related MCP Connectors

  • Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.

  • Comprehensive PostgreSQL documentation and best practices, including ecosystem tools

  • Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aeiyannn/postgree-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server