grafana-loki-mcp

grafana-loki-mcp

7

Grafana-Loki MCP Server is a FastMCP server that allows querying Loki logs through the Grafana API. It offers multiple features such as retrieving Loki labels and label values, formatting results in different formats, and supporting various transport protocols. The project requires Python 3.10+ and is licensed under MIT.

Grafana-Loki MCP Server

  • A server leveraging FastMCP to enable querying Loki logs from Grafana.
  • Features:
    • Query Loki logs through Grafana API
    • Retrieve Loki labels and values
    • Format query results in text, JSON, or markdown
    • Supports stdio and SSE transport protocols
  • Requirements:
    • Python 3.10+
    • FastMCP
    • Requests
  • Installation:
    • Install via pip: pip install grafana-loki-mcp
  • Usage:
    • Use environment variables GRAFANA_URL and GRAFANA_API_KEY
    • Command line execution: grafana-loki-mcp -u [URL] -k [API_KEY]
    • Supports --transport option for protocol type
  • Development:
    • Testing: pytest, Coverage: pytest --cov=. --cov-report=term
    • Linting and Formatting: ruff, black, mypy