tiny-loki-mcp
by myers-gh1328
README.md
# 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.
## Configuration
Environment variables:
- `LOKI_URL`: Loki base URL. Defaults to `http://127.0.0.1:3100`.
- `LOKI_MAX_LIMIT`: maximum entries per query. Defaults to `500`.
- `LOKI_MAX_LOOKBACK_SECONDS`: maximum lookback window. Defaults to `86400`.
- `LOKI_TIMEOUT_MS`: HTTP request timeout. Defaults to `10000`.
## Run
```bash
npm install
npm run build
LOKI_URL=http://127.0.0.1:3100 node dist/index.js
```
## MCP Client Example
```json
{
"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
TDQS
A4.2/5.0
Scored across 4 tools
Disambiguation5/5
Each tool serves a distinct purpose: label discovery, label value listing, LogQL query, and recent log retrieval. No overlap, making selection clear.
Naming Consistency5/5
All tool names follow the consistent pattern 'loki_<descriptive_noun>', with verbs implied (loki_labels > list labels, loki_query > run query). Perfect consistency.
Tool Count5/5
Four tools cover the essential Loki interactions for a lightweight server: discovery, querying, and troubleshooting. Neither too few nor too many.
Completeness4/5
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
ActivityStale
ResponsivenessNo issues