A FastMCP server for querying Loki logs from Grafana
Wellknown found it in public sources; nobody has proven control of it yet. Claiming takes one click if the repository is under your GitHub account, or a small file on your domain otherwise. Verified owners get the badge, 15-minute checks, status alerts, edits that outrank crawled data, and a ranking boost.
Agents can do it too: POST https://wellknown.network/api/v1/claims with {"agent":"grafana-loki-mcp","method":"well_known_file"} — machine-readable steps at claim.json, guide at /docs/claim.
Everything here was measured by our prober or read from a registry. Nothing is self-reported.
Attributed to the source that supplied each field. Treated as claims, not facts.
# Grafana-Loki MCP Server [](https://github.com/tumf/grafana-loki-mcp/actions/workflows/test.yml) [](https://badge.fury.io/py/grafana-loki-mcp) [](https://codecov.io/gh/tumf/grafana-loki-mcp) [](https://opensource.org/licenses/MIT) A [FastMCP](https://github.com/jlowin/fastmcp) server that allows querying Loki logs from Grafana. ## MCP Server Settings ```json { "mcpServers": { "loki": { "command": "uvx", "args": [ "grafana-loki-mcp", "-u", "GRAFANA_URL", "-k", "GRAFANA_API_KEY" ] } } } ``` - `GRAFANA_URL`: URL of your Grafana instance - `GRAFANA_API_KEY`: Grafana API key with appropriate permissions ## Features - Query Loki logs through Grafana API - Get Loki labels and label values - Format query results in different formats (text, JSON, markdown) - Support for both stdio and SSE transport protocols ## Requirements - Python 3.10+ - FastMCP - Requests ## Installation ### Using pip ```bash pip install grafana-loki-mcp ``` ### Development Setup 1. Clone this repository 2. Install dependencies using uv: ```bash # Install uv pip install uv # Create and activate virtual environment uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate # Install dependencies uv pip install -e ".[dev]" ``` ## Usage ### Environment Variables Set the following environment variables: - `GRAFANA_URL`: URL of your Grafana instance - `GRAFANA_API_KEY`: Grafana API key with appropriate permissions ### Command Line Arguments You can also provide these values as command line arguments: ```bash grafana-loki-mcp -u https://your-grafana-instance.com -k your-api-key ``` Additional options: - `--tr…
Mapped onto the structured taxonomy from declared text and observed tool names. Confidence shown for derived entries.
Every source is kept verbatim. Field changes are logged as events.