PostgreSQL Analyzer MCP Server

PostgreSQL performance analysis and optimization MCP server

Local serverstdioPython

What is the PostgreSQL Analyzer MCP Server?

PostgreSQL performance analysis and optimization MCP server

What you get

A Model Context Protocol (MCP) server for PostgreSQL database performance analysis and optimization.

PostgreSQL Analyzer MCP is a powerful tool that leverages AI to help database administrators and developers optimize their PostgreSQL databases. It provides comprehensive analysis of database structure, query performance, index usage, and configuration settings, along with actionable recommendations for improvement.

  • Database Structure Analysis — Analyze tables, columns, indexes, and foreign keys
  • Query Performance Analysis — Analyze execution plans and identify bottlenecks
  • Index Recommendations — Get suggestions for new indexes based on query patterns
  • Query Optimization — Receive suggestions for query rewrites to improve performance
  • Slow Query Identification — Find and analyze slow-running queries
  • Database Health Dashboard — Get a comprehensive overview of database health metrics

Configuration and credentials

  • Python 3.12+ (or Docker) - Amazon Aurora or RDS PostgreSQL database - AWS account (for Secrets Manager, optional)

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Maintainer setup documentation.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
analyze_database_structureAnalyze database schema and provide optimization recommendations
get_slow_queriesIdentify slow-running queries in the database
analyze_queryAnalyze a SQL query and provide optimization recommendations
recommend_indexesRecommend indexes for a given SQL query
suggest_query_rewriteSuggest optimized rewrites for a SQL query
database_health_dashboardGenerate a comprehensive health dashboard for the database
query_optimization_wizardInteractive wizard to optimize a SQL query step by step
analyze_index_usageAnalyze index usage patterns and identify unused or inefficient indexes
execute_read_only_queryExecute a read-only SQL query and return the results
show_postgresql_settingsShow PostgreSQL configuration settings with optional filtering
health_checkCheck if the server is running and responsive

Configuration

  • Python 3.12+ (or Docker) - Amazon Aurora or RDS PostgreSQL database - AWS account (for Secrets Manager, optional)
VariableDescriptionRequired
AWS_ACCESS_KEY_IDCredential the server authenticates with.Yes
AWS_SECRET_ACCESS_KEYCredential the server authenticates with.Yes
AWS_DEFAULT_REGIONConfiguration value read at startup.Optional

Example prompts to try

  • “Use PostgreSQL Analyzer MCP to analyze database structure.”
  • “Use PostgreSQL Analyzer MCP to get slow queries.”
  • “Use PostgreSQL Analyzer MCP to analyze query.”

Frequently asked questions

Yes, it operates in read-only mode by default. All database connections use `SET TRANSACTION READ ONLY` to prevent accidental modifications, and query execution is limited to SELECT, EXPLAIN, and SHOW commands.