Acts as a bridge to observability backends for querying Prometheus metrics and Loki logs, enabling alert investigation, troubleshooting, and correlation of metrics and logs for monitored services.
Provides tools for querying Prometheus metrics using PromQL, discovering metrics and labels, retrieving current and historical metric values, and investigating service health and performance issues.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@OpenTelemetry MCP Servershow me the top 5 services by error rate in the last hour"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
otel-mcp
MCP server for querying Prometheus metrics and Loki logs with OIDC authentication.
Features
Query Prometheus metrics (PromQL)
Query Loki logs (LogQL)
HTTP API for K8s deployment
Service discovery (metrics, labels, log streams)
Quick Start
Local Development
# 1. Install
git clone <your-repo-url>
cd otel-mcp
uv sync
# 2. Configure .env
cp .env.example .env
# Edit .env with your Prometheus/Loki URLs
# 3. Run (stdio mode for local MCP)
uv run python -m src.serverProduction (Kubernetes + Authentik)
See K8S_DEPLOYMENT.md for full deployment guide.
# Build and deploy
docker build -t your-registry/otel-mcp:latest .
kubectl apply -f k8s/
# Access at https://otel-mcp.your-domain.comAvailable Tools
Prometheus (5 tools)
query_prometheus- Execute PromQL instant queriesquery_prometheus_range- Query metrics over time rangelist_metrics- List available metricslist_label_values- Get label values (discover services)list_labels- List all label names
Loki (4 tools)
query_loki- Execute LogQL queriessearch_logs- Simple log search with filterslist_log_labels- List log stream labelslist_log_label_values- Get log label values
Usage
Production: K8s with Authentik OAuth Proxy
Deploy HTTP server behind Authentik for authentication.
See K8S_DEPLOYMENT.md for complete setup.
# Build and deploy
docker build -t registry/otel-mcp:latest .
kubectl apply -f k8s/
# Use the API
curl -H "Authorization: Bearer YOUR_TOKEN" \
https://otel-mcp.your-domain.com/tools
curl -X POST https://otel-mcp.your-domain.com/call \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"tool": "query_prometheus", "arguments": {"query": "up"}}'Local: MCP stdio (Development)
For local MCP clients like Claude Desktop.
# Run stdio server
uv run python -m src.server
# Claude Desktop config
{
"mcpServers": {
"otel-mcp": {
"command": "uv",
"args": ["--directory", "/path/to/otel-mcp", "run", "python", "-m", "src.server"],
"env": {
"PROMETHEUS_URL": "http://localhost:9090",
"LOKI_URL": "http://localhost:3100"
}
}
}
}Configuration Options
Variable | Default | Description |
|
| Prometheus endpoint |
|
| Loki endpoint |
|
| Enable OIDC auth |
| - | OIDC provider URL |
| - | OAuth2 client ID |
| - | Token audience (optional) |
|
| Logging level |
|
| Query timeout (seconds) |
Backend Authentication
Prometheus/Loki support Basic Auth and Bearer tokens:
# Basic Auth
PROMETHEUS_AUTH_TYPE=basic
PROMETHEUS_USERNAME=admin
PROMETHEUS_PASSWORD=secret
# Bearer Token
LOKI_AUTH_TYPE=bearer
LOKI_BEARER_TOKEN=your-tokenExample Queries
# List services
{"tool": "list_label_values", "arguments": {"label": "job"}}
# Query CPU usage
{"tool": "query_prometheus", "arguments": {"query": "rate(cpu_usage[5m])"}}
# Search error logs
{"tool": "search_logs", "arguments": {"search_text": "error", "start": "1h"}}License
MIT
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.