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 分