PostgreSQL performance Tuner MCP Server — Claude Code MCP server
MCP server that diagnoses PostgreSQL slow queries and tests hypothetical indexes using HypoPG without writing to disk.
claude mcp add pgtuner-mcp -- uvx pgtuner-mcpWhat PostgreSQL performance Tuner MCP Server does
The server connects to PostgreSQL using the DATABASE_URI environment variable and gathers telemetry from catalog tables. It pulls resource-heavy queries from pg_stat_statements and inspects EXPLAIN ANALYZE outputs. It also tracks lock waits and stalled transactions. A dedicated check monitors autovacuum progress and identifies temporary file spills caused by low work_mem.
Index optimization relies on the HypoPG extension. It builds virtual indexes inside session memory, allowing the planner to test cost reductions before writing changes to disk. Bloat tracking requires pgstattuple.
Without catalog read access such as the pg_read_all_stats role, the server cannot collect query metrics.
What it helps with
- extract slow queries from
pg_stat_statementswith execution stats - test virtual index impact via
HypoPGwithout allocating storage - diagnose autovacuum progress and identify bloated tables
- inspect lock contention and long-running transactions
Example prompts for the agent
- Inspect slow queries in
pg_stat_statementsand point out execution bottlenecks - Simulate a candidate index on the orders table using
HypoPGand show the plan diff - Check autovacuum activity and report tables that require immediate vacuuming
How to install PostgreSQL performance Tuner MCP Server
Platform CLI
claude mcp add pgtuner-mcp -- uvx pgtuner-mcpuvx runs the command named after the package; if the README names another one, use uvx --from pgtuner-mcp <command>
Platform CLI
codex mcp add postgresql-performance-tuner-mcp-server -- uvx pgtuner-mcpuvx runs the command named after the package; if the README names another one, use uvx --from pgtuner-mcp <command>
Config file
{
"mcpServers": {
"postgresql-performance-tuner-mcp-server": {
"command": "uvx",
"args": [
"pgtuner-mcp"
]
}
}
}uvx runs the command named after the package; if the README names another one, use uvx --from pgtuner-mcp <command>
Config file
{
"servers": {
"postgresql-performance-tuner-mcp-server": {
"type": "stdio",
"command": "uvx",
"args": [
"pgtuner-mcp"
]
}
}
}uvx runs the command named after the package; if the README names another one, use uvx --from pgtuner-mcp <command>
Platform CLI
gemini mcp add postgresql-performance-tuner-mcp-server uvx pgtuner-mcpuvx runs the command named after the package; if the README names another one, use uvx --from pgtuner-mcp <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about PostgreSQL performance Tuner MCP Server
How do I install PostgreSQL performance Tuner MCP Server in Claude Code?
Run claude mcp add pgtuner-mcp -- uvx pgtuner-mcp in your terminal and configure the DATABASE_URI connection string.
What does this MCP server do?
It equips the assistant with diagnostic tools for PostgreSQL to detect query bottlenecks, verify configuration settings, and simulate indexes.
Is the HypoPG extension required?
Standard query and vacuum monitoring operate without it, but simulating prospective indexes requires hypopg on the target database.