Local Loki MCP server
Lokaler Loki MCP Server
Ein kleiner, schreibgeschützter MCP-Server für eine lokale Grafana-Loki-Instanz. Er ist mit FastAPI und dem offiziellen MCP Python SDK erstellt.
Was er bereitstellt
search_logs(service, start, end, text=None)— durchsucht einen erforderlichen Dienst und optionalen wörtlichen Text innerhalb eines erforderlichen RFC 3339-Zeitbereichs.list_services(start, end)— listet die verfügbaren Service-Label-Werte auf.loki_health()— prüft, ob Loki bereit ist.
Das öffentliche Tool hat keinen limit-Parameter. Die Anfrage lässt auch Lokis
limit-Abfrageparameter aus, sodass Lokis eigener konfigurierter Standard/Maximalwert gilt.
Related MCP server: grafana-mcp
Ausführen
Installieren Sie Python 3.11 oder neuer, erstellen Sie dann eine virtuelle Umgebung und aktivieren Sie sie.
py -3.11 -m venv .venv .\.venv\Scripts\Activate.ps1 pip install -r requirements.txtSetzen Sie Umgebungsvariablen in Ihrer Shell, wenn die Standardwerte nicht zu Ihrer Einrichtung passen.
.env.examplelistet die verfügbaren Einstellungen auf. Die Standardwerte erwarten Loki unterhttp://127.0.0.1:3100und einservice_name-Label.Starten Sie den Server.
uvicorn main:app --reload
Der MCP-Streamable-HTTP-Endpunkt ist http://127.0.0.1:8000/mcp. Der eigene
Health-Endpunkt des Servers ist http://127.0.0.1:8000/health.
Beispiel
Aufruf von search_logs mit:
{
"service": "checkout",
"text": "connection refused",
"start": "2026-08-26T08:00:00Z",
"end": "2026-08-26T09:00:00Z"
}erzeugt diese LogQL-Abfrage:
{service_name="checkout"} |= "connection refused"Wenn Ihre Labels stattdessen app verwenden, starten Sie den Server mit
$env:LOKI_SERVICE_LABEL = "app".
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables querying and formatting Loki logs from Grafana via the Model Context Protocol. It supports LogQL queries, label retrieval, and provides results in text, JSON, or markdown formats.29MIT
- AlicenseNot gradedqualityDmaintenanceThis MCP server enables natural-language querying of Grafana logs by automatically detecting log sources and service labels. It provides read-only access to log data with intelligent caching for efficient repeat queries.23MIT
- FlicenseAqualityDmaintenanceEnables querying OpenTelemetry logs stored in OpenSearch across development and production environments. Provides tools for searching logs by various criteria including free-text Lucene queries, trace IDs, service names, error levels, and specific fields.8
- AlicenseNot gradedqualityCmaintenanceProvides read-only access to Loki, Prometheus, and Tempo APIs, enabling natural language queries for logs, metrics, and traces. Supports multiple instances and authentication via bearer tokens.1MIT
Related MCP Connectors
Read-only access to Auralogs production logs: search logs, inspect errors, review AI analyses.
MEOK ABCI Bridge MCP — read-only Tendermint / Cosmos blockchain query for agents. Built-in registry
Software component catalog: search your org's services, docs, APIs, dependencies, and ownership.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/piotr-szybicki/local-grafana-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server