igorolv

Loki MCP Server — AI skill for Claude Code

AI community

Read-only MCP server for Grafana Loki: lets AI agents (Claude Code, Cursor, Copilot) discover labels, read bounded LogQL pages, count lines by label or time, and export logs — across several Loki stan.

How to install Loki MCP Server

This entry records only its repository, not the path inside it, so there is no exact command to give. Open igorolv/loki-mcp-server and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Loki MCP Server does

Read-only MCP server for Grafana Loki: lets AI agents (Claude Code, Cursor, Copilot) discover labels, read bounded LogQL pages, count lines by label or time, and export logs — across several Loki stands

Alternatives in AI

README

Loki MCP Server

[![build](https://github.com/igorolv/loki-mcp-server/actions/workflows/build.yml/badge.svg)](https://github.com/igorolv/loki-mcp-server/actions/workflows/build.yml) [![Release](https://img.shields.io/github/v/release/igorolv/loki-mcp-server?include_prereleases)](https://github.com/igorolv/loki-mcp-server/releases/latest) [![License](https://img.shields.io/github/license/igorolv/loki-mcp-server)](LICENSE) [![Java 21](https://img.shields.io/badge/Java-21%2B-blue?logo=openjdk)](https://adoptium.net/) [![MCP](https://img.shields.io/badge/MCP-server-8A2BE2)](https://modelcontextprotocol.io/) [![Glama score](https://glama.ai/mcp/servers/igorolv/loki-mcp-server/badges/score.svg)](https://glama.ai/mcp/servers/igorolv/loki-mcp-server) [![Listed on mcpservers.org](https://mcpservers.org/badge.svg)](https://mcpservers.org/servers/igorolv/loki-mcp-server)

A local stdio MCP server for reading Grafana Loki with an agent. It exposes five text tools and supports Loki 2.6.1 and 3.x. Loki itself is read only; the only write is a local exportLogs file.

Tool Purpose
listConnections Show configured stands, operator hints and effective tool limits
discoverLogs List label names, values of one label, matching stream label sets, or values among those sets
queryLogs Read newest or oldest bounded pages of a LogQL log query as compact text; raw=true previews returned lines and stream labels
countLogs Count matching lines on Loki, optionally by label, clock aligned time bucket or both
exportLogs Save matching lines to a local file, raw or rendered with a template

Every data tool requires an explicit connection. queryLogs, countLogs and exportLogs require a LogQL **log query**, such as {app="backend"} |= "ERROR". Use discoverLogs to find label names, values and real combinations in stream label sets. The server builds only the count_over_time expression for countLogs; it does not infer filters or interpret causes. Tool responses