npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

easy-pg-admin-mcp

v0.1.1

Published

High privilege PostgreSQL admin MCP server for database and role management

Readme

easy-pg-admin-mcp

一個高權限的 PostgreSQL 管理型 MCP server,專門處理 database、role 與 database-level grants 管理。

這個專案的定位是 DBA 類工具,不提供任意 SQL 執行,也不處理 schema、table、view、index、trigger、function 管理。資料查詢與 schema/table 操作請使用 easy-pg-mcp

功能

  • 列出、建立、檢視 database,並修改 owner
  • 列出、建立、修改、刪除 PostgreSQL roles
  • 授予與撤銷 role membership
  • 授予與撤銷 database-level privileges
  • 對危險刪除操作提供短效確認 token

可用工具

| 工具 | 說明 | | --- | --- | | pg_list_databases | 列出目前 PostgreSQL instance 內的 databases | | pg_create_database | 建立 PostgreSQL database | | pg_describe_database | 檢視 PostgreSQL database | | pg_alter_database_owner | 修改 database owner | | pg_drop_database | 提出刪除 database 的請求並回傳確認 token | | pg_list_roles | 列出 PostgreSQL roles | | pg_create_role | 建立不支援 SUPERUSER 的 PostgreSQL role | | pg_alter_role_password | 修改 role 密碼 | | pg_alter_role_attributes | 修改支援的 role attributes | | pg_drop_role | 提出刪除 role 的請求並回傳確認 token | | pg_grant_role | 將 role 授予另一個 role | | pg_revoke_role | 從另一個 role 撤銷 role | | pg_show_role_memberships | 顯示 role membership | | pg_grant_privileges | 對 role 授予 database-level privileges | | pg_revoke_privileges | 從 role 撤銷 database-level privileges | | pg_show_grants | 顯示 role 的 database-level grants | | pg_confirm_task | 確認並執行先前產生的危險操作 token |

安全性

  • 不提供原始 SQL passthrough
  • 不處理 schema、table、view、index、trigger、function 管理
  • 不支援建立或修改 SUPERUSER role
  • pg_drop_databasepg_drop_role 一律要經過 pg_confirm_task
  • pg_drop_role 不提供 REASSIGN OWNEDDROP OWNED
  • confirmation token 是隨機產生、只能使用一次、且會在短時間後過期

設定

請使用環境變數設定,風格與其他 easy-*-mcp 專案一致。

| 變數 | 必填 | 預設值 | 說明 | | --- | --- | --- | --- | | PG_CONNECTION_STRING | 條件必填 | - | PostgreSQL connection string;提供時優先使用 | | PG_HOST | 條件必填 | - | 未提供 connection string 時使用的 PostgreSQL host | | PG_PORT | 否 | 5432 | PostgreSQL port | | PG_USER | 條件必填 | - | 未提供 connection string 時使用的 PostgreSQL admin role | | PG_PASSWORD | 否 | - | PostgreSQL 密碼 | | PG_DATABASE | 條件必填 | - | 管理連線使用的預設 database | | PG_CONNECTION_LIMIT | 否 | 10 | pool 最大 active connections | | PG_CONNECTION_TIMEOUT | 否 | 10000 | 建立 PostgreSQL 連線的逾時時間,單位毫秒 | | PG_IDLE_TIMEOUT | 否 | 30000 | idle connection timeout,單位毫秒 | | PG_ENABLE_KEEP_ALIVE | 否 | true | 是否啟用 TCP keep-alive | | PG_KEEP_ALIVE_INITIAL_DELAY | 否 | 0 | TCP keep-alive 初始延遲,單位毫秒 | | PG_SSL | 否 | false | 可使用 truefalseno-verify | | PG_ADMIN_TOKEN_TTL_SECONDS | 否 | 120 | confirmation token 的有效秒數 |

範例

PG_HOST=localhost
PG_PORT=5432
PG_USER=postgres
PG_PASSWORD=your_password
PG_DATABASE=postgres
PG_SSL=false
PG_ADMIN_TOKEN_TTL_SECONDS=120

Claude Desktop 範例

{
  "mcpServers": {
    "easy-pg-admin-mcp": {
      "command": "npx",
      "args": ["-y", "easy-pg-admin-mcp"],
      "env": {
        "PG_HOST": "localhost",
        "PG_PORT": "5432",
        "PG_USER": "postgres",
        "PG_PASSWORD": "your_password",
        "PG_DATABASE": "postgres",
        "PG_SSL": "false",
        "PG_ADMIN_TOKEN_TTL_SECONDS": "120"
      }
    }
  }
}

更新設定後,請重新啟動 Claude Desktop。

備註

  • pg_drop_databasepg_drop_role 不會直接執行
  • 這兩個動作會先產生 token,使用者確認後才會透過 pg_confirm_task 真正執行
  • token 是短效且單次使用,不會保留成長期 pending queue