Skip to main content
Glama
igorolv

loki-mcp-server

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
LOKI_MCP_DATA_DIRNoDirectory for logs and default exports (default: ~/.loki-mcp-server)
LOKI_MCP_CONNECTIONS_FILENoPath to connections.json describing the Loki stands (default: ~/.loki-mcp-server/connections.json)

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

CapabilityDetails
tools
{
  "listChanged": true
}
logging
{}
prompts
{
  "listChanged": true
}
resources
{
  "subscribe": false,
  "listChanged": true
}
completions
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
listConnectionsA

List configured Loki stands with each name, description, operator hint and effective tool limits. Call this first, use the shown windows and page limit, and pass the chosen name as 'connection' to every other tool.

discoverLogsA

Discover labels before writing LogQL. Without label or match, list label names; label="app" lists its values. match="{app=\"api\"}" lists complete stream label sets; add label="namespace" to list namespace values among those sets. Use a narrow match and time window, then countLogs or queryLogs to check log lines.

exportLogsA

Save matching log lines of a window to a local file, oldest first, when the user asks to save logs. Pass the same LogQL query as queryLogs, e.g. {app="backend"} |= "ERROR". Omit format to use the connection's default export format, which is raw unless the operator set a template; format="raw" keeps the lines returned by Loki, including any LogQL line_format stage; a template like "{time} {level:5} [{thread}] {logger} : {message}{stack}" rewrites them locally. Pass a user-specified directory directly; omit it for the default export directory. The answer gives the file path, the line count, and a start value to continue with when a limit stopped it.

countLogsA

Count log lines matching a LogQL log query without returning those lines. Example: query={app="backend"} |= "ERROR", groupBy="time". Omit groupBy for one total, use a label for values, time for buckets, or app,time for both; step="1d" sets the bucket width. For a multi-day label count, query one-day windows separately; only time-only buckets allow seven days by default. A named LogQL regexp capture can supply a groupBy label; inspect matching lines with queryLogs.

queryLogsA

Read a bounded page of log lines matching a LogQL query in a window. The response is chronological, with a compact level, service and message view. Example: {app="backend"} |= "ERROR". Use raw=true to preview the line returned by Loki with its stream labels; long lines are shortened. Use order="oldest" to read forward, repeat with the start or end value in the footer, and use exportLogs for complete files.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

TDQS

A4.7/5.0

Scored across 5 tools

Disambiguation5/5

Each tool targets a distinct phase of the Loki log workflow: connection listing, label discovery, log querying, counting, and file export. No two tools overlap in purpose, and the descriptions make the boundaries between queryLogs, countLogs, and exportLogs explicit.

Naming Consistency5/5

All tool names follow a consistent camelCase verb+noun pattern (listConnections, discoverLogs, exportLogs, countLogs, queryLogs). There are no deviations in style or verb form.

Tool Count5/5

Five tools is well-scoped for a Loki log access server, covering the essential read and export operations without redundancy. Each tool earns its place and the set avoids both bloat and sparseness.

Completeness4/5

The set covers core log retrieval, counting, discovery, and export, but lacks support for arbitrary LogQL metric queries (e.g., rates) and live tailing. These are minor gaps that most log-querying workflows can work around, so coverage is strong but not exhaustive.

Maintenance

ActivityMaintained
ResponsivenessNo issues