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.

コメント

「その他」の他のコンテンツ