MCP ExplorerExplorer

Mcp Perfromance Insights Analyzer

@vgodwinamzon 18 days ago
1 MIT
FreeCommunity
AI Systems
MCP server for PostgreSQL performance analysis using StreamableHTTP.

Overview

What is Mcp Perfromance Insights Analyzer

mcp-performance-insights-analyzer is a streamlined MCP server implementation designed for PostgreSQL performance analysis. It utilizes the StreamableHTTP protocol to provide tools for analyzing PostgreSQL performance metrics.

Use cases

Use cases include retrieving Aurora Performance Insights data, analyzing slow queries from Aurora Performance Insights, and performing health checks on the server to ensure it is running properly.

How to use

To use mcp-performance-insights-analyzer, install the required dependencies using ‘pip install -r requirements.txt’. Start the server with the command ‘python server.py --port 8000 --host 0.0.0.0’. You can interact with the server through its API endpoints.

Key features

Key features include the use of the StreamableHTTP protocol instead of SSE, integration with PostgreSQL Performance Insights, standalone implementation without external dependencies, and compatibility with the MCP client protocol.

Where to use

mcp-performance-insights-analyzer can be used in environments where PostgreSQL database performance needs to be monitored and analyzed, such as in cloud services, enterprise applications, and database management systems.

Content

PostgreSQL Performance Insights MCP Server

A streamlined MCP server implementation that provides PostgreSQL performance analysis tools using the StreamableHTTP protocol.

Features

  • Uses StreamableHTTP protocol instead of SSE
  • Integrates with PostgreSQL Performance Insights
  • Standalone implementation with no external MCP server dependencies
  • Compatible with the MCP client protocol

Installation

  1. Install dependencies:
pip install -r requirements.txt

Usage

Start the server:

python server.py --port 8000 --host 0.0.0.0

Command-line options

  • --port: Port to run the server on (default: 8000)
  • --host: Host to bind the server to (default: 0.0.0.0)
  • --request-timeout: Request timeout in seconds (default: 300)

Available Tools

The server provides tools for Aurora Performance Insights:

  • aurora_performance_insights: Get Aurora Performance Insights data
  • aurora_slow_queries: Get slow queries from Aurora Performance Insights
  • health_check: Check if the server is running properly

API Endpoints

  • /mcp: Main endpoint for MCP communication (POST)
  • /health: Health check endpoint (GET)
  • /sessions: Show active sessions (GET)

StreamableHTTP Protocol

The StreamableHTTP protocol is a bidirectional communication protocol that uses HTTP requests for both client-to-server and server-to-client communication. Unlike SSE, which requires a persistent connection, StreamableHTTP uses standard HTTP requests and responses.

Client-to-Server Communication

Clients send JSON-RPC requests to the /mcp endpoint:

{
  "jsonrpc": "2.0",
  "id": "request-id",
  "method": "tool-name",
  "params": {
    "param1": "value1",
    "param2": "value2"
  }
}

Server-to-Client Communication

The server responds with JSON-RPC responses:

{
  "jsonrpc": "2.0",
  "id": "request-id",
  "result": "result data"
}

Or error responses:

{
  "jsonrpc": "2.0",
  "id": "request-id",
  "error": {
    "code": -32603,
    "message": "Internal error"
  }
}

Session Management

Sessions are managed using the X-MCP-Session-ID header. If not provided, a new session ID is generated. The session ID is returned in the response headers and should be included in subsequent requests to maintain the session.

Tools

No tools

Comments