mcpField
P
pgcloud

pgcloud

Local
github.com/CloudCorpRecordsDatabases0Updated 2w ago

About pgcloud

pgcloud is a CLI and MCP server for managing Neon Postgres projects and databases. It combines project and branch administration with SQL inspection and a two-phase workflow for testing migrations or query tuning on temporary branches before applying changes.

Key features

  1. 01Manage projects and branches
  2. 02Run SQL and transactions
  3. 03Inspect tables and query plans
  4. 04Review slow queries
  5. 05Prepare and apply migrations
  6. 06Test query tuning on temporary branches

Use cases

  1. 01Create a development branch
  2. 02Run queries against a project database
  3. 03Inspect slow queries and execution plans
  4. 04Test schema changes before applying them

MCP support

It runs as a stdio MCP server and exposes Neon project, branch, SQL, migration, and tuning operations as tools for MCP clients. The same tools are also available as CLI subcommands.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"cloudcorprecords-pgcloud": {
"command": "npx",
"args": [
"-y",
"@reneturcios/pgcloud"
]
}
}
}
Run commandnpx -y @reneturcios/pgcloud

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@reneturcios/pgcloud0.1.0
ocighcr.io/cloudcorprecords/pgcloud:0.1.0

Tools

20

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
limitnumberNoMaximum number of Neon projects to return.
org_idstringNoOptional Neon organization ID; when given, only projects belonging to that organization are listed.
searchstringNoOptional search term to filter projects by name.

Details

From the project 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

npx @reneturcios/pgcloud list_projects

Or run the container image:

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:

export NEON_API_KEY=<your Neon API key>

pgcloud list_projects
pgcloud 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:

npx -y @reneturcios/pgcloud mcp

MCP client configuration:

{
  "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

npm install
npm 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.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.