An MCP server for querying Grafana Loki directly with a discovery-first workflow — labels, values, series, and LogQL queries without requiring Grafana.
Config is the same across clients — only the file and path differ.
{
"mcpServers": {
"loki-mcp-server": {
"env": {
"LOKI_URL": "http://loki:3100",
"LOKI_PASSWORD": "secret",
"LOKI_USERNAME": "admin"
},
"args": [],
"type": "stdio",
"command": "/path/to/loki-mcp-server"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
An MCP server for querying Grafana Loki directly with a discovery-first workflow — labels, values, series, and LogQL queries without requiring Grafana.
No automated test available for this server. Check the GitHub README for setup instructions.
Five weighted categories — click any category to see the underlying evidence.
No known CVEs.
No package registry to scan.
Click any tool to inspect its schema.
This server is missing a description.If you've used it, help the community.
Add informationBe the first to review
Have you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Others in devops / analytics
MCP server for using the GitLab API
MCP Server for GCP environment for interacting with various Observability APIs.
⚡ A Simple / Speedy / Secure Link Shortener with Analytics, 100% run on Cloudflare.
Enhanced MCP server for GitLab: group projects listing and activity tracking
MCP Security Weekly
Get CVE alerts and security updates for Loki Mcp Server and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
Query Grafana Loki logs directly from AI agents using the Model Context Protocol (MCP).
Built in Go. Enables AI-powered log analysis using LogQL.
Supports integration with:
The official grafana/loki-mcp exposes a single loki_query tool, which means the LLM must already know valid label names and values before it can build a query. This project takes a different approach by providing 5 granular tools — labels, label_values, and series let the LLM discover what's available in Loki first, then construct precise query_range or query calls. The result is more accurate log retrieval with fewer wasted round-trips.
Additionally, this server enforces strict input validation (limit caps, direction validation, label name format checks, mutually exclusive auth) to surface errors early instead of forwarding bad requests to Loki.
brew install incu6us/tap/loki-mcp-server
go install github.com/incu6us/loki-mcp-server/cmd/loki-mcp-server@latest
Or build from source:
git clone https://github.com/incu6us/loki-mcp-server.git
cd loki-mcp
go build -o loki-mcp-server ./cmd/loki-mcp-server
The server is configured entirely via environment variables, injected by the MCP client.
| Variable | Required | Default | Description |
|---|---|---|---|
LOKI_URL | yes | — | Base URL of the Loki instance |
LOKI_USERNAME | no | — | Basic auth username |
LOKI_PASSWORD | no | — | Basic auth password |
LOKI_BEARER_TOKEN | no | — | Bearer token authentication |
LOKI_TLS_SKIP_VERIFY | no | false | Skip TLS certificate verification |
LOKI_TENANT_ID | no | — | X-Scope-OrgID header for multi-tenant deployments |
LOKI_HTTP_TIMEOUT | no | 30s | HTTP request timeout (Go duration, e.g. 10s, 1m) |
Note: Basic auth (
LOKI_USERNAME/LOKI_PASSWORD) and bearer token (LOKI_BEARER_TOKEN) are mutually exclusive.
Add to your Claude Code MCP configuration (~/.claude.json):
{
"mcpServers": {
"loki-mcp-server": {
"type": "stdio",
"command": "/path/to/loki-mcp-server",
"args": [],
"env": {
"LOKI_URL": "http://loki:3100",
"LOKI_USERNAME": "admin",
"LOKI_PASSWORD": "secret"
}
}
}
}
Add to your Claude Desktop config (`~/Library/Application Suppor