IP

isdaniel/pgtuner_mcp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

30 stars 5 forks 品質 78 トレンド 15Apache-2.0

provides AI-powered PostgreSQL performance tuning capabilities.

概要

A Model Context Protocol (MCP) server that provides AI-powered PostgreSQL performance tuning capabilities. This server helps identify slow queries, recommend optimal indexes, analyze execution plans, and leverage HypoPG for hypothetical index testing. - Retrieve slow queries from pg_stat_statements with detailed statistics - Analyze query execution plans with EXPLAIN and EXPLAIN ANALYZE - Identify performance bottlenecks with automated plan analysis - Monitor active queries and detect long-running transactions - AI-powered index recommendations based on query workload analysis - Hypothetical index testing with extension (no disk usage) - Find unused and duplicate indexes for cleanup - Estimate index sizes before creation - Test query plans with proposed indexes before implementing - Comprehensive health scoring with multiple checks - Connection utilization monitoring - Cache hit ratio analysis (buffer and index) - Lock contention detection - Vacuum health and transaction ID...

README

以下は原文 README の抜粋です。原文を見る。

PostgreSQL Performance Tuning MCP

A Model Context Protocol (MCP) server that provides AI-powered PostgreSQL performance tuning capabilities. This server helps identify slow queries, recommend optimal indexes, analyze execution plans, and leverage HypoPG for hypothetical index testing.

Features

Query Analysis

  • Retrieve slow queries from pg_stat_statements with detailed statistics
  • Analyze query execution plans with EXPLAIN and EXPLAIN ANALYZE
  • Identify performance bottlenecks with automated plan analysis
  • Monitor active queries and detect long-running transactions

Index Tuning

  • AI-powered index recommendations based on query workload analysis
  • Hypothetical index testing with HypoPG extension (no disk usage)
  • Find unused and duplicate indexes for cleanup
  • Estimate index sizes before creation
  • Test query plans with proposed indexes before implementing

Database Health

  • Comprehensive health scoring with multiple checks
  • Connection utilization monitoring
  • Cache hit ratio analysis (buffer and index)
  • Lock contention detection
  • Vacuum health and transaction ID wraparound monitoring
  • Replication lag monitoring
  • Background writer and checkpoint analysis

Vacuum Monitoring

  • Track long-running VACUUM and VACUUM FULL operations in real-time
  • Monitor autovacuum progress and performance
  • Identify tables that need vacuuming
  • View recent vacuum activity history
  • Analyze autovacuum configuration effectiveness

I/O Performance Analysis

  • Analyze disk read/write patterns across tables and indexes
  • Identify I/O bottlenecks and hot tables
  • Monitor buffer cache hit ratios
  • Track temporary file usage indicating work_mem issues
  • Analyze checkpoint and background writer I/O
  • PostgreSQL 16+ enhanced pg_stat_io metrics support

Configuration Analysis

  • Review PostgreSQL settings by category
  • Get recommendations for memory, checkpoint, WAL, autovacuum, and connection settings
  • Identify suboptimal configurations

MCP Prompts & Resources

  • Pre-defined prompt templates for common tuning workflows
  • Dynamic resources for table stats, index info, and health checks
  • Comprehensive documentation resources

Installation

Standard Installation (for MCP clients like Claude Desktop)

GitHub で README 全文を見る

インストール

docker run -p 8080:8080 \
MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "pgtuner_mcp": { "command": "python", "args": ["-m", "pgtuner_mcp"], "env": { "DATABASE_URI": "postgresql://user:password@localhost:5432/mydb" }, "disabled": false, "autoApprove": [] } } }