Labsco
MCP SERVER

Loki MCP

by incu6us

Find out what your Loki instance holds, then query it — without guessing label names first.

Observability, Monitoring & Incident Response
Summary
Discovery tools, so the query is built from real label values.

A single query tool means the model has to already know your label names; labels, label_values and series let it find out first, which is fewer wasted round trips. If you expose the HTTP mode, remember that whoever reaches it can read every line the configured credentials can.

What it is

A Go server over Grafana Loki. Five tools: three for discovering labels and streams, two for running LogQL. Input is validated before the request leaves, so a bad query fails locally rather than at Loki.

What you get
  • A LogQL range query over a time window, with a limit up to 5000 and a forward or backward direction — query_range
  • A LogQL instant query at a point in time — query
  • Every label name in the instance — labels
  • The values for one label — label_values
  • Active stream series matching a selector — series
  • Validation before the call: limit caps, direction values, label-name format, and mutually exclusive authentication
  • Stdio by default, or a stateless streamable HTTP transport that can run behind a load balancer
Requirements

LOKI_URL. Authentication is optional and mutually exclusive: LOKI_USERNAME with LOKI_PASSWORD, or LOKI_BEARER_TOKEN. LOKI_TENANT_ID sets the X-Scope-OrgID header for multi-tenant deployments, and LOKI_HTTP_TIMEOUT defaults to 30s. Install with Homebrew or go install. Setting MCP_HTTP_ADDR serves streamable HTTP instead of stdio, with no authentication of its own — put it behind TLS and a proxy.

Setup effort

One command — go install github.com/incu6us/loki-mcp-server/cmd/loki-mcp-server@latest