Other MCP Server · MODEL CONTEXT PROTOCOL

ghrud92 loki mcp

ghrud92 loki mcp is a community-listed Model Context Protocol server. Review the source repository before installation.

WHAT IT CONNECTS

ghrud92 loki mcp 为 AI Agent 提供什么

  • 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 when `logcli` is not available in the environment
  • Node.js v16 or higher
  • TypeScript
  • (Optional) [Grafana Loki logcli](https://grafana.com/docs/loki/latest/tools/logcli/) installed and accessible in your PATH. If `logcli` is not available, the server will automatically use the Loki HTTP API instead
  • Access to a Loki server instance
  • Clone the repository:
  • Install dependencies:
  • Build the project:
  • `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
  • `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
  • Custom path specified by `LOKI_CONFIG_PATH`
  • Current working directory
  • Your home directory (`~/.logcli-config.yaml`)
  • If `logcli` is available, it will be used for all queries, providing the full functionality of the CLI tool
  • If `logcli` is 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

SECURITY

MCP 收录不等于安全审核

MCP 服务器可能获得模型上下文、凭据、本地文件或调用外部系统的权限。连接 Agent 前,请检查代码、环境变量、网络行为、软件包来源与维护状态。