Loki MCP Server
by scottlepp
The Loki MCP Server is a Go-based implementation of the Model Context Protocol (MCP) designed to integrate with Grafana Loki. It allows you to query Loki log data using MCP-compatible clients like Claude Desktop and Cursor.
Last updated: N/A
What is Loki MCP Server?
The Loki MCP Server is a Go server that implements the Model Context Protocol (MCP) to provide a loki_query
tool for querying Grafana Loki log data. It communicates via stdin/stdout, making it compatible with MCP clients.
How to use Loki MCP Server?
To use the server, you can build and run it directly with Go, use Docker, or integrate it with MCP-compatible applications like Claude Desktop or Cursor. The loki_query
tool requires a LogQL query string and optionally accepts parameters for Loki URL, start time, end time, and limit. Configuration examples are provided for Claude Desktop and Cursor.
Key features of Loki MCP Server
Implements Model Context Protocol (MCP)
Provides a
loki_query
tool for querying Grafana LokiSupports environment variables for configuration
Includes Docker support for easy deployment
Offers integration examples for Claude Desktop and Cursor
Use cases of Loki MCP Server
Querying Grafana Loki logs from Claude Desktop
Integrating Loki queries into the Cursor editor
Automating log analysis using MCP-compatible tools
Providing a standardized interface for querying logs
Testing Loki queries locally with Docker Compose
FAQ from Loki MCP Server
What is MCP?
What is MCP?
Model Context Protocol (MCP) is a protocol for communication between applications and tools, often used in AI development environments.
What is Grafana Loki?
What is Grafana Loki?
Grafana Loki is a horizontally scalable, highly available, multi-tenant log aggregation system inspired by Prometheus.
How do I configure the Loki server URL?
How do I configure the Loki server URL?
The Loki server URL can be configured using the url
parameter in the loki_query
tool or by setting the LOKI_URL
environment variable.
How do I test the MCP server?
How do I test the MCP server?
You can use the provided client (cmd/client
) to test the MCP server with various Loki queries. Docker Compose setup is also available for local testing.
What are the advantages of using Docker?
What are the advantages of using Docker?
Using Docker packages all dependencies and environment variables in a container, making deployment and integration more reliable.