Token导航 LogoToken导航

MCP Server · 数据服务

Multi Postgres MCP Server

一个支持多PostgreSQL数据库的MCP服务器,通过单一配置文件和热重载功能提供高效、安全的只读数据库访问服务。

未说明官方级别未说明来源级核验工具 4
数据分析多数据库支持JavaScriptClaude只读访问CursorWindsurfCline

快速开始

公开资料没有提供安装命令,按仓库或官方文档接入。
作者 / 组织
VKirill
提供方
VKirill

工具数量

4

来源目录标注

资源数量

0

来源目录标注

提示词数量

0

来源目录标注

GitHub Star

2

仓库热度

收录来源

1 个

MCP World

选型结论

Multi Postgres MCP Server 属于数据服务类 MCP Server,公开资料标注 4 个工具,通过传输方式未标注接入,适配 Claude、Cursor、Windsurf,没有现成的安装命令;接入前要先准备 会话凭据。

分类

数据服务

传输方式

未说明

认证方式

会话凭据

部署方式

公开资料未说明

安装与配置

公开目录没有给出安装命令,需要按仓库 README安装;下面按同类条目的通用流程说明。

公开命令不是通用的启动方式,拼不出可靠配置示例;请在客户端 MCP 配置里按官方文档填写 command 和 args。

上手步骤

  1. 1

    先确认运行方式

    公开资料没有标注传输方式,先看仓库 README,确认是本地进程还是远程地址。

  2. 2

    获取服务

    公开目录没有给出安装命令,按仓库 README里的步骤安装或获取服务。

  3. 3

    写入客户端配置

    在客户端的 MCP 配置里填启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4

    验证是否可用

    连接成功后客户端会列出 4 个工具,随便调一个只读工具确认能返回结果。

接入前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

公开资料仍需确认:安装命令

详细介绍

multi-postgres-mcp-server

One MCP server for all your PostgreSQL databases.

English | Русский | 中文


English

Why?

The official @modelcontextprotocol/server-postgres supports only one database per server instance. If you have 5 projects with 5 databases, you need 5 separate MCP server processes.

multi-postgres-mcp-server solves this:

  • One server serves all your databases
  • One config file with all connections
  • Hot reload — add a database to config, it's immediately available (no restart)
  • --label filter — restrict access to a single database per project (isolation)
  • Read-only — all queries run inside BEGIN TRANSACTION READ ONLY (safety)

Architecture

┌─────────────────────────────────────────────────────────┐
│                    config.json                           │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐              │
│  │ staging  │  │production│  │  local   │  ...          │
│  └──────────┘  └──────────┘  └──────────┘              │
└──────────────────────┬──────────────────────────────────┘
                       │ reads on every call
                       ▼
              ┌─────────────────┐
              │  mcp-postgres   │  ← single MCP server process
              │  (stdio)        │
              └────────┬────────┘
                       │
          ┌────────────┼────────────┐
          ▼            ▼            ▼
    ┌──────────┐ ┌──────────┐ ┌──────────┐
    │Claude Code│ │  Cursor  │ │ Any MCP  │
    │(all DBs) │ │(filtered)│ │ client   │
    └──────────┘ └──────────┘ └──────────┘

Tools

ToolParametersDescription
pg_list_databases—List all available databases
pg_querydatabase, queryExecute read-only SQL query
pg_list_tablesdatabase, schema?List tables with row counts
pg_describe_tabledatabase, table, schema?Column types, PK, FK, defaults

Quick Start

1. Install & build
git clone https://github.com/VKirill/multi-postgres-mcp-server.git
cd multi-postgres-mcp-server
npm install
2. Create config

Create ~/.mcp-postgres/config.json (or any path you like):

{
  "connections": [
    {
      "label": "production",
      "host": "db.example.com",
      "port": 5432,
      "user": "readonly_user",
      "password": "secret",
      "database": "myapp",
      "enabled": true
    },
    {
      "label": "staging",
      "host": "localhost",
      "port": 5432,
      "user": "dev",
      "password": "dev123",
      "database": "myapp_staging",
      "enabled": true
    }
  ]
}

Object format also supported (keyed by any identifier):

{
  "connections": {
    "my-project": { "label": "production", "host": "...", ... }
  }
}
3. Add to your AI tool

Claude Code (one command):

claude mcp add postgres -- node /path/to/multi-postgres-mcp-server/dist/index.js

Claude Code (with custom config):

claude mcp add postgres -- node /path/to/multi-postgres-mcp-server/dist/index.js --config /path/to/config.json

