Simple Loki MCP Server is an MCP server that connects AI assistants to Grafana Loki log aggregation instances using logcli or direct HTTP calls. Built for software engineers, DevOps practitioners, and site reliability teams, it enables language models to inspect application and infrastructure logs directly within conversational interfaces. Users can execute arbitrary LogQL queries, inspect available log streams, and discover label names and values to pinpoint errors and diagnose production incidents. The server functions primarily by leveraging the Grafana Loki logcli binary when available on the host system. If logcli is not installed or accessible in the execution environment, the server automatically falls back to interacting with the standard Loki HTTP API without requiring separate configuration. In addition to basic query execution, the tool supports configurable time windows, output format adjustments across raw text, default log formatting, and JSON lines, as well as multi-tenant setups via dedicated tenant identifiers. Authentication accommodates HTTP basic authentication, bearer tokens, and custom TLS certificate configurations, allowing teams to safely connect LLM agents to internal Loki monitoring infrastructure.
Category: Developer Tools & Code Intelligence
Tags: logcli, logs, loki, monitoring
npx -y @smithery/cli install @ghrud92/simple-loki-mcp --client claude. 2. Alternatively, add the server to your MCP client configuration manually: json { "mcpServers": { "simple-loki": { "command": "npx", "args": ["-y", "simple-loki-mcp"], "env": { "LOKI_ADDR": "https://loki.example.com" } } } } 3. Configure authentication parameters as needed using environment variables like LOKI_USERNAME, LOKI_PASSWORD, or LOKI_BEARER_TOKEN. 4. Restart your MCP client to access the query-loki, get-labels, and get-label-values tools.Part of MCP Servers
Simple Loki MCP Server is an open source Model Context Protocol server that allows AI assistants to query and analyze logs stored in Grafana Loki. It acts as a bridge using either the logcli command-line utility or Loki HTTP API.
No, logcli is optional. If logcli is installed and in your system PATH, the server utilizes it for queries. If logcli is not found, the server automatically falls back to connecting directly via the Loki HTTP API using identical credentials.
The server provides three MCP tools: query-loki for querying log streams using LogQL syntax and timestamp filters, get-labels for retrieving all available stream labels from Loki, and get-label-values for listing the discrete values associated with any specific label.
Any Model Context Protocol compatible client works with Simple Loki MCP Server, including Claude Desktop. You can register the server directly using the Smithery CLI or configure it manually using npx and environment variables within your client configuration file.
Yes, Simple Loki MCP Server is open source software released under the MIT License. Developers are free to inspect, modify, and distribute the source code. You can find the full code repository and licensing details at https://github.com/ghrud92/loki-mcp.