MCP Loki
MCP Loki is an MCP server for querying Grafana Loki logs. It enables LLMs to search and analyze logs through the model context protocol, supporting functions such as LogQL querying, label discovery, series exploration, and index statistics.
2 points
4.6K

What is MCP Loki?

MCP Loki is a bridge connecting large language models (LLMs) and the Grafana Loki logging system. It implements the Model Context Protocol (MCP) standard, enabling AI assistants to directly query and analyze log data without users having to manually write complex query statements or log in to the log management interface.

How to use MCP Loki?

Using MCP Loki is very simple: First, configure the MCP client to connect to the Loki server, and then you can interact with the AI assistant in natural language to query logs. For example, you can ask 'Show the nginx error logs from the last hour', and the AI assistant will automatically convert it into the corresponding LogQL query and return the results.

Use cases

MCP Loki is particularly suitable for the following scenarios: Developers need to quickly troubleshoot application issues, operations teams monitor system status, security analysts investigate security incidents, and any team that needs to frequently query and analyze logs. It greatly lowers the technical threshold for log querying.

Main features

LogQL query execution
Supports executing full LogQL range queries, allowing flexible setting of time ranges, limiting the number of returned entries, and query directions.
Label discovery and exploration
Automatically discovers available label names and values to help users build accurate query conditions.
Log stream exploration
Finds log streams that match specific label selectors to help understand the structure and distribution of log data.
Index statistics
Obtains cardinality statistics and size metrics of query results to help optimize query performance.
Multiple authentication methods
Supports basic authentication, Bearer tokens, and multi - tenant authentication, compatible with various Loki deployment environments.
Multi-architecture support
Provides container images for linux/amd64 and linux/arm64 architectures, supporting multiple hardware platforms.
Signed image verification
All container images are verified by cosign keyless signatures to ensure the security of the software supply chain.
Advantages
Simplify log querying: Query logs in natural language without learning complex LogQL syntax
Improve efficiency: AI assistants can quickly analyze large amounts of log data to identify patterns and anomalies
Easy to integrate: Support multiple authentication methods and deployment environments, with simple and flexible configuration
Secure and reliable: Support image signature verification to ensure the trustworthiness of the software source
Cross - platform compatibility: Support multiple hardware architectures and container runtimes
Limitations
Dependent on the Loki backend: Requires a deployed Grafana Loki instance
Network requirements: Requires a network connection to the Loki server
Query performance is limited by Loki: Complex queries may be affected by the backend performance
Requires MCP client support: Must use an AI assistant that supports the MCP protocol

How to use

Prepare the Loki environment
Ensure you have a running Grafana Loki instance and obtain its access address and authentication information.
Configure the MCP client
Add the MCP Loki server configuration to your MCP client configuration file. Choose container running or local installation according to your deployment method.
Start and connect
Start the MCP client, and it will automatically connect to the MCP Loki server. Now you can query logs through the AI assistant.
Start querying
Describe the log content you want to query to the AI assistant in natural language, for example, 'Show the nginx logs containing 'error' in the last hour'.

Usage examples

Application troubleshooting
Developers find that the application is experiencing anomalies and need to quickly view relevant error logs to locate the problem.
System monitoring
The operations team needs to monitor the system health status and regularly check the log output of key services.
Security auditing
The security team needs to investigate potential security incidents and analyze suspicious login attempts.
Performance analysis
Performance engineers need to analyze the application response time and identify performance bottlenecks.

Frequently Asked Questions

What version of Loki does MCP Loki require?
How to configure authentication information?
What time formats are supported?
Is there a limit on the query results?
How to verify the image security?
Does it support HTTP SSE transmission?

Related resources

GitHub repository
Source code, issue tracking, and the latest version
Model Context Protocol documentation
Official specification and documentation of the MCP protocol
Grafana Loki documentation
Complete documentation of the Loki logging system
LogQL query guide
Detailed guide to the LogQL query language
Container image repository
Official container image download

Installation

Copy the following command to your Client for configuration
{
  "mcpServers": {
    "loki": {
      "command": "podman",
      "args": [
        "run", "--rm", "-i",
        "-e", "LOKI_URL=http://loki:3100",
        "ghcr.io/lexfrei/mcp-loki:latest"
      ]
    }
  }
}

