mcp-logging
v1.2.0
Published
A Model Context Protocol (MCP) server for querying Loki and Prometheus endpoints.
Readme
loki-mcp
A Model Context Protocol (MCP) server for querying Loki and Prometheus endpoints.
Environment Variables
Set these in your .env file (see .env.example):
LOKI_TOKEN: Bearer token for Loki API authenticationPROMETHEUS_TOKEN: Bearer token for Prometheus API authenticationLOKI_ENDPOINT: Base URL for Loki API (e.g.,https://your-loki-endpoint/)PROM_ENDPOINT: Base URL for Prometheus API (e.g.,https://your-prometheus-endpoint/)DEBUG: Set totrueto enable verbose debug logging (logs request/response/error details for all tools)
Usage
Install dependencies and run the server:
npm install
npm run build
node build/index.jsTools Provided
1. query-loki
Query a Loki endpoint with a given query string.
Parameters:
query(string, required): Loki query stringlimit(number, optional): Max entries to return (default: 100)startrfc(string, optional): RFC3339 start timeendrfc(string, optional): RFC3339 end time
2. loki-labels
Query a Loki endpoint for available labels.
Parameters: None
3. query-prometheus
Query a Prometheus endpoint with a given query string.
Parameters:
query(string, required): Prometheus query stringtime(string, optional): Evaluation timestamp (RFC3339 or Unix)timeout(string, optional): Query timeout (e.g.,30s,1m)
4. prometheus-stats
List available Prometheus stats from the endpoint.
Parameters: None
Notes
- The server runs over stdio and is intended to be used as an MCP tool provider.
- All API requests use Bearer authentication and expect JSON responses.
- For Prometheus stats, the server requests uncompressed responses to avoid decompression errors.
