pgconsole

by pgplex

Not rated
GitHub

About

Postgres specific MCP server with governed access

Details

Author
pgplex
Categories
Database

Setup

Install pgconsole in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/pgplex/pgconsole

Follow the installation instructions in the repository README, then restart your MCP client.

[!NOTE] pgplex: The Postgres Toolchain for Humans and Agents -pgconsole·pgschema·pgtui·pgparser

Brought to you byBytebase, open-source database governance platform.

pgconsoleis a web-based PostgreSQL editor. Single binary, single config file, no database required. Connect your team to PostgreSQL with access control and audit logging built in.

Visithttps://docs.pgconsole.com/getting-started/quickstart

npm install -g @pgplex/pgconsole pgconsole --config pgconsole.toml
npx @pgplex/pgconsole --config pgconsole.toml
docker run -p 9876:9876 -v /path/to/pgconsole.toml:/etc/pgconsole.toml pgplex/pgconsole

Run without--configto start in demo mode with a bundled sample database.

A full-featured SQL workspace for writing, running, editing, and inspecting PostgreSQL, with parser-powered intelligence in the editor.

- Autocomplete— context-aware suggestions for tables, columns, joins, and CTEs
- Formatting— pretty-print or collapse SQL to one line
- Error detection— red underlines with hover tooltips
- Code folding— collapseSELECT,WITH, and other blocks
- Function signature help— parameter hints as you type
- Result grid & inline editing— virtual-scrolling query results with staged edits, generated SQL previews, and optional AI risk assessment before execution
- Schema browser— inspect tables, views, materialized views, functions, and procedures with metadata, indexes, constraints, triggers, and grants

Generate, explain, fix, and rewrite SQL with an AI assistant that understands your schema context. Supports OpenAI, Anthropic, and Google providers.

- Text-to-SQL— describe a query in natural language, get SQL back
- Explain SQL— get plain-language explanations of any query
- Fix SQL— AI-powered error correction from inline linting
- Rewrite SQL— optimize queries for performance or readability
- Risk assessment— analyze staged changes for potential risks before execution

Expose your Postgres connections to external AI agents (Claude, Cursor, IDEs, CI bots) over theModel Context Protocol— without handing out raw database credentials. Agents connect to a remote MCP endpoint and inherit the same IAM, permission, and audit controls as human users.

- Remote & token-authenticated— a Streamable HTTP endpoint at/mcp; each agent authenticates withAuthorization: Bearer <token>
- Two agent kinds— apureservice account (authorized byagent:<id>IAM rules) or adelegatedagent that acts on behalf of a user, optionally capped to fewer permissions or connections
- Permission-shaped tools— every agent canlist_connections; catalog tools (list_objects,describe_table) appear once it has an accessible connection, and execution tools unlock per grant:explain_query(explain),query(read),write_data(write),run_ddl(ddl)
- Same governance as the UI— every statement runs through per-statement SQL permission detection, default-deny IAM, and the audit log

# A standalone agent, authorized via [[iam]] just like a user [[agents]] id = "ci-bot" name = "CI Pipeline" token = "generate-a-long-random-secret" # openssl rand -hex 32 [[iam]] connection = "staging" permissions = ["read", "ddl"] members = ["agent:ci-bot"]

Fine-grained IAM controls who can read, write, or administer each connection. Permissions are enforced at the application layer — no database roles needed.

- Default deny— users have no access unless a rule explicitly grants it
- Connection-scoped— permissions are granted per connection, not globally
- Disjoint permissionsread,write,ddl,admin,explain,execute,exportare independent

Every query and login is recorded as structured JSON to stdout. Filter and forward to your log infrastructure.

{ "type": "audit", "ts": "2024-01-15T10:32:15.456Z", "action": "sql.execute", "actor": "alice@example.com", "connection": "prod-db", "sql": "SELECT  FROM users WHERE active = true", "duration_ms": 45, "row_count": 150 }

Everything lives inpgconsole.toml— connections, users, groups, access rules, AI providers. No database required.

[[connections]] id = "production" name = "Production" host = "db.example.com" port = 5432 database = "myapp" username = "readonly" password = "..." [[iam]] connection = "production" permissions = ["read", "explain", "export"] members = [""] [[iam]] connection = "production" permissions = ["*"] members = ["group:dba"] [[ai.providers]] id = "claude" vendor = "anthropic" model = "claude-sonnet-4-20250514" api_key = "sk-ant-..."

[!NOTE]For external contributors: If you want to request a feature, please create a GitHub issue to discuss first instead of creating a PR directly.

git clone https://github.com/pgplex/pgconsole.git cd pgconsole pnpm install pnpm dev # Start dev server (frontend + backend) pnpm build # Production build pnpm test # Run all tests

Bytebase- open source, web-based database DevSecOps platform.

Official Airtable MCP server and skills for working with bases, records, workflows, and business operations from AI agents.

MCP Server For Apache Doris, an MPP-based real-time data warehouse.

Official MCP Server from Atlan which enables you to bring the power of metadata to your AI tools

Query Onchain data, like ERC20 tokens, transaction history, smart contract state.

Read and write access to your Baserow tables.

Introspect and query your apps deployed to Convex.

Interact with the data stored in Couchbase clusters using natural language.

Maritime intelligence for tracking vessels, analysing ports, and exploring ship data.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.