Loki MCP Server

by scottlepp

153 stars
395 downloads
Not rated
GitHub Website

About

A Go-based server to query Grafana Loki logs using the Model Context Protocol (MCP).

Details

Author
scottlepp
GitHub stars
153
Downloads
395
Categories
Developer Tools, Other, Infrastructure

- Provides a loki_query tool for executing LogQL queries.
- Supports both stdin/stdout and SSE (HTTP) communication modes.
- Configurable via environment variables (LOKI_URL, LOKI_ORG_ID, LOKI_USERNAME, LOKI_PASSWORD, LOKI_TOKEN).
- Can be run locally with Docker Compose including Loki, Grafana, and a log generator.
- Supports multi-tenant setups via the X-Scope-OrgID header.
- Includes a test client and scripts for verification.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Loki MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Build and run the server with Go (go build / go run) or Docker. It communicates using stdin/stdout and also supports HTTP with Server-Sent Events (SSE). Configuration is done through environment variables for Loki URL, organization ID, and authentication. To use with Claude Desktop, add the server to the MCP configuration file.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "loki mcp server": {
            "loki-mcp": {
                "command": "docker",
                "args": [
                    "build",
                    "-t",
                    "loki-mcp-server",
                    "."
                ]
            }
        }
    }
}

McpServers

{
    "loki-mcp": {
        "command": "docker",
        "args": [
            "build",
            "-t",
            "loki-mcp-server",
            "."
        ]
    }
}

Loki MCP Server

CI

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:

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.