Mcp Monitoring

Created By
reemshai10a year ago
A sophisticated Model Context Protocol (MCP) server that provides intelligent monitoring and observability integration. This server enables natural language interactions with Prometheus, AlertManager, and Grafana through chat-style commands, advanced query processing, and comprehensive monitoring automation. ## 🌟 Overview This MCP server transforms how you interact with monitoring infrastructure by providing: - **Natural Language Processing**: Ask monitoring questions in plain English - **Intelligent Query Translation**: Automatically converts questions to PromQL queries - **Historical Alert Analysis**: Count failures, outages, and incidents over time - **Multi-Source Integration**: Seamlessly works with Prometheus, AlertManager, and Grafana - **Automated Incident Detection**: Smart pattern recognition for service failures ## ✨ Key Features ### 🧠 **Natural Language Query Engine** - **Smart Intent Recognition**: Understands monitoring questions like "How many times did service X fail?" - **Automatic Time Range Parsing**: Handles phrases like "last 2 weeks", "yesterday", "past month" - **Service Name Detection**: Recognizes services like opengrok, jenkins, grafana, prometheus - **Alert Pattern Matching**: Identifies automation failures, service outages, and critical incidents - **Context-Aware Responses**: Provides detailed breakdowns with incident counts and durations ### 🔍 **Prometheus Integration** - **Advanced PromQL Generation**: Automatically creates complex queries based on natural language - **Historical Data Analysis**: Analyzes alert trends and service availability over time - **Metric Discovery**: Browse and search available metrics with intelligent filtering - **Range Query Optimization**: Smart step sizing for different time ranges - **Alert History Tracking**: Tracks firing periods and incident detection ### 🚨 **AlertManager Integration** - **Real-time Alert Monitoring**: Query active, pending, and resolved alerts - **Smart Alert Filtering**: Filter by service, severity, alertname, or custom labels - **Alert Fingerprinting**: Track unique alert instances and their lifecycle - **Incident Correlation**: Group related alerts and calculate total impact ### 📊 **Grafana Integration** (Optional) - **Dashboard Discovery**: Find dashboards related to specific services - **Dynamic Dashboard Links**: Generate direct links to relevant monitoring views - **Service Context Mapping**: Connect services to their monitoring dashboards
Overview

🛠️ Available Tools

Natural Language Query

// Ask monitoring questions in plain English
mcp_monitoring_natural_language_query({
  question: "how many times did jenkins fail in the last week?",
  timeRange: "last week"  // optional
})

Active Alerts

// Get currently firing alerts
mcp_monitoring_get_active_alerts({
  filter: "alertname=cleanup-zuultmp"  // optional filter
})

Prometheus Instant Query

// Execute PromQL queries
mcp_monitoring_query_prometheus({
  query: "up{job='prometheus'}",
  time: "2024-01-15T10:30:00Z"  // optional timestamp
})

Prometheus Range Query

// Get historical time series data
mcp_monitoring_query_prometheus_range({
  query: "ALERTS{severity='critical'}",
  start: "2024-01-01T00:00:00Z",
  end: "2024-01-15T00:00:00Z",
  step: "1h"  // optional resolution
})

🚀 Quick Start

Installation

git clone <repository-url>
cd monitoring-mcp
npm install
npm run build

Configuration

Set environment variables:

export PROMETHEUS_URL="https://prometheus.example.com"
export ALERTMANAGER_URL="https://alertmanager.example.com"
export GRAFANA_URL="https://grafana.example.com"          # Optional
export GRAFANA_API_TOKEN="your-grafana-token"             # Optional - Ask admin to create service user and provide token

Running the Server

npm start
# or
node dist/index.js

Server Config

{
  "mcpServers": {
    "monitoring-mcp": {
      "command": "node",
      "args": [
        "/Users/MCP/mcp-monitoring/dist/index.js"
      ],
      "env": {
        "PROMETHEUS_URL": "${input:prometheus_base_url}",
        "ALERTMANAGER_URL": "${input:alertmanager_base_url}",
        "GRAFANA_URL": "${input:grafana_base_url}",
        "GRAFANA_API_KEY": "${input:grafana_api_key}"
      }
    }
  }
}
Project Info
Created At
a year ago
Updated At
a year ago
Author Name
reemshai10
Star
-
Language
-
License
-
Category

Recommend Servers

View All
Infersports

12 hours ago
Meok Bs7121 Mcp

2 days ago
Kangram

13 hours ago