Claude Code (with --label for single DB):

claude mcp add postgres -- node /path/to/multi-postgres-mcp-server/dist/index.js --label production

That's it! Claude Code will automatically pick up the server on next start.

Alternative: manual JSON config

Add to ~/.claude.json → mcpServers:

{
  "mcpServers": {
    "postgres": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/multi-postgres-mcp-server/dist/index.js"]
    }
  }
}

Custom config path

# Via CLI argument
node dist/index.js --config /path/to/my-config.json

# Via environment variable
MCP_POSTGRES_CONFIG=/path/to/config.json node dist/index.js

Default config path: ~/.mcp-postgres/config.json

Usage with Cursor (per-project isolation)

Create .cursor/mcp.json in each project folder:

{
  "mcpServers": {
    "postgres": {
      "command": "node",
      "args": [
        "/path/to/multi-postgres-mcp-server/dist/index.js",
        "--label",
        "production"
      ]
    }
  }
}

With --label production, the server only exposes the production database. The AI doesn't see other databases and can query directly without choosing.

Usage with Windsurf / Cline / other MCP clients

Same pattern — add as a stdio MCP server:

{
  "mcpServers": {
    "postgres": {
      "command": "node",
      "args": ["/path/to/multi-postgres-mcp-server/dist/index.js"]
    }
  }
}

Example session

User: Show me all tables in the production database

AI calls: pg_list_tables(database="production")
→ Tables in "public" (12):
  - users (~45000 rows)
  - orders (~128000 rows)
  - products (~3200 rows)
  ...

User: What does the users table look like?

AI calls: pg_describe_table(database="production", table="users")
→ Table "public"."users" (8 columns):
    id: integer [PK] NOT NULL DEFAULT nextval('users_id_seq')
    email: character varying(255) NOT NULL
    name: character varying(100)
    created_at: timestamp with time zone DEFAULT now()
    ...

User: Show me the latest 5 orders

AI calls: pg_query(database="production", query="SELECT * FROM orders ORDER BY created_at DESC LIMIT 5")
→ { columns: [...], rows: [...], rowCount: 5 }

Security

  • All queries execute inside READ ONLY transactions
  • Write operations (INSERT, UPDATE, DELETE, DROP) will fail
  • Connection timeout: 10 seconds
  • Query timeout: 30 seconds
  • Config file with passwords is excluded from git via .gitignore
  • Use --label to prevent AI from accessing unrelated databases

Comparison with official server

Feature@modelcontextprotocol/server-postgresmulti-postgres-mcp-server
Databases per server1Unlimited
Config formatConnection string in argsJSON file
Hot reloadNo (restart required)Yes
Per-project isolationN/A--label filter
Query safetyFull accessRead-only only
Processes needed for 5 DBs51

Русский

Зачем?

Официальный @modelcontextprotocol/server-postgres поддерживает только одну БД на сервер. Если у вас 5 проектов с 5 базами — нужно 5 отдельных процессов MCP-сервера.

multi-postgres-mcp-server решает это:

  • Один сервер обслуживает все БД
  • Один конфиг со всеми подключениями
  • Hot reload — добавил БД в конфиг, она сразу доступна (без рестарта)
  • Фильтр --label — ограничивает доступ одной БД для проекта (изоляция)
  • Только чтение — все запросы в BEGIN TRANSACTION READ ONLY (безопасность)

Архитектура

┌─────────────────────────────────────────────────────────┐
│                    config.json                           │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐              │
│  │ staging  │  │production│  │  local   │  ...          │
│  └──────────┘  └──────────┘  └──────────┘              │
└──────────────────────┬──────────────────────────────────┘
                       │ читает при каждом вызове
                       ▼
              ┌─────────────────┐
              │  mcp-postgres   │  ← один процесс MCP-сервера
              │  (stdio)        │
              └────────┬────────┘
                       │
          ┌────────────┼────────────┐
          ▼            ▼            ▼
    ┌──────────┐ ┌──────────┐ ┌──────────┐
    │Claude Code│ │  Cursor  │ │Любой MCP │
    │(все БД)  │ │(фильтр)  │ │ клиент   │
    └──────────┘ └──────────┘ └──────────┘

Инструменты

ИнструментПараметрыОписание
pg_list_databases—Список доступных БД
pg_querydatabase, queryRead-only SQL запрос
pg_list_tablesdatabase, schema?Таблицы с количеством строк
pg_describe_tabledatabase, table, schema?Колонки, типы, PK, FK, defaults

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

