Skip to main content
Glama
Observability MCP Server

Observability MCP Server

Observability MCP Server

📖 Installation Guide · PRD · Changelog · FastMCP status

FastMCP 3.3+ control plane for unified fleet monitoring (Grafana / Prometheus / Loki on port 12000)

FastMCP OpenTelemetry Prometheus Grafana Loki GitHub

MCP + web UI for the unified observability stack in mcp-central-docs/monitoring (host 12000–12006). Agents get Grafana/Loki/Prometheus tools; humans get a Charts dashboard picker at :12008 that explains boards in plain language. See MONITORING_CURRENT_SETUP.


Quick Start

git clone https://github.com/sandraschi/observability-mcp
cd observability-mcp
just

This opens an interactive dashboard showing all available commands. Run just bootstrap to install dependencies, then just serve or just dev to start.

Manual Setup

If you don't have just installed:

Related MCP server: poly-observability-mcp

Features

FastMCP 3.3+ Integration

  • OpenTelemetry Integration - Distributed tracing and metrics collection

  • Enhanced Storage Backend - Persistent metrics and historical data

  • Production-Ready - Built for high-performance monitoring

Comprehensive Monitoring

  • Real-time Health Checks - Monitor MCP server availability and response times

  • Performance Metrics - CPU, memory, disk, and network monitoring with Prometheus

  • Distributed Tracing - Track interactions across MCP server ecosystems

  • Centralized Logging - Loki-powered log aggregation and querying

  • Intelligent Alerting - Anomaly detection and automated alerts

  • Performance Reports - Automated analysis and optimization recommendations

Advanced Analytics

  • Usage Pattern Analysis - Understand how MCP servers are being used

  • Trend Detection - Identify performance trends and bottlenecks

  • Log Correlation - Correlate metrics with Loki logs for root cause analysis

  • Optimization Insights - Data-driven recommendations for improvement

  • Multi-Format Export - Prometheus, Loki, OpenTelemetry, and JSON export


Installation

Prerequisites

  • uv installed (RECOMMENDED)

  • Python 3.12+

Quick Start

Run immediately via uvx:

uvx observability-mcp

Claude Desktop Integration

Add to your claude_desktop_config.json:

"mcpServers": {
  "observability-mcp": {
    "command": "uv",
    "args": ["--directory", "D:/Dev/repos/observability-mcp", "run", "observability-mcp"]
  }
}

Prerequisites

  • Python 3.11+

  • FastMCP 3.3++ (automatically installed)

Install from Source

git clone https://github.com/sandraschi/observability-mcp
cd observability-mcp
uv pip install -e .

Installation

Prerequisites

  • uv installed (RECOMMENDED)

  • Python 3.12+

Quick Start

Run immediately via uvx:

uvx observability-mcp

Claude Desktop Integration

Add to your claude_desktop_config.json:

"mcpServers": {
  "observability-mcp": {
    "command": "uv",
    "args": ["--directory", "D:/Dev/repos/observability-mcp", "run", "observability-mcp"]
  }
}

Quick Start

1. Start the Server

# Using the CLI
observability-mcp run

# Or directly with Python
python -m observability_mcp.server

Installation

Prerequisites

  • uv installed (RECOMMENDED)

  • Python 3.12+

Quick Start

Run immediately via uvx:

uvx observability-mcp

Claude Desktop Integration

Add to your claude_desktop_config.json:

"mcpServers": {
  "observability-mcp": {
    "command": "uv",
    "args": ["--directory", "D:/Dev/repos/observability-mcp", "run", "observability-mcp"]
  }
}

3. Configure Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "observability": {
      "command": "observability-mcp",
      "args": ["run"]
    }
  }
}

Available Tools

Health Monitoring

  • monitor_server_health - Real-time health checks with OpenTelemetry metrics

  • monitor_system_resources - Comprehensive system resource monitoring

