logintel-mcp

v1.0.1
logintel-mcp Checked 2 days ago Published 6 months ago

Universal MCP server for application log intelligence across Datadog, Grafana Loki, AWS CloudWatch, and local files.

Ask your AI assistant questions like: - *"Why did orders spike at 2 AM?"* - *"Find all timeout errors in the payment service from last hour"* - *"Correlate 500 errors across api, payment, and db services"* - *"Compare error rates before and after the deployment at 3 PM"* Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

Summary extracted from the README.

LogIntel MCP Server

Python 3.11+ Poetry License: MIT Tests

Universal Model Context Protocol (MCP) server that connects LLMs to application logs across Datadog, Grafana Loki, AWS CloudWatch, and local log files.

Ask your AI assistant questions like:

  • "Why did orders spike at 2 AM?"
  • "Find all timeout errors in the payment service from last hour"
  • "Correlate 500 errors across api, payment, and db services"
  • "Compare error rates before and after the deployment at 3 PM"

Features

  • πŸ”Œ Multi-backend support β€” Datadog, Grafana Loki, AWS CloudWatch, local files
  • πŸ” Natural language queries β€” Ask in plain English, get structured results
  • πŸ“ Local file provider β€” Search, filter, tail, and aggregate JSON/regex/plain-text logs
  • ☁️ CloudWatch provider β€” Query AWS CloudWatch Logs Insights with natural language
  • πŸ“Š Datadog provider β€” Search and aggregate via Datadog Logs v2 API
  • πŸ”₯ Loki provider β€” Query Grafana Loki with LogQL label matchers and metric queries
  • 🧠 Intelligent analysis β€” Root cause analysis, cross-service correlation, anomaly detection
  • πŸ”— Cross-service correlation β€” Trace ID, timestamp proximity, and field matching
  • ⚑ Caching & pagination β€” TTL cache for repeated queries; cursor-based pagination
  • πŸ›‘οΈ Read-only by default β€” Safe to use in production; no log mutation

MCP Tools

Tool Description
list_log_sources List all configured log sources
get_source_health Check connectivity of a source
get_source_schema Get field/schema info for a source
search_logs Search logs with natural language or query
filter_logs Filter by time, level, service, host, custom fields
tail_logs Return latest N entries from a source
aggregate_logs Count/group by field, time bucketing
summarize_logs Generate natural language summary
correlate_logs Cross-source correlation by trace_id or timestamp
analyze_root_cause Multi-step incident root cause analysis
compare_time_periods Before/after comparison with diff report
detect_error_patterns Detect recurring error patterns
find_anomalies Statistical anomaly detection
natural_language_to_query Translate NL to provider query syntax
explain_query Explain a provider-native query in plain English

MCP Prompts

Prompt Description
investigate_incident Structured 6-step SRE investigation workflow
oncall_summary Generate a concise shift summary

Quick Start

Installation

pip install logintel-mcp

# Or with uv
uv pip install logintel-mcp
uvx -y logintel-mcp --config ~/.logintelrc.yaml

npm (wrapper)

npx -y logintel-mcp-server --config ~/.logintelrc.yaml

Docker (GHCR)

docker run --rm -v "$HOME/.logintelrc.yaml:/etc/logintel/.logintelrc.yaml" \
  ghcr.io/firas-mcp-servers/logintel-mcp-server:latest

From source

git clone https://github.com/firas-mcp-servers/logintel-mcp-server.git
cd logintel-mcp-server
poetry install

Configuration

Create a .logintelrc.yaml file:

sources:
  datadog-prod:
    type: datadog
    apiKey: "${DATADOG_API_KEY}"
    appKey: "${DATADOG_APP_KEY}"
    site: "datadoghq.com"
    defaultIndexes: ["main", "prod"]

  loki-default:
    type: loki
    url: "http://localhost:3100"
    defaultLabels:
      app: "api"

  cloudwatch-app:
    type: cloudwatch
    region: "us-east-1"
    profile: "production"
    logGroups:
      - "/aws/lambda/my-app"

  local-app:
    type: local
    paths:
      - "/var/log/myapp/*.log"
    parseJson: true
    timestampField: "timestamp"
    levelField: "level"
    serviceField: "service"

defaults:
  timeRange: "1h"
  maxResults: 100
  timezone: "UTC"

intelligence:
  enableCaching: true
  cacheTtlSeconds: 60
  anomalySensitivity: "medium"
  maxCorrelationDepth: 3

Run the Server

# stdio transport (default)
logintel-mcp --config ~/.logintelrc.yaml

# Or via Python module
python -m logintel --config ~/.logintelrc.yaml

Claude Desktop Integration

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "log-intel": {
      "command": "uvx",
      "args": ["-y", "logintel-mcp", "--config", "/path/to/.logintelrc.yaml"]
    }
  }
}

Or with Docker:

{
  "mcpServers": {
    "log-intel": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-v", "/path/to/.logintelrc.yaml:/etc/logintel/.logintelrc.yaml",
        "ghcr.io/firas-mcp-servers/logintel-mcp-server:latest"
      ]
    }
  }
}

Cursor Integration

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "log-intel": {
      "command": "npx",
      "args": ["-y", "logintel-mcp-server", "--config", "./.logintelrc.yaml"]
    }
  }
}

Development

# Install dependencies
poetry install --with dev

# Run tests (100% coverage gate)
poetry run pytest --cov=src/logintel --cov-fail-under=100

# Or use the convenience tasks
poetry run poe test       # full suite with coverage
poetry run poe test-fast  # quick run without coverage
poetry run poe lint       # ruff check
poetry run poe fix        # ruff check --fix + ruff format
poetry run poe check      # lint + test combo

# Run MCP Inspector for manual testing
poetry run python -m logintel --config ./examples/config.yaml
# In another terminal:
npx -y @modelcontextprotocol/inspector

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    MCP Host (Claude/Cursor/etc.)            β”‚
β”‚                         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”                         β”‚
β”‚                         β”‚  LLM    β”‚                         β”‚
β”‚                         β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜                         β”‚
β”‚                              β”‚ MCP Protocol (JSON-RPC)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚  LogIntel MCP Server β”‚
                    β”‚   (this project)     β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚                     β”‚                     β”‚
   β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
   β”‚  Datadog  β”‚       β”‚Grafana Loki β”‚     β”‚AWS CloudWatch β”‚
   β”‚   APIs    β”‚       β”‚  HTTP API   β”‚     β”‚  Logs Insightsβ”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                     β”‚                     β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                               β”‚
                        β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
                        β”‚ Local Files β”‚
                        β”‚  (fs/grep)  β”‚
                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Roadmap

Phase Focus Status
0 Foundation β€” scaffolding, config, health checks βœ… Complete
1 Local File Provider βœ… Complete
2 CloudWatch Provider βœ… Complete
3 Datadog Provider βœ… Complete
4 Loki Provider βœ… Complete
5 Intelligence Layer β€” root cause, correlation, caching βœ… Complete
6 Polish β€” Docker, PyPI, npm, CI/CD, docs βœ… Complete

License

MIT