Skip to content
Back to search

pgconsole

Minimal Postgres editor for speed, collaboration, and AI

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/pgplex--pgconsole/badge.svg)](/listings/pgplex--pgconsole)

HTML

<a href="/listings/pgplex--pgconsole"><img src="/api/listings/pgplex--pgconsole/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Visit https://docs.pgconsole.com/getting-started/quickstart

Prerequisites

- Node.js 20+

npm

npm install -g @pgplex/pgconsole
pgconsole --config pgconsole.toml

npx

npx @pgplex/pgconsole --config pgconsole.toml

Docker

docker run -p 9876:9876 -v /path/to/pgconsole.toml:/etc/pgconsole.toml pgplex/pgconsole

Run without `--config` to start in demo mode with a bundled sample database.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 203 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. > [!NOTE]
  2. > pgplex: The Postgres Toolchain for Humans and Agents - **pgconsole** · [pgschema](https://github.com/pgplex/pgschema) · [pgtui](https://github.com/pgplex/pgtui) · [pgparser](https://github.com/pgplex/pgparser)
  3. >
  4. > Brought to you by [Bytebase](https://www.bytebase.com/), open-source database governance platform.
  5. ![](https://raw.githubusercontent.com/pgplex/website/refs/heads/main/public/banner-pgconsole.png)
  6. <table align="center"><tr><td>
  7. <img src="https://raw.githubusercontent.com/pgplex/pgconsole/main/website/public/sql-editor-overview.webp" alt="pgconsole SQL editor" />
  8. </td></tr></table>
  9. **pgconsole** is 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.
  10. <a href="https://www.star-history.com/?repos=pgplex%2Fpgconsole&type=date&legend=top-left">
  11. <picture>
  12. <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=pgplex/pgconsole&type=date&theme=dark&legend=top-left" />
  13. <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=pgplex/pgconsole&type=date&legend=top-left" />
  14. <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=pgplex/pgconsole&type=date&legend=top-left" />
  15. </picture>
  16. </a>
  17. ## Installation
  18. Visit https://docs.pgconsole.com/getting-started/quickstart
  19. ### Prerequisites
  20. - Node.js 20+
  21. ### npm
  22. ```bash
  23. npm install -g @pgplex/pgconsole
  24. pgconsole --config pgconsole.toml
  25. ```
  26. ### npx
  27. ```bash
  28. npx @pgplex/pgconsole --config pgconsole.toml
  29. ```
  30. ### Docker
  31. ```bash
  32. docker run -p 9876:9876 -v /path/to/pgconsole.toml:/etc/pgconsole.toml pgplex/pgconsole
  33. ```
  34. Run without `--config` to start in demo mode with a bundled sample database.
  35. ## Features
  36. ### SQL Editor
  37. A full-featured SQL workspace for writing, running, editing, and inspecting PostgreSQL, with parser-powered intelligence in the editor.
  38. - **Autocomplete** — context-aware suggestions for tables, columns, joins, and CTEs
  39. - **Formatting** — pretty-print or collapse SQL to one line
  40. - **Error detection** — red underlines with hover tooltips
  41. - **Code folding** — collapse `SELECT`, `WITH`, and other blocks
  42. - **Function signature help** — parameter hints as you type
  43. - **Result grid & inline editing** — virtual-scrolling query results with staged edits, generated SQL previews, and optional AI risk assessment before execution
  44. - **Schema browser** — inspect tables, views, materialized views, functions, and procedures with metadata, indexes, constraints, triggers, and grants
  45. <table><tr><td>
  46. <img src="https://raw.githubusercontent.com/pgplex/pgconsole/main/docs/images/features/sql-editor/sql-editor-autocomplete.webp" alt="Autocomplete" />
  47. </td></tr></table>
  48. <table><tr><td>
  49. <img src="https://raw.githubusercontent.com/pgplex/pgconsole/main/docs/images/features/sql-editor/sql-editor-staged-changes.webp" alt="Staged changes preview" />
  50. </td></tr></table>
  51. <table><tr><td>
  52. <img src="https://raw.githubusercontent.com/pgplex/pgconsole/main/docs/images/features/sql-editor/sql-editor-schema-tab.webp" alt="Schema browser" />
  53. </td></tr></table>
  54. ### AI Assistant
  55. Generate, explain, fix, and rewrite SQL with an AI assistant that understands your schema context. Supports OpenAI, Anthropic, and Google providers.
  56. - **Text-to-SQL** — describe a query in natural language, get SQL back
  57. - **Explain SQL** — get plain-language explanations of any query
  58. - **Fix SQL** — AI-powered error correction from inline linting
  59. - **Rewrite SQL** — optimize queries for performance or readability
  60. - **Risk assessment** — analyze staged changes for potential risks before execution
  61. <table><tr><td>
  62. <img src="https://raw.githubusercontent.com/pgplex/pgconsole/main/docs/images/features/ai-assistant/ai-text-to-sql.webp" alt="AI Text-to-SQL" />
  63. </td></tr></table>
  64. <table><tr><td>
  65. <img src="https://raw.githubusercontent.com/pgplex/pgconsole/main/docs/images/features/ai-assistant/ai-risk-assessment.webp" alt="AI risk assessment" />
  66. </td></tr></table>
  67. ### MCP Server
  68. Expose your Postgres connections to external AI agents (Claude, Cursor, IDEs, CI bots) over the [Model Context Protocol](https://modelcontextprotocol.io) — 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.
  69. - **Remote & token-authenticated** — a Streamable HTTP endpoint at `/mcp`; each agent authenticates with `Authorization: Bearer <token>`
  70. - **Two agent kinds** — a *pure* service account (authorized by `agent:<id>` IAM rules) or a *delegated* agent that acts on behalf of a user, optionally capped to fewer permissions or connections
  71. - **Permission-shaped tools** — every agent can `list_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`)
  72. - **Same governance as the UI** — every statement runs through per-statement SQL permission detection, default-deny IAM, and the audit log
  73. ```toml
  74. # A standalone agent, authorized via [[iam]] just like a user
  75. [[agents]]
  76. id = "ci-bot"
  77. name = "CI Pipeline"
  78. token = "generate-a-long-random-secret" # openssl rand -hex 32
  79. [[iam]]
  80. connection = "staging"
  81. permissions = ["read", "ddl"]
  82. members = ["agent:ci-bot"]
  83. ```
  84. ### Database Access Control
  85. Fine-grained IAM controls who can read, write, or administer each connection. Permissions are enforced at the application layer — no database roles needed.
  86. - **Default deny** — users have no access unless a rule explicitly grants it
  87. - **Connection-scoped** — permissions are granted per connection, not globally
  88. - **Disjoint permissions** — `read`, `write`, `ddl`, `admin`, `explain`, `execute`, `export` are independent
  89. <table><tr><td>
  90. <img src="https://raw.githubusercontent.com/pgplex/pgconsole/main/docs/images/features/database-access-control/iam-permission-denied.webp" alt="Permission denied" />
  91. </td></tr></table>
  92. <table><tr><td>
  93. <img src="https://raw.githubusercontent.com/pgplex/pgconsole/main/docs/images/features/database-access-control/iam-permission-badge.webp" alt="Permission badge" />
  94. </td></tr></table>
  95. ### Audit Log
  96. Every query and login is recorded as structured JSON to stdout. Filter and forward to your log infrastructure.
  97. ```json
  98. {
  99. "type": "audit",
  100. "ts": "2024-01-15T10:32:15.456Z",
  101. "action": "sql.execute",
  102. "actor": "alice@example.com",
  103. "connection": "prod-db",
  104. "sql": "SELECT * FROM users WHERE active = true",
  105. "duration_ms": 45,
  106. "row_count": 150
  107. }
  108. ```
  109. ### Single-File Configuration
  110. Everything lives in `pgconsole.toml` — connections, users, groups, access rules, AI providers. No database required.
  111. ```toml
  112. [[connections]]
  113. id = "production"
  114. name = "Production"
  115. host = "db.example.com"
  116. port = 5432
  117. database = "myapp"
  118. username = "readonly"
  119. password = "..."
  120. [[iam]]
  121. connection = "production"
  122. permissions = ["read", "explain", "export"]
  123. members = ["*"]
  124. [[iam]]
  125. connection = "production"
  126. permissions = ["*"]
  127. members = ["group:dba"]
  128. [[ai.providers]]
  129. id = "claude"
  130. vendor = "anthropic"
  131. model = "claude-sonnet-4-20250514"
  132. api_key = "sk-ant-..."
  133. ```
  134. ## Getting Help
  135. - [Docs](https://www.pgconsole.com)
  136. - [GitHub Issues](https://github.com/pgplex/pgconsole/issues)
  137. ## Development
  138. > [!NOTE]
  139. > **For external contributors**: If you want to request a feature, please create a GitHub issue to discuss first instead of creating a PR directly.
  140. ```bash
  141. git clone https://github.com/pgplex/pgconsole.git
  142. cd pgconsole
  143. pnpm install
  144. pnpm dev # Start dev server (frontend + backend)
  145. pnpm build # Production build
  146. pnpm test # Run all tests
  147. ```
  148. ## Sponsor
  149. [Bytebase](https://www.bytebase.com?utm_sourcepgconsole) - open source, web-based database DevSecOps platform.
  150. <a href="https://www.bytebase.com?utm_sourcepgconsole"><img src="https://raw.githubusercontent.com/pgplex/pgschema/main/docs/images/bytebase.webp" /></a>

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.