Seq MCP Server: Real-time Log Analytics for AI Models

Seq MCP servers empower AI models to interact with Seq, a structured log server, for log ingestion, querying, filtering, and real-time analysis.

GitHub starsnpm versionnpm downloads

Overview

The MCP Seq Server allows AI models to seamlessly interact with Seq, a powerful structured log server. This integration enables AI to ingest, query, filter, and analyze application logs in real-time, facilitating advanced monitoring, anomaly detection, and operational intelligence.

Conceptual Server:

This is a conceptual server based on common Seq interactions and the Model Context Protocol.

Key Features

📝

Structured Log Ingestion

Send structured log events to Seq for centralized storage and analysis

🔍

Advanced Log Querying

Execute complex queries against log data using Seq's powerful filtering capabilities

📊

Real-time Analytics

Perform real-time analysis on log streams to identify trends and anomalies

🔔

Alerting & Monitoring

Set up AI-driven alerts based on log patterns and thresholds

Available Tools

Quick Reference

ToolPurposeCategory
seq_ingestIngest structured log eventsWrite
seq_queryQuery log events with filtersRead
seq_filterFilter log streams based on criteriaRead
seq_alertCreate or manage alerts in SeqWrite

Detailed Usage

seq_ingest

Ingest a structured log event into Seq.

use_mcp_tool({
  server_name: "seq",
  tool_name: "seq_ingest",
  arguments: {
    level: "Information",
    messageTemplate: "User {UserId} logged in from {IpAddress}",
    properties: {
      UserId: 123,
      IpAddress: "192.168.1.1"
    }
  }
});

Logs are stored with their properties for rich querying.

seq_query

Query log events from Seq using a filter expression.

use_mcp_tool({
  server_name: "seq",
  tool_name: "seq_query",
  arguments: {
    filter: "Level == 'Error' and AppName == 'WebApp'",
    count: 10
  }
});

Returns a list of log events matching the filter.

seq_filter

Apply a filter to a real-time log stream from Seq.

use_mcp_tool({
  server_name: "seq",
  tool_name: "seq_filter",
  arguments: {
    filter: "Environment == 'Production' and @Level == 'Warning'"
  }
});

Useful for setting up subscriptions or real-time dashboards.

seq_alert

Create or manage an alert in Seq based on log conditions.

use_mcp_tool({
  server_name: "seq",
  tool_name: "seq_alert",
  arguments: {
    name: "High Error Rate Alert",
    condition: "count(Level == 'Error') > 10 in 5m",
    notification: {
      type: "email",
      to: "[email protected]"
    }
  }
});

Automate responses to critical log events.

Installation

{
  "mcpServers": {
    "seq": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-seq",
        "http://localhost:5341"
      ]
    }
  }
}

Custom Connection:

Replace http://localhost:5341 with your Seq instance URL.

Common Use Cases

1. Anomaly Detection

Identify unusual patterns in application logs using AI:

// Query for a sudden spike in error logs
use_mcp_tool({
  server_name: "seq",
  tool_name: "seq_query",
  arguments: {
    filter: "Level == 'Error' and Time > '2023-01-01T00:00:00Z' and Time < '2023-01-01T00:05:00Z'",
    count: 100
  }
});

2. Performance Monitoring

Track and analyze application performance metrics from logs:

// Filter for slow API response times
use_mcp_tool({
  server_name: "seq",
  tool_name: "seq_filter",
  arguments: {
    filter: "EventType == 'ApiResponse' and ResponseTime > 1000"
  }
});

3. Security Incident Response

Automate responses to security-related log events:

// Create an alert for failed login attempts
use_mcp_tool({
  server_name: "seq",
  tool_name: "seq_alert",
  arguments: {
    name: "Failed Login Alert",
    condition: "count(EventType == 'LoginFailed') > 5 in 1m",
    notification: {
      type: "webhook",
      url: "https://security-webhook.example.com"
    }
  }
});

4. User Behavior Analytics

Analyze user interactions and journeys through structured logs:

// Query user activity for a specific user
use_mcp_tool({
  server_name: "seq",
  tool_name: "seq_query",
  arguments: {
    filter: "UserId == 456 and EventType == 'PageView'",
    count: 50
  }
});

Connection String Format

The Seq MCP server connects to your Seq instance via its HTTP API endpoint.

  • Local: http://localhost:5341
  • Remote: http://your-seq-server.com:5341
  • With API Key: http://your-seq-server.com:5341?apiKey=YOUR_API_KEY