Pgcloud

io.github.CloudCorpRecords由 GitHub 帳號 CloudCorpRecords 發布v0.1.0更新於 Nov 1, 2026

Neon Postgres projects, branches, SQL, and migrations from your MCP client.

已驗證STDIO僅桌面資料庫雲端與基礎設施

概覽

AI 產生的概覽

在 MCP 用戶端中管理 Neon Postgres 的專案、分支與 SQL,並支援在臨時分支上分兩階段執行遷移與查詢調校。

可以做什麼
  • 列出、檢視、建立與刪除 Neon 專案、分支及運算端點,並列出組織
  • 對專案資料庫執行單一 SQL 陳述式或多陳述式交易
  • 檢視資料表與欄位結構、列出 pg_stat_statements 中的慢查詢,並取得 EXPLAIN 執行計畫
  • 在臨時分支上準備遷移或查詢調校工作階段,再套用到原分支或捨棄
  • 解析資料庫的 Postgres 連線字串,可選擇連線池模式
適用情境
適合讓助理直接操作 Neon Postgres 帳號:瀏覽資料表結構、執行查詢、分析慢查詢與執行計畫,或透過較安全的臨時分支流程進行結構變更。
執行需求
透過 npx 或 Docker 映像以 stdio 在本機執行。需將 Neon API 金鑰放入 NEON_API_KEY 環境變數,缺少時所有呼叫都會失敗。需要能連線至 Neon API 以及資料庫主機的 HTTP SQL 端點。
安裝前請注意
此 API 金鑰可存取整個 Neon 帳號,並以 Bearer 權杖形式傳送。工具可建立與刪除專案和分支、執行任意 SQL,並將遷移或調校變更套用到主分支,因此有寫入與刪除風險。遷移與調校工作階段保存在伺服器行程內,必須由準備它的同一行程完成。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Pgcloud,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

pgcloud

pgcloud puts a Neon Postgres account within reach of an MCP client or a terminal. Projects and their branches can be listed, described, created, and deleted; compute endpoints and organizations can be inspected; and any database in a project can be queried directly — single statements, multi-statement transactions, table and column introspection, slow-query reports, and execution plans. Schema changes follow Neon's two-phase pattern: a migration or tuning session is prepared on a temporary branch, exercised there, and only then completed onto the original branch.

A Neon API key is required. Put it in the NEON_API_KEY environment variable; it is sent to the Neon API as a Bearer token and never appears in output. When the variable is missing, every call fails with an error that names it.

Install

bash
npx @reneturcios/pgcloud list_projects

Or run the container image:

bash
docker run -i -e NEON_API_KEY ghcr.io/cloudcorprecords/pgcloud

The container defaults to the MCP server (see below). Pass CLI arguments to use it as a CLI instead.

CLI

Every MCP tool is also a CLI subcommand. Tool arguments are passed as one JSON object with --json:

bash
export NEON_API_KEY=<your Neon API key>
pgcloud list_projectspgcloud list_projects --json '{"limit": 5, "search": "billing"}'pgcloud describe_project --json '{"projectId": "snowy-pond-12345678"}'pgcloud create_branch --json '{"projectId": "snowy-pond-12345678", "branchName": "dev"}'pgcloud run_sql --json '{"projectId": "snowy-pond-12345678", "sql": "select now()"}'pgcloud get_connection_string --json '{"projectId": "snowy-pond-12345678", "pooled": true}'
pgcloud --version

Results print as JSON. Exit codes: 0 on success, 1 when an API or SQL call fails (including a missing NEON_API_KEY), 2 for usage errors.

MCP server

One bin serves both faces. The mcp subcommand starts a stdio MCP server:

bash
npx -y @reneturcios/pgcloud mcp

MCP client configuration:

json
{  "mcpServers": {    "pgcloud": {      "command": "npx",      "args": ["-y", "@reneturcios/pgcloud", "mcp"],      "env": { "NEON_API_KEY": "your Neon API key" }    }  }}

Tools

