loki-mcp

MCP.Pizza Chef: grafana

Grafana Loki collects logs from running systems, and finding anything in it normally means writing a query in its own language. This lets an assistant do that part: you describe what you are looking for and it fetches the matching entries. Useful when something broke and you want the relevant lines rather than a dashboard. It runs in Claude Desktop and Cursor, and connects to a Loki setup you already have.

Coding
Data

Use This MCP server To

Find the errors from the last hour Search logs for a specific request Check what happened just before a crash Count how often an error appeared Pull logs for one service only Get a plain summary of recent failures

README

Loki MCP Server

A Go-based server implementation for the Model Context Protocol (MCP) with Grafana Loki integration.

Getting Started

Prerequisites

  • Go 1.16 or higher

Building and Running

Build and run the server:

# Build the server
go build -o loki-mcp-server ./cmd/server

# Run the server
./loki-mcp-server

Or run directly with Go:

go run ./cmd/server

The server communicates using stdin/stdout following the Model Context Protocol (MCP). This makes it suitable for use with Claude Desktop and other MCP-compatible clients. It does not run as an HTTP server on a port.

Project Structure

.
├── cmd/
│   ├── server/       # MCP server implementation
│   └── client/       # Client for testing the MCP server
├── internal/
│   ├── handlers/     # Tool handlers
│   └── models/       # Data models
├── pkg/
│   └── utils/        # Utility functions and shared code
└── go.mod            # Go module definition

MCP Server

The Loki MCP Server implements the Model Context Protocol (MCP) and provides the following tools:

loki-mcp FAQ

Can I use this to find out what broke without writing a query?
Yes — you describe what you are after and it fetches the matching log lines for you.
Do I need my own Loki setup?
Yes, it connects to a Grafana Loki instance you already run; it does not store logs itself.
Which apps does it work with?
It is documented for Claude Desktop and Cursor, and works with other assistants that support this connection.
Do I need an account or key?
No separate key is needed beyond whatever access your own Loki setup requires.
How hard is it to set up?
You build or run it with Docker and point it at your Loki address, so it is a technical setup.