get_label_valuesLABSCO SUMMARY
The discovery calls are what make a LogQL query writable, not just runnable.
An assistant that cannot see your label schema writes LogQL that returns nothing, and no error explains why — get_labels and get_label_values close that gap. The fallback from the command-line client to the HTTP API means the server works in a container where that client was never installed, without a second configuration path to maintain.
What it is
An MCP server over Grafana Loki. It shells out to the Loki command-line client when that is available and falls back to Loki's HTTP API when it is not, using the same connection settings either way.
What you get
- query_loki — a LogQL query with a time range, a result limit, a batch size, an output format and chronological ordering
- get_labels — every label the Loki instance exposes
- get_label_values — every value for one label, so a query can be built from what actually exists
- Results formatted the same way whether the command-line client or the HTTP API served them
Requirements
Node, and access to a Loki instance whose address you configure. The Loki command-line client is optional. Basic auth, bearer tokens, tenant and organisation IDs and client TLS certificates are all supported, through your client config or a config file the Loki client already reads.
Setup effort
Add the configuration to your client
USE CASES
Querying logs when you do not know the label schema
List the labels, list the values for the one that looks right, then write a query that can actually match.
Pulling the log window around an incident
Run a LogQL query bounded by start and end timestamps and read it in chronological order.
Getting logs out in a machine-readable shape
Ask for JSON lines and suppress the query metadata so the output can be piped onward.
3 tools
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
get_labelsquery_lokiBEFORE YOU INSTALL
What to know first
Tools you get
3 tools when we connected. The registered names use underscores (query_loki, get_labels, get_label_values), not the documented hyphens. Queries default to 1000 logs and truncate silently unless you set limit.
Requires
- npx on PATH
- Node.js v16 or later
Where it runs
The documented client runs the server on your machine.
CONTEXT COST
Light Standing cost
Rated by the size of the 3 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
Connect your client
MCP Clients
Any MCP client
{
"mcpServers": {
"simple-loki": {
"command": "npx",
"args": [
"-y",
"simple-loki-mcp"
],
"env": {
"LOKI_ADDR": "https://loki.sup.band"
}
}
}
}Set LOKI_ADDR to the URL of your own Loki server — https://loki.sup.band is the host in the author's example, not a default. If your Loki needs credentials, add LOKI_USERNAME and LOKI_PASSWORD, LOKI_BEARER_TOKEN, or LOKI_TENANT_ID under env.