MCP.so
登录

Loki MCP Server

@scottlepp

关于 Loki MCP Server

An MCP ( Model Context Protocol ) Server for Grafana Loki

基本信息

分类

其他

运行时

go

传输方式

stdio

发布者

scottlepp

配置

使用下面的配置,将此服务器添加到你的 MCP 客户端。

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

工具

未检测到工具

工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。

概览

What is Loki MCP Server?

Loki MCP Server is a Go-based server implementation for the Model Context Protocol (MCP) with Grafana Loki integration. It allows AI assistants and MCP-compatible clients to query Loki log data using LogQL via the loki_query tool.

How to use Loki MCP Server?

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.

Key features of Loki MCP Server

  • 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.

Use cases of Loki MCP Server

  • Querying Grafana Loki logs from AI assistants like Claude Desktop.
  • Multi-tenant log analysis with organization ID mapping.
  • Real-time log querying and debugging via natural language prompts.
  • Integration into n8n workflows using the SSE endpoint.
  • Local development and testing of Loki queries with Docker Compose.

FAQ from Loki MCP Server

What dependencies are required?

Go 1.16 or higher is required to build from source. Docker is optional for containerized deployment.

How does authentication work?

Authentication is configured via environment variables: LOKI_USERNAME and LOKI_PASSWORD for basic auth, or LOKI_TOKEN for bearer token. These are used when not specified in the request.

What transports are supported?

The server supports stdin/stdout (standard MCP) and HTTP with Server-Sent Events (SSE) on port 8080, configurable via the SSE_PORT environment variable.

Where does the data live?

The server acts as a proxy to a Grafana Loki server. Log data resides in Loki, which must be reachable via the configured URL (default http://localhost:3100). The server itself does not persist log data.

Can I use it with multi-tenant Loki?

Yes, the org parameter and LOKI_ORG_ID environment variable allow specifying an organization ID, sent as the X-Scope-OrgID header for multi-tenant setups.

评论

其他 分类下的更多 MCP 服务器