shaowenchen/ops-mcp-server
If you are the rightful owner of ops-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
Ops MCP Server is a modular server for operational data querying using the Model Context Protocol (MCP), built with Go.
list_events
List all available events with optional limit and offset
get_event
Get detailed information about a specific event by ID
get_metrics_status
Get the current status of the metrics module
get_logs_status
Get the current status of the logs module
Ops MCP Server
A modular MCP (Model Context Protocol) server providing operational monitoring capabilities including events, metrics, and logs.
Features
- Events Module: Query Kubernetes events (pods, deployments, nodes)
- Metrics Module: Query monitoring metrics through Grafana/Prometheus
- Logs Module: Analyze and search application logs
Metrics Module - Prometheus Integration
The metrics module supports querying monitoring data directly through Prometheus API, allowing you to execute Prometheus queries.
Available Tools
Basic Query Tools
query_metrics
- Execute custom PromQL queriesquery_metrics_range
- Execute range queries with time intervalsget_metrics_status
- Get metrics module statusget_system_overview
- Get system overview metrics
Kubernetes Resource Discovery
get_clusters
- List all available Kubernetes clustersget_namespaces
- List namespaces (optionally filtered by cluster)get_pods
- List pods (optionally filtered by cluster/namespace)
Kubernetes Resource Usage
get_pod_resource_usage
- Get CPU and memory usage for podsget_node_resource_usage
- Get CPU and memory usage for nodes
Configuration
Configure Prometheus integration in configs/config.yaml
:
metrics:
enabled: true
prometheus:
endpoint: "http://localhost:9090/api/v1"
Environment Variables
Configure endpoint via environment variable if needed:
export METRICS_PROMETHEUS_ENDPOINT="http://localhost:9090/api/v1"
Getting Prometheus Configuration
- Endpoint: Your Prometheus server endpoint URL with API version (e.g.,
http://localhost:9090/api/v1
)
Example Queries
List Clusters
{
"tool": "get_clusters"
}
Get Pods in Specific Namespace
{
"tool": "get_pods",
"cluster": "my-cluster",
"namespace": "default",
"limit": "10"
}
Get Pod Resource Usage
{
"tool": "get_pod_resource_usage",
"cluster": "my-cluster",
"namespace": "kube-system",
"limit": "20"
}
Get Node Resource Usage
{
"tool": "get_node_resource_usage",
"cluster": "my-cluster",
"limit": "10"
}
Custom PromQL Query
{
"tool": "query_metrics",
"query": "up{job=\"kubernetes-nodes\"}"
}
Query Examples
CPU Usage:
rate(cpu_usage_total[5m])
Memory Usage:
(1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100
HTTP Request Rate:
rate(http_requests_total[5m])
Pod Resource Usage:
container_memory_usage_bytes{pod=~"my-app-.*"}
Time Ranges
Supported time range values:
1h
- Last hour24h
- Last 24 hours7d
- Last 7 days30d
- Last 30 days
Query Steps
For range queries, you can specify the resolution step:
30s
- 30 second intervals1m
or60s
- 1 minute intervals (default)5m
- 5 minute intervals1h
- 1 hour intervals
Events Module
Query Kubernetes events with improved parameter names:
get_pod_events
- Usepod
parameter for specific pod nameget_deployment_events
- Usedeployment
parameter for specific deployment nameget_nodes_events
- Usenode
parameter for specific node name
Quick Start
- Configure your monitoring endpoints in
configs/config.yaml
- Set sensitive tokens via environment variables
- Run the server in stdio mode:
./bin/ops-mcp-server --config configs/config.yaml
Building
go build -o bin/ops-mcp-server cmd/server/main.go