query_loki
Query Loki logs through Grafana.
How to use it
query_loki is exposed by the Grafana Loki MCP MCP server. Add the server to your MCP client (Claude Desktop, Cursor, Windsurf and others), and the query_loki tool becomes available to the model automatically. See the full listing for setup details and every tool this server provides.
Install Grafana Loki MCP
pip install grafana-loki-mcpOther tools in Grafana Loki MCP (12)
Query direction ('forward' or 'backward', default: 'backward')
End time (ISO format, Unix timestamp, or Grafana-style relative time like 'now', default: now)
Format Loki query results in a more readable format.
Output format ('text', 'json', or 'markdown', default: 'text')
Get values for a specific label from Loki.
Get all label names from Loki.
Label name
Maximum number of log lines to return (default: 100)
Maximum characters per log line (0 for unlimited, default: 100)
Loki query string
Loki query results from queryloki
Start time (ISO format, Unix timestamp, or Grafana-style relative time like 'now-1h', default: 1 hour ago)