Performance Analysis

  • collect_performance_metrics - CPU, memory, disk, and network metrics

  • generate_performance_reports - Automated performance analysis and recommendations

  • analyze_mcp_interactions - Usage pattern analysis and optimization insights

Log Management & Loki Integration

  • send_logs_to_loki - Send custom log entries to Loki for centralized aggregation

  • query_loki_logs - Query logs from Loki with advanced LogQL filtering

  • analyze_log_patterns - Analyze log patterns, anomalies, and trends

  • correlate_logs_and_metrics - Correlate Loki logs with Prometheus metrics

Alerting & Anomaly Detection

  • alert_on_anomalies - Intelligent anomaly detection and alerting

  • trace_mcp_calls - Distributed tracing for MCP server interactions

Data Export

  • export_metrics - Export metrics in Prometheus, OpenTelemetry, or JSON formats


Configuration

Environment Variables

# Prometheus metrics server port
PROMETHEUS_PORT=12009

# Loki configuration
LOKI_URL=http://127.0.0.1:12002
LOG_FILE=/tmp/observability-mcp.log

# OpenTelemetry service name
OTEL_SERVICE_NAME=observability-mcp

# OTLP exporter endpoint (optional)
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

# Metrics retention period (days)
METRICS_RETENTION_DAYS=30

Alert Configuration

The server comes with pre-configured alerts for common issues:

  • CPU Usage > 90% (Warning)

  • Memory Usage > 1GB (Error)

  • Error Rate > 5% (Error)

Alerts are stored persistently and can be customized through the MCP tools.


Monitoring Dashboard

Prometheus Metrics

Access metrics at: http://127.0.0.1:12009/metrics

Available metrics:

# Health checks
mcp_health_checks_total{status="healthy|degraded|unhealthy", service="..."} 1

# Performance metrics
mcp_performance_metrics_collected{service="..."} 1

# System resources
mcp_cpu_usage_percent{} 45.2
mcp_memory_usage_mb{} 1024.5

# Traces and alerts
mcp_traces_created{service="...", operation="..."} 1
mcp_alerts_triggered{type="active|anomaly"} 1

Integration with Grafana & Loki

Grafana Dashboards are State-of-the-Art for Observability

  1. Add Data Sources in Grafana:

  2. Import Dashboards:

    • Import the provided mcp-observability.json dashboard

    • Customize panels for your specific MCP ecosystem

  3. Log Integration:

    • Query logs with Loki: {job="observability-mcp"} |= "ERROR"

    • Correlate metrics with logs for comprehensive troubleshooting

Why Grafana + Loki = SOTA Observability:

  • Unified View: Single pane of glass for metrics, logs, and traces

  • Powerful Queries: PromQL + LogQL for complex analysis

  • Rich Visualizations: State-of-the-art dashboards with real-time updates

  • Alert Integration: Native alerting with multiple notification channels


Architecture

FastMCP 3.3+ Features Leveraged

OpenTelemetry Integration

  • Distributed Tracing: Track requests across multiple MCP servers

  • Metrics Collection: Structured performance data collection

  • Context Propagation: Maintain context across service boundaries

Enhanced Persistent Storage

  • Historical Data: Store metrics and traces for trend analysis

  • Cross-Session Persistence: Data survives server restarts

  • Efficient Storage: Optimized for time-series data

Production Architecture

        
   MCP Servers    Observability      Prometheus     
   (Monitored)          MCP Server            Metrics       
        
                                                       
                                                       
                          
                        Persistent             Grafana       
                         Storage               Dashboards    
                             (State-of-Art)
                                               
                 
   Application         Loki        
     Logs               Log Aggregation
    

Usage Examples

Health Monitoring

# Check MCP server health
result = await monitor_server_health(
    service_url="http://localhost:8000/health",
    timeout_seconds=5.0
)
print(f"Status: {result['health_check']['status']}")

Performance Analysis

# Collect system metrics
metrics = await collect_performance_metrics(service_name="my-mcp-server")
print(f"CPU: {metrics['metrics']['cpu_percent']}%")
print(f"Memory: {metrics['metrics']['memory_mb']} MB")