ToolInput (required in bold)What it does
list_projectslimit, search, org_idLists projects in the account.
describe_projectprojectIdDescribes one project.
create_projectname, region_id, org_idCreates a project.
delete_projectprojectIdDeletes a project and its resources.
create_branchprojectId, branchName, parentBranchIdCreates a branch with a read-write compute.
delete_branchprojectId, branchIdDeletes a branch.
describe_branchprojectId, branchIdBranch record plus its databases.
list_branch_computesprojectId, branchIdLists compute endpoints.
list_organizationssearchLists organizations the user can access.
get_connection_stringprojectId, branchId, databaseName, roleName, pooledResolves a Postgres connection string.
run_sqlsql, projectId, branchId, databaseName, roleNameRuns one SQL statement.
run_sql_transactionsql (array), projectId, …Runs statements in one transaction.
get_database_tablesprojectId, branchId, databaseNameLists tables via information_schema.
describe_table_schemaprojectId, tableName, …Lists a table's columns.
list_slow_queriesprojectId, limit, …Slowest queries from pg_stat_statements.
explain_sql_statementsql, projectId, …Returns the EXPLAIN plan for a statement.
prepare_database_migrationmigrationSql, projectId, …Runs migration SQL on a temporary branch.
complete_database_migrationmigrationId, projectId, …Applies a prepared migration to the original branch.
prepare_query_tuningsql, projectId, …Opens a tuning session on a temporary branch with the plan.
complete_query_tuningtuningId, projectId, applyChangesCloses a tuning session, applying or discarding.

Management calls go to https://api.neon.tech/api/v2. SQL calls first resolve the branch's connection URI from the API, then POST the statement to the database host's HTTP SQL endpoint with the URI in the Neon-Connection-String header; SQL text is passed through as given. Migration and tuning sessions are held in the server process, so a session must be completed by the same process that prepared it.

Development

bash
npm installnpm run build   # tsc -> dist/npm test        # node test runner over test/*.test.ts, no network (fake fetch fixtures)npm run dev     # run the CLI from source via tsx

License

MIT — see LICENSE.

來源:README.md,提交 67b8c9e

工具

20

list_projects

List all Neon projects in your account.

輸入參數limitorg_idsearch

describe_project

Describes a Neon project

輸入參數projectId必填

create_project

Create a new Neon project.

輸入參數nameorg_idregion_id

delete_project

Delete a Neon project

輸入參數projectId必填

create_branch

Create a branch in a Neon project

輸入參數projectId必填branchNameparentBranchId

delete_branch

Delete a branch from a Neon project

輸入參數branchId必填projectId必填

describe_branch

Get a tree view of all objects in a branch, including databases, schemas, tables, views, and functions

輸入參數branchId必填projectId必填

list_branch_computes

List compute endpoints for a project or a specific branch, including compute ID, type, and size.

輸入參數branchIdprojectId必填

list_organizations

List all organizations that the current user has access to, optionally filtered by a search term.

輸入參數search

get_connection_string

Get a PostgreSQL connection string for a Neon database with all parameters being optional

輸入參數pooledbranchIdroleNameprojectId必填databaseName

run_sql

Execute a single SQL statement against a Neon database.

輸入參數sql必填branchIdroleNameprojectId必填databaseName

run_sql_transaction

Execute a SQL transaction against a Neon database, should be used for multiple SQL statements.

輸入參數sql必填branchIdroleNameprojectId必填databaseName

get_database_tables

Get all tables in a Neon database

輸入參數branchIdprojectId必填databaseName

describe_table_schema

Describe the schema of a table in a Neon database

輸入參數branchIdprojectId必填tableName必填databaseName

list_slow_queries

List slow queries from pg_stat_statements, ordered by mean execution time.

輸入參數limitbranchIdprojectId必填databaseName

explain_sql_statement

Describe the PostgreSQL query execution plan for a SQL statement by running EXPLAIN in the database

輸入參數sql必填branchIdprojectId必填databaseName

prepare_database_migration

Perform a database schema migration by executing the given SQL on a temporary branch for safety, ready to complete onto the main branch.

輸入參數branchIdprojectId必填databaseNamemigrationSql必填

complete_database_migration

Complete a database migration when the user confirms the migration is ready to be applied to the main branch.

輸入參數projectId必填migrationId必填databaseName

prepare_query_tuning

Analyze a slow query or DML statement on a temporary branch, returning its execution plan to suggest optimizations.

輸入參數sql必填branchIdprojectId必填databaseName

complete_query_tuning

Complete a query tuning session by either applying the changes to the main branch or discarding them.

輸入參數tuningId必填projectId必填applyChanges必填

版本歷史

1
  1. v0.1.0最新Nov 1, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分