The label calls matter more than they look. LogQL is unwriteable unless you know which labels exist and what values they take, and both are one call away here.
A FastMCP server that queries Loki logs through a Grafana instance. Alongside the query itself it exposes the label names and values a LogQL query depends on, and a formatter that decides how results come back.
- Loki queried through the Grafana API
- The available label names listed
- The values a given label takes
- Results formatted as text, JSON or markdown
- A cap on characters per line so one enormous entry does not flood the response
- Both stdio and SSE transports
Python 3.10 or newer, a Grafana instance, and a Grafana API key with permission to query Loki — set as GRAFANA_URL and GRAFANA_API_KEY, or passed as -u and -k. Install with pip install grafana-loki-mcp.
One command plus a key — pip install grafana-loki-mcp, then supply credentials
