list_connectionsLABSCO SUMMARY
The agent gets a token and a grant, not your database password.
The usual way to give an agent Postgres is to paste a connection string, at which point the permissions are the database user's and the audit trail says nothing about who asked. Here the agent is its own principal with its own grants, the tool list it sees is the shape of those grants, and every statement it runs is parsed and checked before execution and then recorded with the tool name and the agent. Two practical notes: results on the MCP route are capped at 1000 rows so a broad SELECT cannot flood the context, and a delegated agent can never exceed the person it acts for.
What it is
Pgconsole is a web-based PostgreSQL editor — a single binary and a single config file, with no database of its own to run — that gives a team access control and audit logging over shared Postgres connections. Its MCP server exposes those same connections to external agents such as Claude Code, Cursor, VS Code Copilot and CI bots over a Streamable HTTP endpoint at /mcp. The point is that the agent never receives database credentials: it presents a token, resolves to a defined principal, and every statement it sends goes through the same permission checks and audit trail as a human clicking Run.
What you get
list_connections— the connections this agent can reach, each with the permissions granted on itlist_objects— browse a connection's catalog; without a schema it lists schemas with counts, with one it returns a paginated, filterable list of tables and views including kind, estimated rows, size and commentdescribe_table— one table or view in full: columns, primary and foreign keys, indexes, constraints and commentsexplain_query— plan a singleSELECT, withanalyze,buffersandformatoptions; unlocked by theexplainpermissionquery— read-only statements, unlocked byread, capped at 1000 rows withtruncated: trueand the realrowCountreported when the cap biteswrite_data—INSERT,UPDATE,DELETEandCOPY, unlocked bywriterun_ddl—CREATE,ALTER,DROP,GRANT,REVOKEand the rest, unlocked byddl- A tool list shaped by permissions: an agent is only shown the tools its grants unlock, so an agent with
readnever sees a way to write - Statement-level enforcement rather than trust: the SQL is parsed and each statement's required permission must match the tool it arrived through, so a
DROPsent toquery— or a mixed batch — is refused before the database is touched - Two kinds of principal: a pure agent authorised by
agent:<id>IAM rules, or a delegated agent actingon_behalf_ofa user, which inherits that user's permissions, can be narrowed further, and loses access when the user does
Requirements
Node.js 20+, a running pgconsole instance, and the Postgres connections you want reachable defined in pgconsole.toml. Each agent is an [[agents]] entry with an id and a token; clients send it as Authorization: Bearer <token> and requests without a valid one get 401. One thing to set deliberately: if no [[iam]] rules exist at all, IAM is off and agents can reach every connection — define at least one rule to bring least privilege into effect. Install with npm install -g @pgplex/pgconsole and run pgconsole --config pgconsole.toml, use npx, or run the pgplex/pgconsole container on port 9876. Starting it without --config opens a demo mode with a bundled sample database.
Setup effort
One command plus a key — npm install -g @pgplex/pgconsole, then supply credentials
USE CASES
Giving a coding agent read access to a production database
Create a delegated agent bounded to one user, capped to read on one connection; it can query and describe, and the write tools never appear.
Letting a CI bot run migrations against staging
A pure agent with ddl on the staging connection only; DDL sent to any other connection is refused, and the run shows up in the audit log tagged to that agent.
Exploring a schema nobody documented
List schemas with counts, filter down to the tables you care about, then read one table's keys, indexes and constraints in full.
Checking a query's plan before it runs anywhere real
Plan a single SELECT with the options you need; running with analyze executes it, so it additionally requires every permission the statement itself would.
Answering "who ran that?" a week later
Every MCP statement is recorded with the tool name and the agent — for a delegated agent, under the user it acted for.
7 tools
Listed in project docs. Your client may show a different list.
list_objectsdescribe_tableexplain_queryquerywrite_datarun_ddlBEFORE YOU INSTALL
What to know first
Tools you get
7 tools named in the project's documentation.
Requires
- npm on PATH
- Node.js 20+
INSTALLATION
Connect your client
Server setup
npm install -g @pgplex/pgconsoleMCP Clients
Claude Code
claude mcp add --transport http pgconsole <YOUR_PGCONSOLE_URL>/mcp \
--header "Authorization: Bearer <YOUR_PGC_MCP>"