{
  "mcpServers": {
    "loki": {
      "command": "mcp-loki",
      "env": {
        "LOKI_URL": "http://loki:3100"
      }
    }
  }
}
Note: Your key is sensitive information, do not share it with anyone.

Alternatives

R
Rsdoctor
Rsdoctor is a build analysis tool specifically designed for the Rspack ecosystem, fully compatible with webpack. It provides visual build analysis, multi - dimensional performance diagnosis, and intelligent optimization suggestions to help developers improve build efficiency and engineering quality.
TypeScript
5.9K
5 points
N
Next Devtools MCP
The Next.js development tools MCP server provides Next.js development tools and utilities for AI programming assistants such as Claude and Cursor, including runtime diagnostics, development automation, and document access functions.
TypeScript
7.7K
5 points
T
Testkube
Testkube is a test orchestration and execution framework for cloud-native applications, providing a unified platform to define, run, and analyze tests. It supports existing testing tools and Kubernetes infrastructure.
Go
5.4K
5 points
M
MCP Windbg
An MCP server that integrates AI models with WinDbg/CDB for analyzing Windows crash dump files and remote debugging, supporting natural language interaction to execute debugging commands.
Python
7.7K
5 points
R
Runno
Runno is a collection of JavaScript toolkits for securely running code in multiple programming languages in environments such as browsers and Node.js. It achieves sandboxed execution through WebAssembly and WASI, supports languages such as Python, Ruby, JavaScript, SQLite, C/C++, and provides integration methods such as web components and MCP servers.
TypeScript
5.2K
5 points
N
Netdata
Netdata is an open-source real-time infrastructure monitoring platform that provides second-level metric collection, visualization, machine learning-driven anomaly detection, and automated alerts. It can achieve full-stack monitoring without complex configuration.
Go
5.9K
5 points
M
MCP Server
The Mapbox MCP Server is a model context protocol server implemented in Node.js, providing AI applications with access to Mapbox geospatial APIs, including functions such as geocoding, point - of - interest search, route planning, isochrone analysis, and static map generation.
TypeScript
6.9K
4 points
U
Uniprof
Uniprof is a tool that simplifies CPU performance analysis. It supports multiple programming languages and runtimes, does not require code modification or additional dependencies, and can perform one-click performance profiling and hotspot analysis through Docker containers or the host mode.
TypeScript
6.7K
4.5 points
M
Markdownify MCP
Markdownify is a multi-functional file conversion service that supports converting multiple formats such as PDFs, images, audio, and web page content into Markdown format.
TypeScript
30.0K
5 points
N
Notion Api MCP
Certified
A Python-based MCP Server that provides advanced to-do list management and content organization functions through the Notion API, enabling seamless integration between AI models and Notion.
Python
18.8K
4.5 points
D
Duckduckgo MCP Server
Certified
The DuckDuckGo Search MCP Server provides web search and content scraping services for LLMs such as Claude.
Python
59.4K
4.3 points
G
Gitlab MCP Server
Certified
The GitLab MCP server is a project based on the Model Context Protocol that provides a comprehensive toolset for interacting with GitLab accounts, including code review, merge request management, CI/CD configuration, and other functions.
TypeScript
20.5K
4.3 points
U
Unity
Certified
UnityMCP is a Unity editor plugin that implements the Model Context Protocol (MCP), providing seamless integration between Unity and AI assistants, including real - time state monitoring, remote command execution, and log functions.
C#
25.2K
5 points
F
Figma Context MCP
Framelink Figma MCP Server is a server that provides access to Figma design data for AI programming tools (such as Cursor). By simplifying the Figma API response, it helps AI more accurately achieve one - click conversion from design to code.
TypeScript
54.9K
4.5 points
M
Minimax MCP Server
The MiniMax Model Context Protocol (MCP) is an official server that supports interaction with powerful text-to-speech, video/image generation APIs, and is suitable for various client tools such as Claude Desktop and Cursor.
Python
38.8K
4.8 points
G
Gmail MCP Server
A Gmail automatic authentication MCP server designed for Claude Desktop, supporting Gmail management through natural language interaction, including complete functions such as sending emails, label management, and batch operations.
TypeScript
18.7K
4.5 points
AIBase
Zhiqi Future, Your AI Solution Think Tank
© 2026AIBase