postgresai plugin
A Claude Code plugin sets up PostgreSQL monitoring and returns a report of problems with exact fixes.
- 140 ★ on the repository
- Last commit
Broad access
Why this level
- Works with database credentials, creates a monitoring role on it and leads to a paid service subscription.
Install
- Works in
In your terminal, with SkillFoxx CLI
npx skillfoxx add plugins/postgresaiDetects the agents on your machine, shows the access level and pins the version.
Other ways to install
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- Works with database credentials, creates a monitoring role on it and leads to a paid service subscription.
This is third-party code. Review the repository files before installing.
What it does
The pgai plugin adds the `postgresai` skill and the `/pgai:checkup` and `/pgai:issues` commands to Claude Code. Asked to check a database, the agent sets up PostgresAI monitoring, finds problems and lists them from the worst to the lightest, each with a concrete fix. Under the hood the `postgresai` CLI works: the express check `npx postgresai checkup` runs more than 45 checks on indexes, table bloat, queries, settings and security and returns a model-friendly JSON report. The full stack collects metrics through pgwatch and shows 13 Grafana dashboards. A separate MCP server, `npx postgresai mcp install`, opens issues and action items from console.postgres.ai to the agent.
Who it is for. Developers and DBAs on PostgreSQL 14–18 who ask an agent to find why a database is slow and want fixes instead of raw metrics.
Good fit when
- Queries have slowed down and you need a prioritised database review.
- Indexes and table bloat are checked before a release.
- A JSON report is piped to a model through `claude -p` so it can suggest `DROP INDEX` or a migration.
- Database tasks live in console.postgres.ai and the agent works with them through MCP.
Not a fit when
- You may not hand database credentials to a third-party service.
- The database is not PostgreSQL or its version is outside 14–18.
- Docker cannot be installed on the server for the full monitoring stack.
Example request
Check the health of the database `postgresql://app@db.internal:5432/main`, list problems from the most serious and propose fixes.Limitations
Express checks need Node.js 18 or newer and network access to the database. The full stack needs Linux with Docker and the `pg_stat_statements` extension. The `postgresai` skill flow asks where the database lives, checks the connection and confirms a paid PostgresAI subscription per cluster. Without registration only the express check and a manual stack install work. It is safer to pass the password through `~/.pgpass` than `PGPASSWORD`. The `prepare-db` command creates a monitoring role on the database.
How to disable. Remove the plugin with `claude plugin uninstall pgai@postgresai`. Stop monitoring on the server with the `postgresai mon` CLI commands and drop the monitoring role in the database itself.
FAQ
How do I install postgresai in Claude Code?
Run `claude plugin marketplace add postgres-ai/postgresai` and `claude plugin install pgai@postgresai`. For other agents install the skill with `npx skills add postgres-ai/postgresai --skill postgresai`.
Do I need an account on console.postgres.ai?
Not for the express check or a self-deployed stack: both modes are open. The skill and the console issues work through a PostgresAI account.
What does /pgai:checkup do?
It runs `postgresai checkup` with your connection string and adds a short summary of the most serious problems and next steps to the report.
How do I connect the postgresai MCP server?
`npx postgresai mcp install` configures the server for Claude Code, Cursor or Windsurf. It opens console issues and action items to the agent.
Which PostgreSQL versions are supported?
14 through 18. The express check needs Node.js 18 or newer and network access to the database.
Discussion
No questions or reviews yet.
Related
PluginsMCP PostgreSQL Ops selects metrics for the PostgreSQL version, exposing measurements available in that database installation.
A Rust MCP server for pgmoneta: the agent asks the PostgreSQL backup manager about backup state and manages backups
A local dashboard for Claude Code, Codex CLI, Gemini CLI, Copilot and OpenCode that shows tokens, cost, latency and errors
Diffinery plugins connect Claude Code and Codex to self-hosted Git, pull requests and CI on Cloudflare through an MCP server
BetterDB MCP
BetterDB Monitor
BetterDB MCP server: the agent reads Valkey and Redis metrics, slow commands, hot keys and anomalies and investigates incidents from stored history
The official Railway plugin: the use-railway skill and a hosted MCP server for deploys, variables, domains, logs and tracing from your agent
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| postgresai (this card) | no | 140 | ||
| Postgres MCP Pro | no | API key | 3,456 | an MCP server for queries, EXPLAIN plans and indexes; postgresai deploys monitoring and returns a report with fixes |
| MCP PostgreSQL Ops | no | not required | 164 | picks metrics for the PostgreSQL version; postgresai runs the whole loop from checkup to a fix list |
README in short
The repository is part of the Self-Driving Postgres initiative and draws on the PostgresAI team's experience. The short alias `pgai` works as `postgresai`, and `bunx` replaces `npx` when Bun is installed.