Use provider loki to query Grafana Loki via HTTP API.
For all tools, scope is your Loki base URL.
Example:
scope: "http://localhost:3100"
You can use either:
LOKI_BEARER_TOKENLOKI_USERNAMEandLOKI_PASSWORD
If both are set, bearer token takes precedence.
Set one of these before starting your MCP client.
Bearer token:
export LOKI_BEARER_TOKEN="your-token"Basic auth:
export LOKI_USERNAME="your-username"
export LOKI_PASSWORD="your-password"Persist across terminal sessions:
cat >> ~/.bashrc <<'EOF'
export LOKI_BEARER_TOKEN="your-token"
EOF
source ~/.bashrcUse your shell profile file (~/.zshrc, ~/.bashrc, or ~/.bash_profile) based on your shell.
Use the basic auth vars instead if that is what your Loki deployment expects.
log_nameis used as label selector input.resource_typecan be used as a selector hint depending on query.
query_logs(scope="http://localhost:3100", log_name="{job=\"payments\"}", start_time="1h", text_filter="failed")
summarize_logs(scope="http://localhost:3100", start_time="6h", severity="ERROR")