PostgreSQL Analyzer MCP
About
PostgreSQL performance analysis and optimization MCP server
Details
- Author
- rameshv29
- GitHub stars
- 2
- Downloads
- 242
- Categories
- Database
Jump to
- Database structure analysis (tables, columns, indexes, foreign keys)
- Query performance analysis with execution plans and bottleneck identification
- Index recommendations based on query patterns
- Query optimization suggestions and rewrites
- Slow query identification and analysis
- Database health dashboard with comprehensive metrics
- Index usage analysis (unused, duplicate, bloated indexes)
- Read-only query execution (SELECT, EXPLAIN, SHOW only)
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
PostgreSQL Analyzer MCPCommand (node, npx, python, etc.)Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
Install locally (Python 3.12+, pip) or via Docker. Start the server with python src/main.py or by running the Docker container. Point your MCP client to http://your-server:8000/mcp using Streamable HTTP transport. Database credentials can be provided via AWS Secrets Manager (recommended) or directly when calling tools.
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"postgresql analyzer mcp": {
"postgreSQL-analyzer-mcp": {
"command": "python",
"args": [
"-m",
"venv",
"venv"
]
}
}
}
}
McpServers
{
"postgreSQL-analyzer-mcp": {
"command": "python",
"args": [
"-m",
"venv",
"venv"
]
}
}
PostgreSQL Analyzer MCP
A Model Context Protocol (MCP) server for PostgreSQL database performance analysis and optimization.
Overview
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.
This tool runs as a remote MCP server using Streamable HTTP transport, allowing it to be deployed centrally and accessed by any MCP-compatible client, including Amazon Q Developer CLI, Claude and other AI assistants that support the MCP protocol.
⚠️ Disclaimer
EXPERIMENTAL: This project is experimental and provided as a demonstration of what's possible with MCP and PostgreSQL. All recommendations and code should be carefully reviewed before implementation in any production environment.
NOT OFFICIAL: This is a personal project and not affiliated with, endorsed by, or representative of any organization I work for or contribute to. All opinions and approaches are my own.
NO LIABILITY: This tool is provided "as is" without warranty of any kind. Use at your own risk. The author is not liable for any damages or issues arising from the use of this software.
Features
- 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
- Index Usage Analysis: Identify unused, duplicate, or bloated indexes
- Read-Only Query Execution: Safely execute read-only queries for verification
Security
This tool operates in read-only mode by default. All database connections are established with SET TRANSACTION READ ONLY to prevent any accidental modifications to your database. The query execution functionality is strictly limited to SELECT, EXPLAIN, and SHOW commands.
Installation
Prerequisites
- Python 3.12+ (or Docker)
- Amazon Aurora or RDS PostgreSQL database
- AWS account (for Secrets Manager, optional)
Setup
Option 1: Local Setup
1. Clone the repository:
git clone https://github.com/yourusername/postgres-performance-mcp.git
cd postgres-performance-mcp
2. Create virtual environment and Install dependencies:
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Option 2: Docker Setup
1. Clone the repository:
git clone https://github.com/yourusername/postgres-performance-mcp.git
cd postgres-performance-mcp
2. Build the Docker image:
docker build -t postgres-analyzer-mcp -f Dockerfile .
3. Run the Docker container:
docker run -p 8000:8000 postgres-analyzer-mcp
For AWS credentials (if using Secrets Manager):
docker run -p 8000:8000 \
-e AWS_ACCESS_KEY_ID=your_access_key \
-e AWS_SECRET_ACCESS_KEY=your_secret_key \
-e AWS_DEFAULT_REGION=your_region \
postgres-analyzer-mcp
3. Configure your database credentials:
- Option 1: Store credentials in AWS Secrets Manager (recommended)
- Option 2: Provide credentials directly when using the tools
Usage
Starting the Server
Local:
python src/main.py --host 0.0.0.0 --port 8000
Docker:
```bashSign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