1. Установка
git clone https://github.com/VKirill/multi-postgres-mcp-server.git
cd multi-postgres-mcp-server
npm install
2. Создайте конфиг

~/.mcp-postgres/config.json:

{
  "connections": [
    {
      "label": "production",
      "host": "db.example.com",
      "port": 5432,
      "user": "readonly_user",
      "password": "secret",
      "database": "myapp",
      "enabled": true
    }
  ]
}
3. Добавьте в Claude Code

Одной командой:

claude mcp add postgres -- node /path/to/multi-postgres-mcp-server/dist/index.js

С кастомным конфигом:

claude mcp add postgres -- node /path/to/multi-postgres-mcp-server/dist/index.js --config /path/to/config.json

С фильтром на одну БД:

claude mcp add postgres -- node /path/to/multi-postgres-mcp-server/dist/index.js --label production

Готово! Claude Code подхватит сервер при следующем запуске.

Cursor (изоляция по проектам)

В каждой папке проекта создайте .cursor/mcp.json:

{
  "mcpServers": {
    "postgres": {
      "command": "node",
      "args": [
        "/path/to/multi-postgres-mcp-server/dist/index.js",
        "--label",
        "production"
      ]
    }
  }
}

С --label production сервер видит только БД production. ИИ не знает про другие базы и может сразу делать запросы без выбора.

Путь к конфигу

node dist/index.js --config /path/to/config.json
# или
MCP_POSTGRES_CONFIG=/path/to/config.json node dist/index.js

По умолчанию: ~/.mcp-postgres/config.json

Сравнение с официальным сервером

Возможность@modelcontextprotocol/server-postgresmulti-postgres-mcp-server
БД на сервер1Без ограничений
Формат конфигаConnection string в аргументахJSON файл
Hot reloadНет (нужен рестарт)Да
Изоляция по проектамНетФильтр --label
Безопасность запросовПолный доступТолько чтение
Процессов для 5 БД51

Безопасность

  • Все запросы выполняются в READ ONLY транзакциях
  • Операции записи (INSERT, UPDATE, DELETE, DROP) завершатся ошибкой
  • Таймаут подключения: 10 сек, таймаут запроса: 30 сек
  • Конфиг с паролями исключён из git через .gitignore
  • --label не даёт ИИ видеть чужие базы данных

中文

为什么需要?

官方 @modelcontextprotocol/server-postgres 每个服务器实例只支持一个数据库。如果你有5个项目对应5个数据库,就需要5个独立的MCP服务器进程。

multi-postgres-mcp-server 解决了这个问题:

  • 一个服务器管理所有数据库
  • 一个配置文件包含所有连接
  • 热重载 — 在配置中添加数据库,立即可用(无需重启)
  • --label 过滤器 — 限制项目只能访问单个数据库(隔离)
  • 只读模式 — 所有查询在 BEGIN TRANSACTION READ ONLY 中执行(安全)

架构

┌─────────────────────────────────────────────────────────┐
│                    config.json                           │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐              │
│  │ staging  │  │production│  │  local   │  ...          │
│  └──────────┘  └──────────┘  └──────────┘              │
└──────────────────────┬──────────────────────────────────┘
                       │ 每次调用时读取
                       ▼
              ┌─────────────────┐
              │  mcp-postgres   │  ← 单个MCP服务器进程
              │  (stdio)        │
              └────────┬────────┘
                       │
          ┌────────────┼────────────┐
          ▼            ▼            ▼
    ┌──────────┐ ┌──────────┐ ┌──────────┐
    │Claude Code│ │  Cursor  │ │任意 MCP  │
    │(所有数据库)│ │(已过滤)  │ │ 客户端   │
    └──────────┘ └──────────┘ └──────────┘

工具

工具参数描述
pg_list_databases—列出所有可用数据库
pg_querydatabase, query执行只读SQL查询
pg_list_tablesdatabase, schema?列出表及行数估计
pg_describe_tabledatabase, table, schema?列类型、主键、外键、默认值

快速开始

1. 安装
git clone https://github.com/VKirill/multi-postgres-mcp-server.git
cd multi-postgres-mcp-server
npm install
2. 创建配置

~/.mcp-postgres/config.json:

{
  "connections": [
    {
      "label": "production",
      "host": "db.example.com",
      "port": 5432,
      "user": "readonly_user",
      "password": "secret",
      "database": "myapp",
      "enabled": true
    }
  ]
}
3. 添加到 Claude Code

一条命令:

