tiny-loki-mcp
Provides read-only access to Grafana Loki logs, allowing agents to query log labels, values, and recent logs via LogQL without exposing Loki's full API.
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., "@tiny-loki-mcp show me recent logs from the web service"
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.
tiny-loki-mcp
tiny-loki-mcp is a small read-only Model Context Protocol server for Grafana
Loki. It exposes a narrow set of tools for agents that need to inspect recent
logs without learning Loki's HTTP API.
Tools
loki_labels: list available label names.loki_label_values: list values for one label.loki_query: run a bounded LogQL range query.loki_recent: fetch recent logs by optional host and service labels.
All tools are read-only. The server does not expose Loki delete, admin, or push APIs.
Related MCP server: Loki MCP Server
Configuration
Environment variables:
LOKI_URL: Loki base URL. Defaults tohttp://127.0.0.1:3100.LOKI_MAX_LIMIT: maximum entries per query. Defaults to500.LOKI_MAX_LOOKBACK_SECONDS: maximum lookback window. Defaults to86400.LOKI_TIMEOUT_MS: HTTP request timeout. Defaults to10000.
Run
npm install
npm run build
LOKI_URL=http://127.0.0.1:3100 node dist/index.jsMCP Client Example
{
"mcpServers": {
"tiny-loki": {
"command": "node",
"args": ["/path/to/tiny-loki-mcp/dist/index.js"],
"env": {
"LOKI_URL": "http://127.0.0.1:3100"
}
}
}
}Safety
The server caps query limits and lookback windows. It returns compact records with labels, timestamp, and line content instead of raw Loki responses.
Dependency Updates
Dependency updates are managed by Dependabot through .github/dependabot.yml.
Dependabot opens weekly grouped PRs for npm and GitHub Actions updates. These
PRs are never auto-merged; review and run the normal verification path before
merge.
Releases
Releases use semantic versioning with vMAJOR.MINOR.PATCH tags. Release notes
are tracked in CHANGELOG.md. Package publishing is not enabled.
License
MIT
Available Tools
4 toolsloki_labelsA
List Loki label names. Use this before querying when you need to discover available dimensions such as host, service, or level. This is read-only and returns only label names.
Inputs: no named parameters.
loki_label_valuesA
List values for one Loki label, such as host or service. Use this to discover valid filter values before running a log query. This is read-only.
Inputs: label (required).
loki_queryA
Run a bounded LogQL range query and return compact log records. Use this when you already know the LogQL selector or need text filters. Do not use this for unbounded or long-history searches; since and limit are capped by server configuration.
Inputs: query (required), since, limit.
loki_recentA
Fetch recent logs by optional host and service labels. Use this for common troubleshooting when you do not need raw LogQL. At least one of host or service should normally be supplied to avoid broad queries.
Inputs: host, service, since, limit.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool serves a distinct purpose: label discovery, label value listing, LogQL query, and recent log retrieval. No overlap, making selection clear.
All tool names follow the consistent pattern 'loki_<descriptive_noun>', with verbs implied (loki_labels > list labels, loki_query > run query). Perfect consistency.
Four tools cover the essential Loki interactions for a lightweight server: discovery, querying, and troubleshooting. Neither too few nor too many.
Core operations for log exploration are present. Missing streaming or advanced filtering, but for a 'tiny' server, the surface is sufficient for common tasks.
Maintenance
Related MCP Connectors
Read-only access to Auralogs production logs: search logs, inspect errors, review AI analyses.
Read-only access to a Lumin project's logs, metrics, uptime checks, alerts and infrastructure.
Ingest and search LogsLoom logs from coding agents.
Query any public logr profile — timelines, events, full context — plus owner-authorized writes.
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
- FlicenseNot gradedqualityDmaintenanceEnables AI models to query and analyze Kubernetes cluster logs through Grafana Loki, supporting semantic operations like error aggregation and pod restart detection. It provides tools for regex-based log searching and namespace discovery to facilitate natural language troubleshooting.-
- AlicenseNot gradedqualityDmaintenanceProvides 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
- FlicenseNot gradedqualityCmaintenanceEnables read-only querying of a local Grafana Loki instance, providing log search, service listing, and health check capabilities.-