Simple Loki MCP Server
About
An MCP server for querying Loki logs via logcli.
Details
- Author
- ghrud92
- Categories
- Developer Tools, Other, Infrastructure
Jump to
Setup
Install Simple Loki MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/ghrud92/loki-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
Loki MCP Server is aModel Context Protocol (MCP)interface for querying Grafana Loki logs usinglogcli. The server enables AI assistants to access and analyze log data from Loki directly.
- Query Loki logs with full LogQL support
- Get label values and metadata
- Authentication and configuration support via environment variables or config files
- Provides formatted results in different output formats (default, raw, JSON lines)
- Automatic fallback to HTTP API whenlogcliis not available in the environment
- Node.js v16 or higher
- TypeScript
- (Optional)Grafana Loki logcliinstalled and accessible in your PATH. Iflogcliis not available, the server will automatically use the Loki HTTP API instead
- Access to a Loki server instance
To install Simple Loki MCP Server for Claude Desktop automatically viaSmithery:
npx -y @smithery/cli install @ghrud92/simple-loki-mcp --client claude
{ "mcpServers": { "simple-loki": { "command": "npx", "args": ["-y", "simple-loki-mcp"], "env": { "LOKI_ADDR": "https://loki.sup.band" } } } }
git clone https://github.com/ghrud92/loki-mcp.git cd loki-mcp
Query logs from Loki with filtering options.
- query(required): Loki query string (LogQL)
- from: Start timestamp (e.g. "2023-01-01T12:00:00Z")
- to: End timestamp (e.g. "2023-01-01T13:00:00Z")
- limit: Maximum number of logs to return
- batch: Batch size for query results
- output: Output format ("default", "raw", or "jsonl")
- quiet: Suppress query metadata
- forward: Display results in chronological order
Retrieve all values for a specific label.
- label(required): Label name to get values for
- LOKI_ADDR: Loki server address (URL)
- LOKI_USERNAME: Username for basic auth
- LOKI_PASSWORD: Password for basic auth
- LOKI_TENANT_ID: Tenant ID for multi-tenant Loki
- LOKI_BEARER_TOKEN: Bearer token for authentication
- LOKI_BEARER_TOKEN_FILE: File containing bearer token
- LOKI_CA_FILE: Custom CA file for TLS
- LOKI_CERT_FILE: Client certificate file for TLS
- LOKI_KEY_FILE: Client key file for TLS
- LOKI_ORG_ID: Organization ID for multi-org setups
- LOKI_TLS_SKIP_VERIFY: Skip TLS verification ("true" or "false")
- LOKI_CONFIG_PATH: Custom path to config file
- DEBUG: Enable debug logging
Note: When the client is using the HTTP API mode (whenlogcliis not available), the same configuration parameters are used to authenticate and connect to the Loki server.
Alternatively, create alogcli-config.yamlfile in one of these locations:
- Custom path specified byLOKI_CONFIG_PATH
- Current working directory
- Your home directory (~/.logcli-config.yaml)
addr: https://loki.example.com username: user password: pass tenant_id: mytenant
The server will automatically check iflogcliis installed and available in the environment:
- Iflogcliis available, it will be used for all queries, providing the full functionality of the CLI tool
- Iflogcliis not available, the server will automatically fall back to using the Loki HTTP API:
- No additional configuration is needed
- The same authentication parameters are used for the HTTP API
- Response formatting is consistent with the CLI output
- Default limit of 1000 logs per query is applied in both modes
This automatic detection ensures that the server works seamlessly in different environments without manual configuration.
# Run linter npm run lint # Fix linting issues npm run lint:fix # Run tests npm run test
This project is licensed under the MIT License - see theLICENSE.mdfile for details.
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
A server for querying Loki logs from Grafana.
An MCP server for log analysis using the LogAI framework, with optional Grafana and GitHub integrations.
A Go-based server to query Grafana Loki logs using the Model Context Protocol (MCP).
Seamlessly bring real-time production context—logs, metrics, and traces—into your local environment to auto-fix code faster.
Provides access to OpenTelemetry traces and metrics through Logfire.
Access and manage Grafana resources, including dashboards, datasources, Prometheus, Loki, and alerting.
Debug and investigate app issues using AI and Grafana Loki
An MCP server for querying distributed tracing data from Grafana Tempo.
Fetch logs, metrics, traces, and events from the Chronosphere observability platform.
Access Grafana resources like dashboards, datasources, Prometheus, Loki, and alerts.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





