Safe, audited PostgreSQL operations for AI agents: queries, migrations, EXPLAIN, containers
MCPpedia last refreshed this data
io.github.arzharch/pgops-mcp is an MCP server that safe, audited PostgreSQL operations for AI agents: queries, migrations, EXPLAIN, containers. Its tool list has not been published yet over stdio, sse and http, requires no API key, and scores 82/100 on MCPpedia's security, maintenance and efficiency rubric.
Config is the same across clients - only the file and path differ.
{
"mcpServers": {
"pgops": {
"env": {
"PGOPS_DSN": "postgresql://user:pass@localhost:5432/mydb"
},
"args": [
"pgops-mcp"
],
"command": "uvx"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
Safe, audited PostgreSQL operations for AI agents: queries, migrations, EXPLAIN, containers
Run this in your terminal to verify the server starts. Then let us know if it worked - your result helps other developers.
uvx 'pgops-mcp' 2>&1 | head -1 && echo "✓ Server started successfully"
After testing, let us know if it worked:
Five weighted categories - click any category to see the underlying evidence.
No known CVEs.
Checked pgops-mcp against OSV.dev.
Click any tool to inspect its schema.
Be the first to review
Have you used this server?
Share your experience - it helps other developers decide.
Sign in to write a review.
Others in developer-tools / data
XcodeBuildMCP provides tools for Xcode project management, simulator management, and app utilities.
Manage Supabase projects — databases, auth, storage, and edge functions
Token-efficient database MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite
MCP server for using the GitLab API
MCP Security Weekly
Get CVE alerts and security updates for io.github.arzharch/pgops-mcp and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
Let an AI assistant operate your PostgreSQL database — without letting it wreck anything.
Point Claude, Cursor, or VS Code at a database and ask questions in plain English. Your assistant gets 18 tools for inspecting schemas, running queries, diagnosing slow ones, and planning migrations. What it does not get is a way to quietly destroy your data.
Every number below is real output from the demo database in this repo — 1.2M rows, 114 MB.
You: I want to index
orders.status
Assistant: (calls
migration.plan)
CREATE INDEX "idx_orders_status" ON "orders" (status)
risk=medium estimate=4000ms confidence=medium
blocks: writes yes, reads no
SAFER: CREATE INDEX CONCURRENTLY "idx_orders_status" ON "orders" (status)
Assistant: A plain index build blocks writes for roughly 4 seconds.
CONCURRENTLYis slower overall but keeps writes working. Which do you want?
The tool didn't return a raw plan for the model to interpret — it returned a verdict, a duration estimate with an honest confidence level, and the safer alternative.
query.explain works the same way. Instead of handing back JSON, it says things like:
planner overestimated rows by 5833x (estimated 239,160, actual 40)
-> run ANALYZE; if it persists the columns may be correlated, consider CREATE STATISTICS
You: clear out the orders table
Assistant: (calls
query.writewithDELETE FROM orders)
CONFIRMATION_REQUIRED
DELETE has no WHERE clause and would affect every row in the table
Where your client supports it, the approval prompt goes to you — not to the assistant. Nothing runs until a human answers, and the refusal is written to the audit log whether or not you approve.
That last part is the point. The assistant cannot approve its own dangerous action, because it is not the one being asked. Where a client can't show a prompt, it degrades to a single-use token bound to that exact statement — never to "allowed".
Most Postgres MCP servers are thin query wrappers: introspect and SELECT. None handle
migrations with lock-impact analysis, none diagnose performance from EXPLAIN and
pg_stat_statements, and none understand the container the database runs in. Agents
operating databases today are doing it blind, and without guardrails.
pgops-mcp is the operations brain: schema intelligence → guarded queries → migration
engine → performance diagnosis → environment awareness, with a safety architecture that
makes every action classifiable, confirmable, and auditable.
Native AI/ML Extension Support: Because pgops builds on core Postgres catalogs rather than brittle regex parsing, it inherits native support for custom types and extensions like pgvector. Tools like migration.plan and query.explain understand vector types (vector(384)) and hnsw indexes out of the box, with zero configuration.
New here? docs/GETTING_STARTED.md is a 15-minute guided tour that assumes no MCP knowledge.
| Group | Tools |
|---|---|
| Schema | schema.inspect |
| Queries | query.read, query.write (guarded), query.explain (parsed plan + verdict) |
| Performance | index.advise, db.health |
| Migrations | migration.plan (dry-run + lock analysis), migration.describe (plain English), migration.apply, migration.rollback, migration.history |
| Environment | env.topology, env.correlate, container.logs, container.stats |
| Gated | container.restart, container.exec |
* Not registered at all unless the server runs with --approval-mode, and even then
each call needs a confirmation token. container.exec additionally enforces a read-only
diagnostic command allowlist — it does not offer a shell. The