Loki MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Loki MCP Serversummarize any errors in the production namespace from the last hour"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Loki MCP Server
An MCP (Model Context Protocol) server for semantic log querying via Loki. Designed to help AI models answer natural language questions about your cluster logs.
Features
Error Summary: Aggregate errors across your cluster with breakdowns by type
Pod Restart Detection: Find crashing/restarting pods
Log Search: Regex-based log search across your cluster
Namespace/Pod Discovery: List available namespaces and query specific pods
Semantic Tool Design: Tool names and parameters match natural language questions
Related MCP server: Log MCP Server
Tools
get_error_summary
Get a summary of errors happening in your cluster.
namespace: Filter to specific namespace (empty = all)hours: Look back this many hours (default: 1)
find_pod_restarts
Find pods that have restarted or crashed recently.
namespace: Filter to specific namespace (empty = all)hours: Look back this many hours (default: 1)
search_logs
Search logs with a regex pattern.
query: Regex pattern to search fornamespace: Filter to specific namespace (empty = all)hours: Look back this many hours (default: 1)limit: Maximum log lines to return (default: 100)
list_namespaces
List all namespaces that have logs in Loki.
get_pod_logs
Get logs for a specific pod.
pod_name: Pod name (supports wildcards likeollama*)namespace: Namespace of the pod (empty = search all)hours: Look back this many hours (default: 1)limit: Maximum log lines to return (default: 100)
Development
# Install dependencies
uv sync
# Run the server
uv run server.pyThe server exposes FastMCP over streamable HTTP at /mcp (default port 8000).
Deployment (In-Cluster)
Add to your local-k8s-apps Helm values with:
Deployment with the MCP server
Exposed via HTTP on port 8000
Environment variable:
LOKI_URLpointing to Loki service
The Ollama MCP bridge will load this server's tools and expose them to the model.
This server cannot be deployed
Maintenance
Related MCP Connectors
Ingest and search LogsLoom logs from coding agents.
Query application logs, traces, and metrics from your AI coding assistant via Foam's MCP server.
Search log events, investigate anomalies, and manage cases in your Knowledge Grid tenant.
Read-only access to Auralogs production logs: search logs, inspect errors, review AI analyses.
Related MCP Servers
- FlicenseAqualityDmaintenanceEnables AI agents to query Prometheus metrics and Loki logs for intelligent alert investigation and troubleshooting. Provides service discovery, metric querying, log searching, and correlation tools to help identify root causes of issues.9-
- AlicenseAqualityCmaintenanceEnables AI assistants to automatically inspect and analyze application runtime log files for debugging and troubleshooting. Supports monitoring multiple log directories simultaneously with tools for listing, reading, searching, and paginating through log files.8MIT
- 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.70 PyPI29MIT
- AlicenseAqualityDmaintenanceEnables read-only querying of Grafana Loki logs through tools like label discovery, LogQL queries, and recent log retrieval, without requiring knowledge of the Loki API.4MIT