ต้นแบบ · รุ่นทดลอง: มีทุก server ในทะเบียนทางการ อัปเดตทุก 30 นาที รีวิวและบัญชีผู้ใช้จะมาในขั้นถัดไป
PopNx MCPที่รวม MCP สำหรับคนใช้ AI · อธิบายเป็นภาษาคน

Postgres MCP

โดย edelciomolinaรุ่น 1.7.0i★ –iรันบนเครื่อง
ชื่อใน registryio.github.edelciomolina/postgres-mcp

ติดตั้ง

ภาพรวม

คำอธิบายจากผู้ทำ (ภาษาอังกฤษตามต้นฉบับ)

PostgreSQL MCP wrapper with .env credential mapping, tool selection, and safe read-only defaults.

สามเสาของ PopNx MCP

สามเรื่องนี้ไม่รวมเป็นคะแนนเดียว เพราะความเห็น การวัด และความนิยม เป็นคนละเรื่องกัน

ใช้ทำอะไรได้

ตัวนี้ยังไม่ได้เรียบเรียงเป็นภาษาไทย ด้านล่างคือข้อเท็จจริงที่เราอ่านจาก registry

  • การเชื่อมต่อ: รันบนเครื่อง
  • ช่องทาง (transport): stdio
  • หมวด: ฐานข้อมูลและชุดข้อมูล

ติดตั้ง

เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง

ก่อนติดตั้ง

  • ผลตรวจเบื้องต้น: ผ่าน 1 จาก 1 ข้อ
  • รันในเครื่องคุณด้วยสิทธิ์ของผู้ใช้คุณ (ไฟล์ อินเทอร์เน็ต แอปต่าง ๆ)
  • ค่าที่คุณต้องใส่เอง: MCP_KEY_HOST, MCP_KEY_PORT, MCP_KEY_NAME, MCP_KEY_USER, MCP_KEY_PASS, MCP_KEY_SSLMODE

ต้องเตรียมก่อน

  • npmติดตั้ง Node.js (มีคำสั่ง npx) ในเครื่อง

คุณใช้แอปไหน

เลือกแอปด้านบน เราจำไว้ให้ ครั้งหน้าปุ่มจะขึ้นว่า “ติดตั้งลง …”

เปิด Claude Desktop → Settings → Developer → Edit Config แล้ววางค่านี้ในไฟล์ claude_desktop_config.json

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@edelciomolina/postgres-mcp"
      ],
      "env": {
        "MCP_KEY_HOST": "ใส่ค่าของคุณ",
        "MCP_KEY_PORT": "ใส่ค่าของคุณ",
        "MCP_KEY_NAME": "ใส่ค่าของคุณ",
        "MCP_KEY_USER": "ใส่ค่าของคุณ",
        "MCP_KEY_PASS": "ใส่ค่าของคุณ",
        "MCP_KEY_SSLMODE": "ใส่ค่าของคุณ"
      }
    }
  }
}

พิมพ์คำสั่งนี้ใน Terminal

claude mcp add postgres --env MCP_KEY_HOST='ใส่ค่าของคุณ' --env MCP_KEY_PORT='ใส่ค่าของคุณ' --env MCP_KEY_NAME='ใส่ค่าของคุณ' --env MCP_KEY_USER='ใส่ค่าของคุณ' --env MCP_KEY_PASS='ใส่ค่าของคุณ' --env MCP_KEY_SSLMODE='ใส่ค่าของคุณ' -- npx -y @edelciomolina/postgres-mcp

เติมค่าที่เว้นว่างไว้ก่อนรัน

เปิดใน Cursor

หรือคัดลอกค่าตั้งเอง

วางในไฟล์ .cursor/mcp.json ของโปรเจกต์ หรือ ~/.cursor/mcp.json

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@edelciomolina/postgres-mcp"
      ],
      "env": {
        "MCP_KEY_HOST": "ใส่ค่าของคุณ",
        "MCP_KEY_PORT": "ใส่ค่าของคุณ",
        "MCP_KEY_NAME": "ใส่ค่าของคุณ",
        "MCP_KEY_USER": "ใส่ค่าของคุณ",
        "MCP_KEY_PASS": "ใส่ค่าของคุณ",
        "MCP_KEY_SSLMODE": "ใส่ค่าของคุณ"
      }
    }
  }
}

เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง

เปิดใน VS Code

หรือคัดลอกค่าตั้งเอง

วางในไฟล์ .vscode/mcp.json ของโปรเจกต์

{
  "servers": {
    "postgres": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@edelciomolina/postgres-mcp"
      ],
      "env": {
        "MCP_KEY_HOST": "ใส่ค่าของคุณ",
        "MCP_KEY_PORT": "ใส่ค่าของคุณ",
        "MCP_KEY_NAME": "ใส่ค่าของคุณ",
        "MCP_KEY_USER": "ใส่ค่าของคุณ",
        "MCP_KEY_PASS": "ใส่ค่าของคุณ",
        "MCP_KEY_SSLMODE": "ใส่ค่าของคุณ"
      }
    }
  }
}

เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง

ตัวนี้รันในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะ server บนอินเทอร์เน็ต ลองเลือกแอปอื่น

ตัวเลือกเก็บในคุกกี้บนเครื่องนี้ ไม่ต้องมีบัญชี

ค่าที่ต้องใส่เอง

  • MCP_KEY_HOST env
    Name of the .env variable that holds the database host
  • MCP_KEY_PORT env
    Name of the .env variable that holds the database port
  • MCP_KEY_NAME env
    Name of the .env variable that holds the database name
  • MCP_KEY_USER env
    Name of the .env variable that holds the database user
  • MCP_KEY_PASS env
    Name of the .env variable that holds the database password
  • MCP_KEY_SSLMODE env
    Name of the .env variable that holds the SSL mode (e.g. require)

ค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README

ทำอะไรได้บ้าง

รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง

ผลตรวจเบื้องต้นi

เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 7 พ.ย. 2569

  • ✓ ผ่าน

    ตัวตนผู้ทำตรงกับ repo

    ชื่อใน registry ยืนยันด้วยบัญชี GitHub edelciomolina ซึ่งเป็นเจ้าของ repo

  • … ยังไม่ตรวจ

    ยังมีคนดูแล

    ยังไม่ได้อ่านข้อมูล repo จาก GitHub

  • … ยังไม่ตรวจ

    มีสัญญาอนุญาต (license)

    ยังไม่ได้อ่านข้อมูล repo จาก GitHub

  • – ไม่เกี่ยว

    endpoint ตอบ

    ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต

  • – ไม่เกี่ยว

    ล็อกอินแบบ OAuth

    ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน

  • … ยังไม่ตรวจ

    คำอธิบายเครื่องมือไม่มีคำสั่งแอบแฝง

    รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต

เทียบกับตัวอื่นในหมวด ฐานข้อมูลและชุดข้อมูลi

  • ดาวมากกว่า 0% ของอีก 952 ตัวในหมวดนี้
  • ส่งรุ่นใหม่เข้า registry ล่าสุดกว่า 15% ของอีก 952 ตัวในหมวดนี้
  • ผลตรวจเบื้องต้นดีกว่าหรือเท่ากับ 100% ของอีก 952 ตัวในหมวดนี้

เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo

คำถามที่พบบ่อย

Postgres MCP ปลอดภัยไหม?

จากการตรวจเบื้องต้นของเรา ผ่าน 1 จาก 1 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น

ต้องใช้กุญแจหรือรหัสอะไรบ้าง?

registry ไม่ได้ระบุว่าต้องใช้กุญแจ แต่บางตัวจะขอให้ล็อกอินตอนใช้ครั้งแรก

ตัวนี้รันบนเครื่องหรือบนคลาวด์?

รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)

ยังมีคนดูแลอยู่ไหม?

repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (1.7.0) เข้า registry 5 เดือนที่ผ่านมา

ใช้กับโปรแกรมไหนได้บ้าง?

โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Node.js ในเครื่องด้วย

มีตัวไหนใช้แทนได้บ้าง?

ในหมวดเดียวกันมี Supabase, MongoDB MCP Server, Elasticsearch MCP Server

ตัวที่ใช้แทนได้

server หมวดเดียวกันจากผู้ทำคนอื่น เรียงตามดาว

อ่านการ์ด:★ ดาว GitHubiสามเสา: รีวิว · ผลตรวจ · การใช้งานiอัปเดต = วันที่ส่งรุ่นล่าสุดเข้า registryi

Supabase

โดย supabase

server ทางการของ Supabase ให้ AI สร้างตาราง ถามข้อมูล และดูการตั้งค่าโปรเจกต์ในฐานข้อมูล Supabase ของคุณ

บนเครื่องหรือคลาวด์★ 2,993Apache-2.0อัปเดต วันนี้
ติดตั้ง

MongoDB MCP Server

โดย mongodb-js

MongoDB Model Context Protocol Server

รันบนเครื่อง★ 1,157Apache-2.0อัปเดต เมื่อวานซืน
ติดตั้ง

Elasticsearch MCP Server

โดย cr7258

MCP server for interacting with Elasticsearch

รันบนเครื่อง★ 315Apache-2.0อัปเดต 14 เดือนที่ผ่านมา
ติดตั้ง

README จากผู้ทำ

เปิดอ่าน README

ส่วนนี้คัดจาก repo ของผู้ทำตามต้นฉบับ PopNx MCP ไม่ได้ตรวจหรือรับรองเนื้อหา ตัด HTML รูปภาพ และสคริปต์ออกแล้ว ลิงก์จะพาออกนอกเว็บ

English | 🌐 Português

Postgres MCP 🔌 Native MCP server for PostgreSQL - reads credentials from .env at runtime with flexible key mapping, configurable tool selection, and read-only mode by default .


✨ What it does

Most LLMs interact with databases by guessing - assuming table names, inventing column names, and writing queries that may fail or expose sensitive data. Postgres MCP solves this by giving the LLM a structured, safe interface to actually understand the database before touching it.

Built with @modelcontextprotocol/sdk and pg, it provides:

  • 🧠 Semantic knowledge graph - the LLM gets a complete map of schemas, tables, columns, foreign keys, inferred relations, risk levels, and business domains - built from the real schema, not invented
  • 🛡️ Read-only by default - no writes, no DDL, no arbitrary SQL unless you explicitly opt in; pg_classify_query_risk lets the LLM check a query's safety before running it
  • 🔐 Runtime credential resolution - credentials are read from .env at startup; nothing sensitive lives in mcp.json
  • 🎯 Explicit tool selection - every tool is opt-in via tool= args, so the LLM only sees what you choose to expose

📋 Requirements

  • ⚙️ Node.js >= 18
  • 📄 A .env file with database credentials (anywhere in the project tree - see .env Discovery)

🚀 Installation

There are two ways to use this package. Choose the one that best fits your workflow.

Option 1 - No installation (via npx, recommended for quick start)

No installation needed. npx downloads and runs the package on demand. Add -y as the first argument to skip the confirmation prompt.

{

"servers": { "Postgres Tools": { "type": "stdio", "command": "npx", "args": [ "-y", "@edelciomolina/postgres-mcp" ], "env": { "MCP_KEY_HOST": "DB_HOST", "MCP_KEY_PORT": "DB_PORT", "MCP_KEY_NAME": "DB_NAME", "MCP_KEY_SSLMODE": "DB_SSLMODE", "MCP_KEY_USER": "DB_USER", "MCP_KEY_PASS": "DB_PASS" } } } }

This starts the server with the default read-only tool set - no tool= arguments needed. To enable write-capable tools, see Write-capable tools.

💡 Using Supabase, Neon, Railway or another platform that only provides a connection string? Use MCP_KEY_URL pointing to DATABASE_URL (or whatever variable name the platform uses). The server will prioritize the URL and ignore the individual variables. See Connection via URL.