Distributed Tracing

# Record a trace
trace = await trace_mcp_calls(
    operation_name="process_document",
    service_name="ocr-mcp",
    duration_ms=150.5,
    attributes={"file_size": "2.3MB", "format": "PDF"}
)

Generate Reports

# Create performance report
report = await generate_performance_reports(
    service_name="web-mcp",
    days=7
)
print("Performance Summary:", report['summary'])
print("Recommendations:", report['recommendations'])

Loki Log Management

# Send custom logs to Loki
result = await send_logs_to_loki(
    log_message="User authentication failed",
    level="warning",
    labels={"service": "auth-service", "user_id": "12345"}
)

# Query logs from Loki
logs = await query_loki_logs(
    query='{job="observability-mcp"} |= "ERROR"',
    start_time="1h",
    limit=100
)

# Analyze log patterns
patterns = await analyze_log_patterns(
    query='{service="web-mcp"}',
    time_window="24h",
    min_occurrences=10
)

# Correlate logs with metrics
correlation = await correlate_logs_and_metrics(
    log_query='{service="api"} |= "timeout"',
    metric_query="rate(http_requests_total{status='500'}[5m])",
    time_window="1h"
)

Development

Running Tests

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run with coverage
pytest --cov=observability_mcp --cov-report=html

Code Quality

# Format code
black src/

# Lint code
ruff check src/

# Type checking
mypy src/

Docker Development

# Build development image
docker build -t observability-mcp:dev -f Dockerfile.dev .

# Run with hot reload
docker run -p 12009:12009 -e PROMETHEUS_PORT=12009 -v $(pwd):/app observability-mcp:dev

Performance Benchmarks

FastMCP 3.3+ Benefits

  • OpenTelemetry Overhead: <1ms per trace

  • Storage Performance: 1000+ metrics/second

  • Memory Usage: 50MB baseline + 10MB per monitored service

  • Concurrent Monitoring: 100+ services simultaneously

  • CPU: 2+ cores for metrics processing

  • RAM: 2GB minimum, 4GB recommended

  • Storage: 10GB for metrics history (30 days retention)


Troubleshooting

Common Issues

Server Won't Start

# Check Python version
python --version  # Should be 3.11+

# Check FastMCP installation
pip show fastmcp  # Should be 2.14.1+

# Check dependencies
pip check

Metrics Not Appearing

# Check Prometheus endpoint
curl http://127.0.0.1:12009/metrics

# Verify OpenTelemetry configuration
observability-mcp metrics

High Memory Usage

  • Reduce METRICS_RETENTION_DAYS

  • Implement metric aggregation

  • Monitor with monitor_system_resources

