Pg Checkup
Read-only PostgreSQL health checks for AI assistants, with prioritized fixes and SQL
Pg Checkup is an open-source MCP server for databases. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, API, Self-hosted
- Runs
- Locally
- Access
- Needs a secret key or token
- Version
- 0.1.0
- Listing updated
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add pg-checkup --env DATABASE_URL='<DATABASE_URL>' -- npx -y pg-checkup-mcpAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"pg-checkup": {
"command": "npx",
"args": [
"-y",
"pg-checkup-mcp"
],
"env": {
"DATABASE_URL": "<DATABASE_URL>"
}
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"pg-checkup": {
"command": "npx",
"args": [
"-y",
"pg-checkup-mcp"
],
"env": {
"DATABASE_URL": "<DATABASE_URL>"
}
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"pg-checkup": {
"command": "npx",
"args": [
"-y",
"pg-checkup-mcp"
],
"env": {
"DATABASE_URL": "<DATABASE_URL>"
}
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"pg-checkup": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"pg-checkup-mcp"
],
"env": {
"DATABASE_URL": "<DATABASE_URL>"
}
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add pg-checkup --env DATABASE_URL='<DATABASE_URL>' -- npx -y pg-checkup-mcpOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.pg-checkup]
command = "npx"
args = ["-y", "pg-checkup-mcp"]
env = { DATABASE_URL = "<DATABASE_URL>" }Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"pg-checkup": {
"command": "npx",
"args": [
"-y",
"pg-checkup-mcp"
],
"env": {
"DATABASE_URL": "<DATABASE_URL>"
}
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "pg-checkup": { "command": "npx", "args": [ "-y", "pg-checkup-mcp" ], "env": { "DATABASE_URL": "<DATABASE_URL>" } } } }Or run: gemini mcp add -s user -e DATABASE_URL='<DATABASE_URL>' pg-checkup npx -- -y pg-checkup-mcp
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "pg-checkup": { "command": "npx", "args": [ "-y", "pg-checkup-mcp" ], "env": { "DATABASE_URL": "<DATABASE_URL>" } } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "pg-checkup": { "command": "npx", "args": [ "-y", "pg-checkup-mcp" ], "env": { "DATABASE_URL": "<DATABASE_URL>" } } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "pg-checkup": { "command": "npx", "args": [ "-y", "pg-checkup-mcp" ], "env": { "DATABASE_URL": "<DATABASE_URL>" } } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "pg-checkup": { "command": "npx", "args": [ "-y", "pg-checkup-mcp" ], "env": { "DATABASE_URL": "<DATABASE_URL>" } } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "pg-checkup": { "command": "npx", "args": [ "-y", "pg-checkup-mcp" ], "env": { "DATABASE_URL": "<DATABASE_URL>" } } } }The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.
Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "pg-checkup": { "command": "npx", "args": [ "-y", "pg-checkup-mcp" ], "env": { "DATABASE_URL": "<DATABASE_URL>" } } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "pg-checkup": { "command": "npx", "args": [ "-y", "pg-checkup-mcp" ], "env": { "DATABASE_URL": "<DATABASE_URL>" } } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
Configuration
DATABASE_URLConnection string of a statistics-only login (pg-checkup role prints the SQL to create one). Read from the environment; never sent through the chat.Required
About Pg Checkup
Connects to a PostgreSQL database using a statistics-only login and returns a prioritized list of problems, grouped into fix now, fix next and watch. Findings cover bloat, missing or unused indexes, slow queries, blocked transactions, sequences nearing their limit and several row-level security issues. When one problem causes another, the root cause is listed first.
The server runs its queries in a read-only session with a 15-second timeout per query and reads only statistics views and the catalog, never table rows. The connection string is read from the environment rather than passed through the chat, and every query it runs can be printed for review.
It suits developers and database administrators who want an AI assistant to triage a database before or after a migration, or to compare checkups over time. It can also be run from the command line or on a schedule in GitHub Actions.
What it does
- Prioritized findings
- Problems are sorted into fix now, fix next and watch groups, with causes listed before their effects.
- Read-only sessions
- Queries run in a read-only session with a per-query timeout and never read table rows.
- Index analysis
- Flags missing, invalid, unused and duplicate indexes along with slow and sequential scans.
- Row-level security review
- Finds tables without row-level security, overlapping policies and SECURITY DEFINER functions missing a search_path.
- Migration baseline and verify
- Saves schema, grants and policies before a migration and reports what changed afterward.
- Visible query log
- Prints every SQL statement the tool executes so the activity can be reviewed.
Good for
- Triage a production PostgreSQL database for bloat, slow queries and blocked transactions
- Ask an AI assistant which database fixes to apply first and get the SQL for each
- Compare checkups over time to confirm fixes and catch new regressions
- Check schema, grants and policies before and after a database migration
- Run scheduled database health checks in GitHub Actions with failure thresholds
Pricing
Open source
Open source; licence in the repository's LICENSE file.
More servers for the same service
Pg Checkup FAQ
What access does Pg Checkup need on the database?
It works with a login that holds the pg_monitor role, which only allows reading statistics. The server prints the SQL needed to create such a login.
Can Pg Checkup modify my database?
No. The session is read-only, and the tool does not read table rows or make network calls other than to the database.
Which PostgreSQL versions are supported?
The CLI requires Node 18 or newer and PostgreSQL 12 or newer.
How is the database connection string provided?
It is read from the DATABASE_URL environment variable and is not sent through the chat.
Is Pg Checkup free?
Yes. Pg Checkup is open source, so you can use and self-host it for free.
How do I add Pg Checkup to Claude Code?
Run this command in your terminal: claude mcp add pg-checkup --env DATABASE_URL='<DATABASE_URL>' -- npx -y pg-checkup-mcp
What are the best alternatives to Pg Checkup?
The closest alternatives to Pg Checkup are PostgreSQL Performance (read-only), PostgreSQL (hardened, read-only), Postgres Scout MCP, PostgreSQL performance Tuner MCP Server and MCP Database Doctor.
Where this comes from
- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.

