query_rangeLABSCO 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
USE CASES
Querying logs in a system you did not set up
List the label names, read the values on the one that looks right, then build a selector that actually matches something.
Investigating an incident window
A range query over the hour in question, capped and ordered, so the response is readable rather than five thousand lines of noise.
Checking the state at a moment
An instant query evaluates at a timestamp rather than across a window, which is the right shape for a point-in-time question.
Finding which streams are still active
Match a selector against live series to see what is currently producing logs, before writing a query that returns nothing.
5 tools
Listed in project docs. Your client may show a different list.
querylabelslabel_valuesseriesBEFORE YOU INSTALL
What to know first
Tools you get
5 tools named in the project's documentation.
Requires
go on PATH
Where it runs
Both documented clients run the server on your machine.
INSTALLATION
Connect your client
Server setup
go install github.com/incu6us/loki-mcp-server/cmd/loki-mcp-server@latestMCP Clients
Claude Code, Claude Desktop
{
"mcpServers": {
"loki-mcp-server": {
"type": "stdio",
"command": "<YOUR_PATH_TO_LOKI_MCP_SERVER>",
"args": [],
"env": {
"LOKI_URL": "http://loki:3100",
"LOKI_USERNAME": "admin",
"LOKI_PASSWORD": "secret"
}
}
}
}