Grafana-Loki MCP Server
@tumf
About Grafana-Loki MCP Server
Grafana Loki MCP Repository
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"grafana-loki-mcp": {
"command": "uv",
"args": [
"venv"
]
}
}
}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 Grafana-Loki MCP Server?
It is a FastMCP server that allows querying Loki logs from a Grafana instance. It is intended for developers and operations teams who need to interact with Loki log data programmatically through the Model Context Protocol.
How to use Grafana-Loki MCP Server?
Install via pip install grafana-loki-mcp or run with uvx grafana-loki-mcp. Configure it by setting the GRAFANA_URL and GRAFANA_API_KEY environment variables, or pass them as command-line arguments (-u and -k). The server supports both stdio and SSE transport protocols.
Key features of Grafana-Loki MCP Server
- Query Loki logs through the Grafana API
- Retrieve Loki label names and label values
- Format query results as text, JSON, or markdown
- Supports stdio and SSE transport protocols
- Accepts Grafana-style relative time ranges (e.g.,
now-1h) - Limits log line length per entry (configurable max per line)
Use cases of Grafana-Loki MCP Server
- Integrate Loki log queries into MCP‑compatible AI assistants and tools
- Automate log analysis pipelines by fetching and formatting logs
- Programmatically retrieve label metadata for log exploration
- Build custom log dashboards or alerts using external scripts
FAQ from Grafana-Loki MCP Server
What are the runtime requirements?
Python 3.10 or higher, plus the FastMCP and Requests libraries.
How do I configure the server with Grafana?
Provide your Grafana instance URL and API key either via environment variables (GRAFANA_URL, GRAFANA_API_KEY) or with command-line arguments -u and -k.
What transport protocols does the server support?
It supports both stdio (default) and sse (set with --transport sse).
How can I query logs and format the results?
Use the query_loki tool with parameters such as query, start, end, limit, direction, and max_per_line. Pass the results to format_loki_results to output them in text, JSON, or markdown.
Frequently asked questions
What are the runtime requirements?
Python 3.10 or higher, plus the FastMCP and Requests libraries.
How do I configure the server with Grafana?
Provide your Grafana instance URL and API key either via environment variables (`GRAFANA_URL`, `GRAFANA_API_KEY`) or with command-line arguments `-u` and `-k`.
What transport protocols does the server support?
It supports both `stdio` (default) and `sse` (set with `--transport sse`).
How can I query logs and format the results?
Use the `query_loki` tool with parameters such as `query`, `start`, `end`, `limit`, `direction`, and `max_per_line`. Pass the results to `format_loki_results` to output them in text, JSON, or markdown.
Basic information
More Developer Tools MCP servers

Apiosk
obcraftAI-native payments for tools and APIs. Discover, pay for, execute, and publish monetized APIs directly from your agent, settled per call in USDC over x402, through the Model Context Protocol. payments · finance · x402 ·
ZeroBeacon — 1000-Tool Collision-Proof Commerce Router
DavidFox998ZeroBeacon.ai — Collision-proof commerce router for AI agents. 1000 MCP tools: commerce, trust, billing, sovereign ID + everyday tools. LIVE.

Codex Pets
astandrikPublic read-only MCP server for discovering, inspecting, installing, and sharing approved Codex-compatible animated pet packs.

directree
coburn2716directree MCP server — query the honest software directory from any AI assistant

Skilder.ai
skilder.aiRun skills and MCP tools like production software: versioned, composed into roles, distributed to every agent from one governed library.
Comments