Описание
MCP server that lets AI agents query Grafana Loki logs and speed-up debugging issues
I've created an MCP server that gives AI agents access to Grafana Loki logs - and here's how it compares to the official one
GitHub: [link]
The problem: AI assistants are great at debugging, but they can't access your logs. Observability data lives in Loki, while AI operates without that context.
This project bridges that gap by exposing Loki through MCP, so an AI agent can run LogQL queries directly.
Example prompt:
Find errors from payment-service in the last 30 minutes using loki mcp server
The agent queries Loki, gets the logs, and can then analyze them, summarize the incident, or suggest root causes.
# How it differs from Grafana's implementations
Grafana has two official options: `grafana/loki-mcp` (standalone Loki MCP) and `grafana/mcp-grafana` (unified Grafana MCP with 70+ tools). Here's where my project takes a different approach:
|Name|loki-mcp-server (this project)|grafana/loki-mcp|grafana/mcp-grafana|
|:-|:-|:-|:-|
|Tools|5 granular tools: query, query_range, labels, label_values, series|loki_query \+ labels (added in v0.5.0)|5 Loki tools + patterns + stats (70+ total)|
|Design philosophy|Discovery-first - agent explores labels/series before building queries|Query-first - agent must already know the schema|Full Grafana ecosystem|
|Connection|Direct to Loki API|Direct to Loki API|Through Grafana datasource proxy (requires Grafana)|
|Auth|Basic auth, Bearer token, multi-tenant (X-Scope-OrgID)|Basic auth, Bearer token, org ID|Grafana RBAC|
|Transport|stdio|stdio, SSE, streamable HTTP|stdio|
|Input validation|Strict - limit caps (max 5000), direction validation, label format checks|Basic|Basic|
|Install|Homebrew, go install, binary|Binary, Docker|Binary|
The key difference is the discovery-first approach. LLMs don't always know your label schema upfront. With 5 separate tools, the agent can:
1. Call labels to see what's available
2. Call label_values to explore specific labels
3. Call series to find active streams
4. Build a precise query or query_range based on what it discovered
This matters because a model guessing at label names generates bad LogQL and wastes tokens on retries. Letting it discover the schema first leads to better queries on the first attempt.
# Use cases
AI-assisted debugging and root cause analysis
Automated incident investigation
Log summarization and pattern detection
DevOps observability automation
Looking for feedback from people using Loki, MCP, or AI agents in DevOps workflows. Ideas for improvements, integrations, or features are welcome.
[link]
[handle]
Контакты работодателя (email/phone/telegram) скрыты из публичного превью —
отправьте резюме, чтобы мы связали вас напрямую.