Option 2 - Install via VS Code (MCP extension marketplace)

VS Code supports discovering and installing MCP servers directly in the editor, without using the terminal.

  1. Open the Command Palette ( Cmd + Shift + P on Mac / Ctrl + Shift + P on Windows/Linux)
  2. Run `MCP: Add Server`
  3. Choose "Browse MCP Servers" (or "From registry", depending on your VS Code version)
  4. Search for `postgres-mcp` or `edelciomolina`
  5. Select Postgres MCP and follow the instructions - VS Code will add the entry to your mcp.json automatically

💡 You can also open the MCP Servers panel via Copilot chat icon → Manage MCP Servers to browse, enable, or disable servers at any time.

After installing, edit the generated entry in .vscode/mcp.json to add your tool= arguments and env key mappings as shown in the Usage section below.


🚀 Usage in VS Code (mcp.json)

Read-only (default - no `tool=` arguments needed):

{

"servers": { "Postgres Tools": { "type": "stdio", "command": "npx", "args": ["@edelciomolina/postgres-mcp"], "env": { "MCP_KEY_HOST": "DB_HOST", "MCP_KEY_PORT": "DB_PORT", "MCP_KEY_NAME": "DB_NAME", "MCP_KEY_SSLMODE": "DB_SSLMODE", "MCP_KEY_USER": "DB_USER", "MCP_KEY_PASS": "DB_PASS" } } } }

With write tools (explicit opt-in required):

{

"servers": { "Postgres Tools": { "type": "stdio", "command": "npx", "args": [ "@edelciomolina/postgres-mcp", "tool=pg_manage_schema", "tool=pg_manage_indexes" ], "env": { "POSTGRES_MCP_ALLOW_WRITE": "true", "MCP_KEY_HOST": "DB_HOST", "MCP_KEY_PORT": "DB_PORT", "MCP_KEY_NAME": "DB_NAME", "MCP_KEY_SSLMODE": "DB_SSLMODE", "MCP_KEY_USER": "DB_USER", "MCP_KEY_PASS": "DB_PASS" } } } }

⚠️ Write-capable tools require POSTGRES_MCP_ALLOW_WRITE=true in env. Without it, the server exits at startup.

The corresponding .env file at the root of your project:

DB_HOST=db.your-project.supabase.co

DB_PORT=5432 DB_NAME=postgres DB_SSLMODE=require DB_USER=readonly_user DB_PASS=your_password


⚙️ How mcp.json configuration works

🗝️ env - credential key mapping

The env block does not contain the actual credentials. It maps each MCP_KEY_* to the variable name in your .env file.

Key in envPoints to .env variableExample value
MCP_KEY_URLDATABASE_URLpostgresql://user:pass@host:5432/db?sslmode=require
MCP_KEY_HOSTDB_HOSTdb.example.supabase.co
MCP_KEY_PORTDB_PORT5432
MCP_KEY_NAMEDB_NAMEpostgres
MCP_KEY_SSLMODEDB_SSLMODErequire
MCP_KEY_USERDB_USERreadonly_user
MCP_KEY_PASSDB_PASSsecret

Priority: when MCP_KEY_URL (or DATABASE_URL) is present, the server uses the URL directly and ignores the individual credential keys.

This indirection lets you use any variable name in your .env - useful when sharing a .env across multiple services with different naming conventions.

🔧 args - tool selection via tool= prefix

Each enabled MCP tool is declared as a separate argument in the format tool= :

"args": [

"-y", "@edelciomolina/postgres-mcp", "tool=pg_manage_schema", "tool=pg_manage_indexes" ]

This makes the tool list explicit and auditable directly in mcp.json - no hidden configuration files. 🔍


🔗 Connection via URL (DATABASE_URL)

In addition to individual credentials, you can provide a full connection string - the standard format on platforms like Supabase, Neon, and Railway.

`.env`:

DATABASE_URL=postgresql://user:password@host:5432/database?sslmode=require

`mcp.json`:

{

"servers": { "Postgres Tools": { "type": "stdio", "command": "npx", "args": ["-y", "@edelciomolina/postgres-mcp"], "env": { "MCP_KEY_URL": "DATABASE_URL" } } } }

The variable mapped by MCP_KEY_URL has priority over the other keys (MCP_KEY_HOST, MCP_KEY_PORT, etc.). If the URL is present, the other variables are ignored.

If the platform uses a different name (e.g. DB_URL), just adjust the mapping:

"MCP_KEY_URL": "DB_URL"

🛡️ Why read-only is the default

If you omit all tool= arguments, the server starts with a curated read-only set - all tools that can retrieve, analyze, or explain data, but nothing that can modify it.

✅ Included in defaults (read-only):

pg_execute_query       pg_manage_query        pg_inspect_schema

pg_get_setup_instructions pg_analyze_database pg_monitor_database pg_debug_database pg_inspect_database_graph pg_describe_table_semantics pg_find_related_tables pg_classify_query_risk

💡 pg_execute_query rejects INSERT, UPDATE, DELETE, DDL, ANALYZE, VACUUM, EXPLAIN ANALYZE and other write/maintenance commands before the database is queried.

💡 pg_inspect_schema provides read-only schema introspection (get_info, get_enums). For DDL operations, use pg_manage_schema with explicit opt-in.

⚠️ Excluded from defaults - require `tool=` argument AND `POSTGRES_MCP_ALLOW_WRITE=true`:

ToolOperations
pg_manage_schemaCREATE TABLE, ALTER TABLE, CREATE TYPE
pg_manage_indexesCREATE INDEX, DROP INDEX, REINDEX
pg_manage_constraintsADD CONSTRAINT, DROP CONSTRAINT
pg_manage_functionsCREATE FUNCTION, DROP FUNCTION
pg_manage_triggersCREATE TRIGGER, DROP TRIGGER, enable/disable
pg_manage_rlsENABLE/DISABLE RLS, CREATE/ALTER/DROP POLICY
pg_manage_usersCREATE/DROP/ALTER USER, GRANT, REVOKE
pg_execute_mutationINSERT / UPDATE / DELETE / UPSERT
pg_execute_sqlArbitrary SQL with transaction support

📍 .env file discovery

The server resolves the .env file in this order:

  1. `env-file= ` argument - explicit path relative to cwd; takes priority over everything
  2. Upward search - starting from cwd, searches each parent directory until a .env is found or the filesystem root is reached

If no .env is found, the server exits with a clear error message.

Monorepos and subfolders

When VS Code starts the MCP process, cwd is typically the workspace root. If your .env is in a subfolder (e.g. functions/.env), use env-file= to point to it explicitly:

{

"servers": { "Postgres Tools": { "type": "stdio", "command": "npx", "args": [ "-y", "@edelciomolina/postgres-mcp", "env-file=functions/.env" ], "env": { "MCP_KEY_HOST": "DB_HOST", "MCP_KEY_PORT": "DB_PORT", "MCP_KEY_NAME": "DB_NAME", "MCP_KEY_SSLMODE": "DB_SSLMODE", "MCP_KEY_USER": "DB_USER", "MCP_KEY_PASS": "DB_PASS" } } } }

💡 The upward search behavior handles the common case automatically. Use env-file= when you need explicit control (CI, monorepos, Docker bind-mounts).


🧰 Available tools

Read-only (enabled by default)
ToolDescription
pg_execute_querySELECT / COUNT / EXISTS with write and multi-statement guards
pg_manage_queryEXPLAIN plans, slow query analysis, pg_stat_statements
pg_inspect_schemaSchema info and ENUM types (read-only introspection)
pg_get_setup_instructionsSetup instructions per platform
pg_analyze_databasePerformance, configuration, and storage analysis
pg_monitor_databaseReal-time monitoring of connections, queries, locks, and replication

| pg_debug_database | Diagnose connections, locks, performance, a

ตัดมาแค่ช่วงต้น อ่านต่อใน repo

ถาม PopNx