- Home
- MCP servers
- Simple Loki
Simple Loki
- typescript
5
GitHub Stars
typescript
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"ghrud92-simple-loki-mcp": {
"command": "npx",
"args": [
"-y",
"simple-loki-mcp"
],
"env": {
"DEBUG": "true",
"LOKI_ADDR": "https://loki.sup.band",
"LOKI_ORG_ID": "org-1",
"LOKI_CA_FILE": "/path/to/ca.pem",
"LOKI_KEY_FILE": "/path/to/key.pem",
"LOKI_PASSWORD": "pass",
"LOKI_USERNAME": "user",
"LOKI_CERT_FILE": "/path/to/cert.pem",
"LOKI_TENANT_ID": "mytenant",
"LOKI_CONFIG_PATH": "/home/user/.logcli-config.yaml",
"LOKI_BEARER_TOKEN": "YOUR_TOKEN",
"LOKI_TLS_SKIP_VERIFY": "true",
"LOKI_BEARER_TOKEN_FILE": "/path/to/token.txt"
}
}
}
}Simple Loki MCP Server provides an MCP interface to query Grafana Loki logs using logcli when available, with a seamless fallback to the Loki HTTP API. It lets you run LogQL queries, retrieve label values, and get metadata, all through a single MCP-enabled endpoint.
How to use
You interact with the Simple Loki MCP Server from an MCP client to run Loki queries and fetch log data. Use the available tools to query logs, retrieve label values, or list labels. If logcli is installed in your environment, the server will use it for the queries; otherwise it falls back to Loki's HTTP API automatically. The server returns results in formats like default, raw, or JSON lines, and supports authentication via configured environment variables or config files.
How to install
Prerequisites you need before installing the server:
- Node.js v16 or higher
- TypeScript
- (Optional) Grafana Loki logcli installed and accessible in your PATH — if logcli is not available, the server will automatically use the Loki HTTP API
To run the MCP configuration shown here, use the following MCP setup. This config runs the server via npx and passes the required environment variable for the Loki address.
{
"mcpServers": {
"simple-loki": {
"command": "npx",
"args": ["-y", "simple-loki-mcp"],
"env": {
"LOKI_ADDR": "https://loki.sup.band"
}
}
}
}
Additional setup steps
If you prefer a direct development flow, you can install dependencies and run the server locally. The following steps assume you will build and start from source.
# 1) Install dependencies
npm install
# 2) Build the project
npm run build
# 3) Start the server
npm start
Available tools
query-loki
Query Loki logs with filtering options including LogQL, time range, and output format.
get-label-values
Retrieve all values for a specific Loki label.
get-labels
Retrieve all available Loki labels.