Loki MCP Server

MCP server for querying Loki logs via logcli

Local serverstdioTypeScript

What is the Loki MCP MCP server?

Loki MCP MCP server exists for a simple reason — assistants are far more useful when they can act on Loki MCP directly instead of describing what you should do. MCP server for querying Loki logs via logcli.

What you get

Loki MCP Server is a Model Context Protocol (MCP) interface for querying Grafana Loki logs using logcli. The server enables AI assistants to access and analyze log data from Loki directly.

  • Query Loki logs with full LogQL support
  • Get label values and metadata
  • Authentication and configuration support via environment variables or config files
  • Provides formatted results in different output formats (default, raw, JSON lines)
  • Automatic fallback to HTTP API when logcli is not available in the environment

Configuration and credentials

You will need 5 environment variables: LOKI_ADDR, LOKI_TENANT_ID, LOKI_BEARER_TOKEN, LOKI_ORG_ID, LOKI_CONFIG_PATH. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

  • Node.js v16 or higher - TypeScript - (Optional) Grafana Loki logcli installed and accessible in your PATH. If logcli is not available, the server will automatically use the Loki HTTP API instead - Access to a Loki server instance

Setting it up

Installation goes through your MCP client rather than a global install: point it at @smithery/cli on npm and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

Choosing this one

Among the monitoring and observability options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. It is maintained by ghrud92; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Before you rely on it

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the loki mcp mcp server does with a few real requests.

How to install the Loki MCP MCP server

### for MCP

```json
{
  "mcpServers": {
    "simple-loki": {
      "command": "npx",
      "args": ["-y", "simple-loki-mcp"],
      "env": {
        "LOKI_ADDR": "https://loki.sup.band"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

  • Node.js v16 or higher - TypeScript - (Optional) Grafana Loki logcli installed and accessible in your PATH. If logcli is not available, the server will automatically use the Loki HTTP API instead - Access to a Loki server instance
VariableDescriptionRequired
LOKI_ADDRConfiguration value read at startup.Optional
LOKI_TENANT_IDConfiguration value read at startup.Optional
LOKI_BEARER_TOKENCredential the server authenticates with.Yes
LOKI_ORG_IDConfiguration value read at startup.Optional
LOKI_CONFIG_PATHFilesystem location the server is allowed to use.Optional

Frequently asked questions

It connects Loki MCP to MCP-compatible AI assistants such as Claude and Cursor. Instead of copying data back and forth by hand, the assistant works with Loki MCP directly.