Loki MCP Server
@scottlepp
About Loki MCP Server
An MCP ( Model Context Protocol ) Server for Grafana Loki
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"loki-mcp": {
"command": "docker",
"args": [
"build",
"-t",
"loki-mcp-server",
"."
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
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_querytool 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.
Frequently asked questions
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.
Basic information
More Other MCP servers
IDA Pro MCP
mrexodiaAI-powered reverse engineering assistant that bridges IDA Pro with language models through MCP.
Production-ready MCP integrations for AI applications
Klavis-AIKlavis AI: MCP integration platforms that let AI agents use tools reliably at any scale
Codelf
unbugA search tool helps dev to solve the naming things problem.
π Model Context Protocol (MCP) Curriculum for Beginners
microsoftThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable,

DeepMark
DeepMark helps teachers deliver rapid, consistent marking with meaningful feedback for every student β in a fraction of the time. What once took a week, now takes one free period.
Comments