feat: Add Loki MCP server scaffold, fix adapter blocking, upgrade model
- Scaffold mcp_servers/loki/ with config and async HTTP client - Fix Slack/Telegram adapters to use non-blocking connections - Upgrade default model to claude-sonnet-4-6 - Improve Agent SDK message collection for empty ResultMessage cases - Add Message-ID to email summaries, increase body truncation limit - Fix .gitignore inline comments that broke sensitive file exclusions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
32
mcp_servers/loki/loki_client.py
Normal file
32
mcp_servers/loki/loki_client.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import httpx
|
||||
from config import LokiConfig
|
||||
|
||||
|
||||
class LokiClient:
|
||||
"""Talks to Loki's HTTP API to fetch logs."""
|
||||
|
||||
def __init__(self, config: LokiConfig):
|
||||
# Store the config so we can use it later
|
||||
self.config = config
|
||||
|
||||
# Create an HTTP client
|
||||
# already knows Loki address and wait time
|
||||
self.client = httpx.AsyncClient(
|
||||
base_url=config.url,
|
||||
timeout=config.timeout
|
||||
)
|
||||
|
||||
async def query_range(self, query: str, start: str, end: str, limit: int = 100):
|
||||
# Makes GET request to Loki's query endpoint with search parameters
|
||||
response = await self.client.get(
|
||||
"/loki/api/v1/query_range",
|
||||
params={
|
||||
"query": query,
|
||||
"start": start,
|
||||
"end": end,
|
||||
"limit": limit
|
||||
}
|
||||
)
|
||||
|
||||
# Returns response into Python Dict
|
||||
return response.json()
|
||||
Reference in New Issue
Block a user