2026-02-22 21:19:28 -07:00
|
|
|
"""
|
|
|
|
|
Loki MCP Server - Configuration
|
|
|
|
|
|
2026-02-24 12:35:04 -07:00
|
|
|
Settings for connecting to your Loki instance via its HTTP API.
|
|
|
|
|
Uses environment variables with sensible defaults.
|
2026-02-22 21:19:28 -07:00
|
|
|
|
|
|
|
|
Environment variables:
|
2026-02-24 12:35:04 -07:00
|
|
|
LOKI_URL - Base URL for your Loki instance
|
|
|
|
|
LOKI_TIMEOUT - Request timeout in seconds (default: 30)
|
|
|
|
|
LOKI_DEFAULT_LIMIT - Default number of log lines to return (default: 100)
|
|
|
|
|
LOKI_MCP_ENABLED - Enable/disable integration (default: true)
|
2026-02-22 21:19:28 -07:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
# Connection settings
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
2026-02-24 12:35:04 -07:00
|
|
|
# The URL where Loki is reachable (through Caddy reverse proxy).
|
2026-02-22 21:19:28 -07:00
|
|
|
LOKI_URL = os.getenv("LOKI_URL", "https://loki.apophisnetworking.net")
|
|
|
|
|
|
|
|
|
|
# How long (seconds) to wait for Loki to respond before giving up.
|
|
|
|
|
LOKI_TIMEOUT = int(os.getenv("LOKI_TIMEOUT", "30"))
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
# Query defaults
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# How many log lines to return if the caller doesn't specify.
|
|
|
|
|
DEFAULT_LIMIT = int(os.getenv("LOKI_DEFAULT_LIMIT", "100"))
|
|
|
|
|
|
|
|
|
|
# Default time range for queries if none specified (in hours).
|
|
|
|
|
DEFAULT_RANGE_HOURS = 1
|
2026-02-24 12:35:04 -07:00
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
# Feature flag
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
# Set to "false" to disable the integration without removing config
|
|
|
|
|
LOKI_MCP_ENABLED = os.getenv(
|
|
|
|
|
"LOKI_MCP_ENABLED", "true"
|
|
|
|
|
).lower() in ("true", "1", "yes")
|