Observability MCP Server
Observability MCP server for querying metrics, logs, traces, and Grafana metadata, with one Grafana annotation write capability.
Configure and probe Prometheus, Loki, Tempo, and Grafana backend URLs per named session.
Manage sessions with connect, disconnect, and status tools.
Run instant PromQL metric queries.
Calculate HTTP 5xx error rate for a service label over 5 minutes.
Run LogQL log range queries with a configurable limit.
Fetch a Tempo trace by trace ID.
Search Tempo traces by tags with a configurable limit.
List Grafana datasources.
List Grafana alert rules.
Create a Grafana annotation, the server's only write action.
Provides tools for interacting with Grafana, including listing datasources and alert rules, and creating annotations.
Provides tools for querying Prometheus with instant PromQL queries and calculating HTTP 5xx error rates for a service label.
Click on "Deploy 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., "@Observability MCP Server why did order-service fail? check logs and trace for request abc123"
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.
Observability MCP Server
Open-source MCP server owned by Pawan Gunjkar (pawangunjkar@gmail.com · GitHub). MIT licensed.
Developers ask why a request failed and get metrics, logs, and a trace without opening Grafana. Queries are read-only. obs_annotate is the only write: it posts a Grafana annotation.
Sibling servers: github-mcp, jenkins-mcp, db-mcp, k8s-mcp.
Project information
Item | Value |
Package |
|
Runtime | Python 3.10+, FastMCP, stdio, httpx |
Backends | Prometheus, Loki, Tempo, Grafana |
Reads | PromQL, LogQL, trace fetch, trace search, datasources, alert rules |
Write | Grafana annotation only |
Related MCP server: LGTM MCP Server
Architecture
flowchart TB
subgraph L1["Layer 1 — Editor"]
IDE["Cursor or Claude Desktop"]
end
subgraph L2["Layer 2 — MCP"]
SRV["observability-mcp"]
HUB["ObsHub session"]
end
subgraph L3["Layer 3 — Signals"]
P["Prometheus :9090"]
L["Loki :3100"]
T["Tempo :3200"]
G["Grafana :3000"]
end
IDE -->|"obs_query_metrics"| SRV
IDE -->|"obs_query_logs"| SRV
IDE -->|"obs_get_trace"| SRV
SRV --> HUB
HUB -->|"PromQL instant"| P
HUB -->|"LogQL range"| L
HUB -->|"trace id or tags"| T
HUB -->|"alerts and annotations"| Gflowchart LR
ERR["5xx or exception"] --> LOG["obs_query_logs"]
LOG --> TRACE["obs_search_traces"]
TRACE --> SPAN["obs_get_trace"]
SPAN --> RATE["obs_error_rate"]
RATE --> NOTE["obs_annotate"]Tools
Tool | What it does |
| Save backend URLs and probe health |
| Instant PromQL |
| 5xx rate for a |
| LogQL range query |
| Tempo trace by id |
| Tempo search by tags |
| List Grafana datasources |
| List alert rules |
| Write a Grafana annotation |
Metrics, logs, and traces are read-only. The annotation tool is the write path.
Cursor
{
"mcpServers": {
"observability": {
"command": "uv",
"args": ["run", "--directory", "C:/AI_Workspaces/Anti_Workspace/observability-mcp", "server.py"],
"env": {
"PROMETHEUS_URL": "http://localhost:9090",
"LOKI_URL": "http://localhost:3100",
"TEMPO_URL": "http://localhost:3200",
"GRAFANA_URL": "http://localhost:3000",
"GRAFANA_TOKEN": ""
}
}
}
}Example: obs_query_logs(query='{app="order-orchestrator"} |= "ERROR"', limit=50)
Available Tools
11 toolsobs_annotateB
Create a Grafana annotation. This is the write tool for observability.
Inputs: text (required), tags, session_name. Returns: result
obs_connectC
Save backend URLs and probe /ready or Grafana /api/health.
Inputs: loki_url, tempo_url, grafana_url, session_name, +2 more. Returns: result
obs_disconnectC
Drop an observability session.
Inputs: session_name. Returns: result
obs_error_rateC
HTTP 5xx rate for a service label over 5 minutes, if that metric exists.
Inputs: service (required), session_name. Returns: result
obs_get_traceB
Fetch one Tempo trace by id.
Inputs: trace_id (required), session_name. Returns: result
obs_grafana_alertsD
List Grafana alert rules.
Inputs: session_name. Returns: result
obs_grafana_datasourcesC
List Grafana datasources.
Inputs: session_name. Returns: result
obs_query_logsC
Run a LogQL query, for example {service="order-orchestrator"} |= "ERROR".
Inputs: query (required), limit, session_name. Returns: result
obs_query_metricsC
Run an instant PromQL query, for example sum(rate(http_requests_total[5m])).
Inputs: query (required), session_name. Returns: result
obs_search_tracesC
Search Tempo traces. tags example: service.name=order-orchestrator.
Inputs: tags (required), limit, session_name. Returns: result
obs_statusA
List configured observability sessions.
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 11 tools
Each tool targets a distinct observability resource and action: connection, status, metrics queries, error-rate specialization, log queries, trace retrieval/search, Grafana datasource/alert listing, and annotation writing. While query_metrics and error_rate both touch metrics, error_rate is narrowly scoped to 5xx rates over a fixed window, and get_trace vs search_traces differ by lookup key vs tags, leaving no ambiguous boundaries.
All tools share the obs_ prefix, followed by a verb_noun or clear verb pattern (e.g., obs_query_metrics, obs_get_trace, obs_grafana_datasources, obs_annotate). The naming is predictable and uniform, with no mixed casing or inconsistent verb styles, making tool selection straightforward.
With 11 tools, the server covers a broad but well-scoped observability surface—metrics, logs, traces, and Grafana integration—without feeling bloated. Each tool serves a distinct purpose and earns its place, fitting within the ideal 3-15 tool range.
The tool set provides solid read coverage for metrics (instant queries, error rates), logs, traces (get/search), and Grafana metadata (datasources, alerts), plus one write operation (annotations). Minor gaps exist, such as missing range queries for Prometheus or alert management write operations, but the core observability workflows are well represented and agents can accomplish typical tasks without dead ends.
Maintenance
Related MCP Connectors
Lets AI agents analyze API metrics, request logs, and traces, and manage apps and alerts.
Read-only production context for AI agents: Docker/K8s health, deploys, logs, traffic, code graph
Open-source agent that observes and fixes your application. Query logs, traces, metrics, incidents.
Query your AI agent traces, root-cause verdicts and issues, and run investigations, from your agent.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables exploration of Kubernetes metrics, logs, traces, and service graph data via simple tools.2-
- AlicenseNot gradedqualityDmaintenanceProvides read-only access to Loki, Prometheus, and Tempo APIs, enabling natural language queries for logs, metrics, and traces. Supports multiple instances and authentication via bearer tokens.1MIT
- AlicenseBqualityDmaintenanceEnables querying Grafana Tempo traces and spans with flexible filtering, including TraceQL queries, tag-based filters, duration ranges, and aggregated statistics.6GPL 3.0
- AlicenseAqualityBmaintenanceEnables agents to explore dashboards and run their panel queries with template variables resolved, query Prometheus and Loki datasources, and read alerts, silences and annotations across Grafana's sources in a context-friendly, read-only-by-default form, with write tools available only when explicitly enabled.1440 npmMIT