The MCP Server provides AI assistants (like Claude) with tools to interact with your observability stack. It enables file operations, database management, metrics queries, and service health checks through a standardized protocol.
Description
This MCP Server is a custom implementation that bridges AI assistants with your Django observability stack. It provides:
File Operations - Read/write/list project files
Database Operations - Full CRUD on PostgreSQL (Todo app)
Metrics Queries - Prometheus metrics for server resources
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP SERVER WORKING PROCESS β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β 1. STARTUP β
β βββββββββββ β
β MCP Server starts via stdio (not HTTP) β
β Reads .env for credentials β
β β
β 2. TOOL REGISTRATION β
β βββββββββββββββββββ β
β Server registers all available tools with AI β
β AI knows what tools are available β
β β
β 3. TOOL EXECUTION β
β βββββββββββββββ β
β AI calls a tool β MCP Server executes β Returns result β
β β
β 4. DATABASE OPERATIONS β
β ββββββββββββββββββββ β
β Connects to PostgreSQL (todo_todo table) β
β Full CRUD support β
β β
β 5. METRICS QUERIES β
β βββββββββββββββββββ β
β Queries Prometheus API for metrics β
β Returns formatted results β
β β
β 6. GRAFANA INTEGRATION β
β βββββββββββββββββββββββ β
β Lists dashboards, alerts, datasources β
β Returns formatted output β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Example Usage
Database Operations
# Get todo statisticsget_todo_stats()β"π Todo Statistics\n Total: 10\n Completed: 5\n Pending: 5"# List all todoslist_todos(status="all",limit=20)# Create a todocreate_todo(title="Learn MCP")# Update a todoupdate_todo(id=1,title="Updated title",completed=True)# Delete a tododelete_todo(id=1)
Prometheus Metrics
# Get server resources (CPU, Memory, Disk)get_server_resources(minutes=30)# Get Django metricsget_django_metrics(minutes=30)# Custom PromQL queryprometheus_query(query="up")
Grafana
# List dashboardsget_grafana_dashboards()# Get alertsget_grafana_alerts()# Get datasourcesget_grafana_datasources()
Service Health
# Check all servicescheck_service_health()# Get full status dashboardget_full_status(minutes=30)
Running the MCP Server
Direct Execution
# Run the MCP serverpythonmcp_filesystem_server.py
With Claude Desktop
Add to your Claude config (typically ~/Library/Application Support/Claude/claude_desktop_config.json):