mcp-loki
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| LOKI_URL | Yes | Loki base URL (gateway, query-frontend or single binary), with any path prefix. | |
| LOKI_TOKEN | No | Bearer token instead of basic auth (Grafana Cloud, an OAuth proxy). | |
| LOKI_HEADERS | No | Extra headers as a JSON object. | |
| LOKI_TIMEOUT | No | HTTP timeout per request, in seconds. | 60 |
| LOKI_PASSWORD | No | Basic auth password. | |
| LOKI_USERNAME | No | Basic auth username. Behind the Loki Helm chart's nginx gateway the username is the tenant. | |
| LOKI_TENANT_ID | No | Sent as X-Scope-OrgID, for a multi-tenant Loki reached directly. A gateway that maps the basic-auth username overrides it. | |
| LOKI_MAX_RETRIES | No | Retries for 429 and proxy 502/503. A 504 is never retried. | 2 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| loki_auth_statusA | Report which Loki this server reads and whether it answers: the URL, auth mode, the tenant (and where that comes from), the Loki version, and this tenant's limits — retention, max query length, max lines per query, max series, query timeout, and whether volume and pattern endpoints are enabled. When the server is not configured, says exactly what to set. Call this first when a tool you expected is missing, when a query fails on a limit, or before trusting logs from an instance you have not checked. |
| loki_query_logsA | Run a LogQL log query over a time range and return the matching lines, newest first by default, merged across streams into one time-ordered list. Labels shared by every stream come once as |
| loki_get_log_contextA | Show the lines around one log line — what the same stream logged just before and after it, unfiltered — the way Grafana's 'show context' does. Pass the stream selector (built from the line's common_labels plus its own labels, e.g. |
| loki_query_metricA | Evaluate a LogQL metric query at one instant: a count, rate or total over a window written into the query, e.g. errors per namespace over the last hour |
| loki_query_metric_rangeA | Evaluate a LogQL metric query over a time range, for how log volume or error rates changed: a spike, when it started, which service it came from. Each series comes back with stats (min, max, avg, last) and, with view=values, one value per step on a shared grid given by start and step (null where there was nothing). The step is picked for about 60 points unless given; the range in the query ( |
| loki_list_labelsA | List the indexed stream labels with how many distinct values each has, optionally only for streams matching a selector. The starting point for writing any query: low-cardinality labels (namespace, app, service_name, container) make good selectors; high-cardinality ones (pod, filename) are better left to line filters or |
| loki_list_label_valuesA | List the values of one stream label, e.g. every namespace or every app, optionally only among streams matching a selector (the pods of one namespace). Use it to find the exact spelling to put in a selector rather than guessing with a regex. |
| loki_list_seriesA | List the streams (distinct label sets) matching a selector, with the labels every one shares hoisted into |
| loki_list_detected_fieldsA | List the fields Loki can pull out of the log lines themselves — JSON keys, logfmt keys and structured metadata — with their type, cardinality and which parser finds them, for the streams a query selects. This is how to learn what to write after |
| loki_get_volumeA | How many bytes of logs each service, namespace or stream produced over a range, largest first, from the index alone — no lines are read, so it is cheap over days. Use it to find the noisiest sources, to see what a selector covers before querying it, or to compare: |
| loki_get_statsA | How much data a stream selector covers over a range — streams, chunks, log lines and bytes — from the index, without reading any of it. Call it before an expensive loki_query_logs or a long metric range: a selector covering tens of GB will be slow or time out, and should be narrowed first. |
| loki_list_patternsA | Summarize what a set of streams is logging as line templates ( |
| loki_list_rulesA | List the Loki ruler's alerting and recording rules (LogQL rules evaluated by Loki itself, not Prometheus or Grafana-managed alerts), with health, last error and, for alerts, whether they are firing — firing first. Answers an empty list when no rule groups exist for this tenant, and 404 when the ruler is not deployed or not routed. |
| loki_requestA | Escape hatch: GET any Loki read endpoint the other tools do not wrap — /loki/api/v1/index/volume_range, /loki/api/v1/format_query (pretty-prints and validates LogQL without running it), /prometheus/api/v1/alerts, or /config (this Loki's whole running configuration, as YAML). The answer is the raw |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 14 tools
The tools are largely distinct: log reading, instant/range metrics, label discovery, series, fields, volume, stats, patterns, rules, and raw GET each have a clear role. The main possible confusion is among the several metric/volume/stat tools, but descriptions explicitly steer between them (e.g. query_metric vs query_metric_range vs get_stats vs get_volume).
All names use the loki_ prefix and snake_case, with mostly verb_noun forms such as query_logs, list_labels, and get_volume. Minor deviations are loki_auth_status (noun phrase) and loki_request (bare verb), so the pattern is not perfectly uniform.
14 tools is within the well-scoped range and each covers a distinct Loki read operation; there is no obvious filler. The set is appropriately sized for a read-only Loki observability server.
Core Loki read workflows are covered: auth/config status, log queries, context, instant/range metrics, labels/values/series, detected fields, volume, stats, patterns, rules, and a raw GET escape hatch. A live tail/streaming tool is not present, but otherwise the read surface is comprehensive.