claude mcp add postgres -- node /path/to/multi-postgres-mcp-server/dist/index.js

自定义配置路径:

claude mcp add postgres -- node /path/to/multi-postgres-mcp-server/dist/index.js --config /path/to/config.json

单数据库过滤:

claude mcp add postgres -- node /path/to/multi-postgres-mcp-server/dist/index.js --label production

完成!Claude Code 将在下次启动时自动加载服务器。

Cursor(按项目隔离)

在每个项目文件夹中创建 .cursor/mcp.json:

{
  "mcpServers": {
    "postgres": {
      "command": "node",
      "args": [
        "/path/to/multi-postgres-mcp-server/dist/index.js",
        "--label",
        "production"
      ]
    }
  }
}

使用 --label production 后,服务器只暴露 production 数据库。AI看不到其他数据库,可以直接查询无需选择。

配置路径

node dist/index.js --config /path/to/config.json
# 或
MCP_POSTGRES_CONFIG=/path/to/config.json node dist/index.js

默认路径:~/.mcp-postgres/config.json

与官方服务器对比

功能@modelcontextprotocol/server-postgresmulti-postgres-mcp-server
每服务器数据库数1无限制
配置格式参数中的连接字符串JSON 文件
热重载否(需重启)是
按项目隔离无--label 过滤器
查询安全性完全访问仅只读
5个数据库需要的进程数51

安全性

  • 所有查询在 READ ONLY 事务中执行
  • 写操作(INSERT、UPDATE、DELETE、DROP)会失败
  • 连接超时:10秒,查询超时:30秒
  • 包含密码的配置文件通过 .gitignore 排除在git之外
  • --label 防止AI访问无关数据库

License

MIT

工具与能力

工具数量

4

资源数量

0

提示词数量

0

能力标签

数据库管理JavaScript本地部署PostgreSQL只读访问多数据库支持MCP协议

支持客户端

ClaudeCursorWindsurfCline

数量来自来源目录的标注,具体工具清单以官方文档为准。

典型使用场景

用自然语言查库

不用手写 SQL,直接问数据,让模型组织查询语句。

数据巡检

定期拉指标、做对比,把异常项整理成一段说明。

打通业务数据

把数据库、数仓和接口接进同一个上下文,减少导出再上传。

选择建议

值得选的地方

  • 只提供 4 个工具,职责集中,接入后不容易误操作。
  • 已经适配 Claude、Cursor、Windsurf,换客户端不用重新研究配置。
  • 公开说明写得比较完整,接入前能看清能力边界。

先想清楚的地方

  • 公开资料没有可直接复制的安装命令,第一次接入要自己找入口。
  • 需要自备会话凭据,没有凭据没法直接试。
  • 公开摘要偏短,具体能力和限制要回到仓库确认。

更适合

  • 需要在数据服务场景里让模型直接调用外部能力的人。
  • 已经在用 Claude 的用户,接入路径最短。
  • 愿意照着官方文档一步步配环境的人。

不太适合

  • 暂时拿不到会话凭据的人。
  • 希望一条命令就装好、不想看文档的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

5 个同类
MCP Server工具数传输方式安装命令收录来源最后核验
Multi Postgres MCP Server

MCP World · 本页

4未说明未标注1 个2026-05-17
Memory 9d25f64e

MCP World

9未说明未标注1 个2026-05-17
Prisma MCP Server

MCP World

0stdio有3 个2026-05-17
Astr Bot

MCP World

0stdio有1 个2026-05-17
Getzep MCP

MCP World

9stdio有1 个2026-05-17

按同分类和工具数量挑出最接近的几条,字段以各自详情页为准。

常见问题

5 条

Multi Postgres MCP Server 怎么安装?

公开目录没有给出可以直接复制的安装命令,需要按仓库 README里的步骤安装;装好后写进客户端的 MCP 配置再重启。

Multi Postgres MCP Server 怎么在 Claude Desktop、Cursor 里配置?

它是传输方式未标注,客户端配置里要写启动命令和参数,运行环境是 未标注;保存后完全退出客户端再打开,配置才会生效。

Multi Postgres MCP Server 收费吗?

本站只整理公开资料,不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Multi Postgres MCP Server 需要 API Key 吗?

公开资料标注的认证方式是会话凭据,也就是要先拿到凭据才能连上;凭据只填在自己本地的配置里,不要写进公开仓库。

Multi Postgres MCP Server 支持哪些客户端?

公开资料标注支持 Claude、Cursor、Windsurf、Cline;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

来源信息

继续浏览同类 MCP