Skip to content

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 02 Dec 07:06
· 7 commits to main since this release
c36417d

The first public release of pg-doctor: an MCP server that lets AI agents diagnose PostgreSQL without being able to change it.

Install

# Claude Code plugin (skill, subagent, /pg-health command)
claude plugin marketplace add alaev-dev/pg-doctor && claude plugin install pg-doctor@pg-doctor

# any MCP client over stdio: a binary from this release, go install, or the image
go install github.com/alaev-dev/pg-doctor/cmd/pg-doctor@v0.2.0
claude mcp add pg-doctor -- docker run -i --rm -e DATABASE_URL=postgres://pgdoctor:...@host:5432/app ghcr.io/alaev-dev/pg-doctor:0.2.0

Give it a role with pg_monitor and nothing else. Try it on a deliberately broken database with docker compose up -d (see the README).

What is in it

  • 8 read-only tools: slow_queries, explain_statement (by queryid, never by text), list_tables, describe_table, table_bloat, blocking_locks, replication_status, unused_indexes. Plus 2 prompts: diagnose_slow_database, investigate_locks.
  • Read-only by construction. No tool accepts SQL. Sessions are read-only with a 5 s statement timeout. Tools return statistics, never rows, and query text only with literals already replaced by $1.
  • Prompt-injection defence. A comment that tells the agent to drop a table and keep quiet never made Claude drop anything, but it kept Claude silent in 3 of 3 runs. Warnings placed next to the text helped in 1 of 5. pg-doctor now withholds database text that addresses AI agents, and 5 of 5 runs told the user.
  • Remote mode. Streamable HTTP with static tokens or OAuth 2.0 introspection (RFC 7662), per-token scopes, per-token rate limits, a JSON audit log and OpenTelemetry traces down to each SQL statement.
  • Evals. 6 scenarios plant real faults in PostgreSQL. Claude Code investigates them through MCP, and deterministic checks plus an LLM judge grade the answers. Last run: 17 of 18 trials solved (94%, 95% CI 74–99%). See evals/README.md.

Artifacts

  • Binaries for Linux, macOS and Windows on amd64 and arm64, with checksums.txt.
  • Image ghcr.io/alaev-dev/pg-doctor:0.2.0 for linux/amd64 and linux/arm64: distroless, nonroot, 7.7 MB.

Full history: https://github.com/alaev-dev/pg-doctor/commits/v0.2.0