Storage Issues

  • Check available disk space

  • Clean old metrics: rm -rf ~/.observability-mcp/metrics/*

  • Restart server to recreate storage


Contributing

Development Setup

  1. Fork the repository

  2. Create a feature branch

  3. Make your changes

  4. Add tests for new functionality

  5. Submit a pull request

Code Standards

  • FastMCP 3.3++: Use latest features and patterns

  • OpenTelemetry: Follow OTEL practices

  • Async First: All operations should be async

  • Type Hints: Full type coverage required

  • Documentation: Comprehensive docstrings

Testing Strategy

  • Unit Tests: Core functionality

  • Integration Tests: MCP server interactions

  • Performance Tests: Benchmarking and load testing

  • Chaos Tests: Failure scenario testing


🛡️ Industrial Quality Stack

This project adheres to SOTA 14.1 industrial standards for high-fidelity agentic orchestration:

  • Python (Core): Ruff for linting and formatting. Zero-tolerance for print statements in core handlers (T201).

  • Webapp (UI): Biome for sub-millisecond linting. Strict noConsoleLog enforcement.

  • Protocol Compliance: Hardened stdout/stderr isolation to ensure crash-resistant JSON-RPC communication.

  • Automation: Justfile recipes for all fleet operations (just lint, just fix, just dev).

  • Security: Automated audits via bandit and safety.

License

MIT License - see LICENSE file for details.


Acknowledgments

  • FastMCP Team - For the 2.14.1 framework with OpenTelemetry integration

  • OpenTelemetry Community - For the observability standards and tools

  • Prometheus Team - For the metrics collection and alerting system

  • Grafana Labs - For Loki log aggregation and Grafana's state-of-the-art dashboarding

  • Grafana Community - For the visualization platform that powers modern observability



Built with using FastMCP 3.3+, OpenTelemetry, Prometheus, Grafana & Loki - State-of-the-Art Observability

Available Tools

22 tools
agentic_observability_workflowB

Multi-step observability triage (stack → logs → health).

Uses host LLM sampling when available; otherwise runs a fixed tool chain.

Inputs: goal (required), use_sampling. Returns: object

alert_on_anomaliesB

Monitor for performance anomalies and trigger alerts.

Uses statistical analysis and configurable thresholds to detect anomalies in MCP server performance metrics and trigger appropriate alerts.

Inputs: service_name. Returns: object

analyze_log_patternsB

Analyze log patterns and anomalies using Loki queries.

This tool identifies common log patterns, error spikes, and potential issues by analyzing log data over time windows.

Inputs: query (required), time_window, min_occurrences. Returns: object

analyze_mcp_interactionsB

Analyze patterns in MCP server interactions and usage.

Examines trace data and interaction patterns to provide insights into how MCP servers are being used and identify optimization opportunities.

Inputs: days. Returns: object

check_stack_statusA

Check the health and connectivity of the observability stack (Loki, Prometheus, Grafana).

This diagnostic tool verifies if the underlying Docker-based services are reachable and correctly configured.

Inputs: no named parameters. Returns: object

collect_performance_metricsA

Collect comprehensive performance metrics for the system or specific service.

Uses OpenTelemetry for structured metrics collection and psutil for system monitoring. Metrics are persisted for historical analysis and trend detection.

Inputs: service_name. Returns: object

correlate_logs_and_metricsB

Correlate log entries with metrics for comprehensive incident analysis.

This tool combines Loki log querying with Prometheus metrics to provide unified observability insights and root cause analysis.

Inputs: log_query (required), metric_query (required), time_window. Returns: object

export_metricsB

Export collected metrics in various formats for external monitoring systems.

Supports Prometheus, OpenTelemetry, and JSON formats for integration with existing monitoring infrastructure.

Inputs: format, include_history. Returns: object

generate_performance_reportsB

Generate comprehensive performance reports with automated analysis.

Analyzes historical metrics data to provide insights, trends, and recommendations for optimizing MCP server performance.

Inputs: days, service_name. Returns: object

manage_alert_configsA

Manage metric alert configurations.

Operations:

  • list: List all current alert configurations

  • add: Add a new alert configuration (requires 'alert' dict)

  • remove: Remove an alert by metric name (requires 'metric_name')

  • toggle: Enable/disable an alert (requires 'metric_name')

Inputs: operation (required), alert, metric_name. Returns: object

manage_grafana_dashboardsA

Manage Grafana dashboards.

Operations:

  • list: List all dashboards

  • create: Create or update a dashboard (requires 'dashboard_json')

  • delete: Delete a dashboard by UID (requires 'uid')

  • get: Get dashboard JSON by UID (requires 'uid')

Inputs: operation (required), uid, dashboard_json. Returns: object

manage_grafana_datasourcesA

Manage Grafana datasources.

Operations:

  • list: List all datasources

  • add: Add a new datasource (requires 'ds_json')

  • remove: Remove a datasource by ID (requires 'ds_id')

  • test: Test connection to a datasource by ID (requires 'ds_id')

Inputs: operation (required), ds_id, ds_json. Returns: object

monitor_server_healthB

Perform real-time health check on an MCP server or web service.

This tool uses OpenTelemetry for metrics collection and provides comprehensive health monitoring with detailed response analysis.

Inputs: service_url (required), timeout_seconds, expected_status_codes. Returns: object

monitor_system_resourcesB

Monitor system-wide resources and provide real-time status.

Collects comprehensive system resource information including CPU, memory, disk, network, and process statistics for overall system health monitoring.

Inputs: no named parameters. Returns: object

observability_capabilities_cardC

Prefab card: SOTA manifest and tool surface summary.

Inputs: no named parameters.

observability_grafana_dashboards_cardB

Prefab card: Grafana dashboard list (read-only).

Inputs: no named parameters.

observability_stack_health_cardC

Prefab card: unified PLG stack health (Grafana, Prometheus, Loki).

Inputs: no named parameters.

provision_standard_dashboardsB

Provision standard SOTA industrial dashboards to Grafana.

This tool sets up pre-configured dashboards for:

  1. System Health & Resource Usage

  2. MCP Trace Analytics

  3. Loki Log Central

Inputs: no named parameters. Returns: object

query_loki_logsC

Query logs from Loki with advanced filtering and analysis.

This tool provides powerful log querying capabilities using Loki's LogQL syntax, enabling correlation between logs, metrics, and traces.

Inputs: query (required), limit, end_time, start_time. Returns: object

send_logs_to_lokiB

Send custom log entries to Loki for centralized log aggregation.

This tool allows manual log injection into the Loki log aggregation system, enabling correlation between custom events and system metrics.

Inputs: log_message (required), level, labels. Returns: object

show_status_dashboardA

Display a rich, premium status dashboard using Prefab UI. Provides a visual overview of stack health, system metrics, and active alerts. Hardened: operates in Degraded Mode when Docker or stack services are unreachable.

Inputs: no named parameters.

trace_mcp_callsA

Record a trace for MCP call monitoring and distributed tracing.

Creates OpenTelemetry spans for tracking MCP server interactions, enabling distributed tracing across multiple MCP servers.

Inputs: duration_ms (required), service_name (required), operation_name (required), attributes. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 22 tools

    Disambiguation2/5

    Several clusters of overlapping tools exist: check_stack_status, show_status_dashboard, observability_stack_health_card, and monitor_server_health all report health; collect_performance_metrics, monitor_system_resources, and generate_performance_reports all gather/analyze metrics; query_loki_logs, analyze_log_patterns, and correlate_logs_and_metrics all touch Loki. Descriptions add nuance but an agent can easily pick the wrong status/health/report tool.

    Naming Consistency4/5

    Nearly all tools follow a clean verb_noun pattern (check_stack_status, query_loki_logs, manage_grafana_dashboards). The main deviation is the trailing observability_*_card tools plus agentic_observability_workflow, which are noun-style and break the pattern, though they read as a deliberate UI-card group.

    Tool Count3/5

    22 tools is at the heavy end for an observability server; the core workflows (metrics, logs, traces, dashboards) are covered, but multiple near-duplicate reporting/status/card tools push it beyond a tight scope.

    Completeness4/5

    Strong coverage of the PLG stack: log ingestion/query/analysis, trace recording, alert config management, Grafana dashboard and datasource CRUD, and metric export. The notable gap is direct Prometheus/PromQL metric querying for ad-hoc exploration, plus no update/delete for dashboards beyond create-or-update.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Monitor MCP server health, uptime, response times, and Azure DevOps pipeline status
      14
      12 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Unified MCP server for observability and monitoring, providing tools to query metrics, logs, and traces through Prometheus, Grafana, Loki, and Jaeger.
      2
      Mozilla Public 2.0
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that automatically instruments Python AI agents with the ioa-observe-sdk, adding OpenTelemetry-based tracing, metrics, and logs with zero manual effort.
      2
      21 PyPI
      Apache 2.0
    • F
      license
      Not graded
      quality
      D
      maintenance
      Integrity monitor for MCP server ecosystems, providing real-time health checks, drift detection, and cascade impact analysis for any AI agent.
      -