Skip to main content

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

Project description

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

PyPI (recommended)

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logintel_mcp-1.0.1.tar.gz (35.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logintel_mcp-1.0.1-py3-none-any.whl (45.5 kB view details)

Uploaded Python 3

File details

Details for the file logintel_mcp-1.0.1.tar.gz.

File metadata

  • Download URL: logintel_mcp-1.0.1.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.5 Linux/6.17.0-1013-azure

File hashes

Hashes for logintel_mcp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 19633628d3383ed7d910cc5a420a7b904edf927fd339419bcad2df16f083d8d6
MD5 9ddbc4b86de9c0eaeafedf41cdfcc9c4
BLAKE2b-256 20acee1935d6135cc859196229023d594dbfab7cf015d776b787856c93a15ec7

See more details on using hashes here.

File details

Details for the file logintel_mcp-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: logintel_mcp-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 45.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.5 Linux/6.17.0-1013-azure

File hashes

Hashes for logintel_mcp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 910df7fdaf1c4e287adde617e48c0018dd910664dd50a13c0f2d17ae26259b78
MD5 d1ff40c5994af19481801893354d063a
BLAKE2b-256 5940f279a97006bd6765d195e15c4028c6c71d50a98681ff082b26c88a42453b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page