Skip to main content
Glama
mcp-syslog

mcp-syslog

by crunchtools

mcp-syslog-crunchtools

crunchtools/syslog が収集したログを扱うための MCP サーバーです。

RT #1460 のために作られ、特定のギャップを埋めることを目的としています。Hermes は Nagios にページングされてサービスを再起動することはできますが、そのサービスのログを読むことはできません。そのため、すべての復旧対応が「見えないままの再起動」になります。このサーバーは、それを状況を把握した上での再起動に変えます。

機能

ツール

回答内容

syslog_sources_tool

何を照会できますか?

syslog_search_tool

このサービスの直近15分間の ERR を表示します

syslog_grep_tool

この文字列はフリート全体のどこに出現しますか?

syslog_tail_tool

このサービスの最新の行は何ですか?

syslog_context_tool

03:14 頃、すべてのログは何を言っていたのか?

syslog_stats_tool

どのサービスが最も多くのログを出力し、実際に異常なのはどれか?

Related MCP server: AI Incident Monitoring RCA MCP Server

トリアージループ

nagios_current_problems_tool          → what is broken
syslog_search_tool(source=…,          → why it broke
                   severity="ERR",
                   since="15m")
syslog_context_tool(timestamp=…)      → what else was happening at that moment
nagios_schedule_check_tool            → confirm the fix

source を指定しない syslog_context_tool こそが真価を発揮します。すべてのソースを一度に横断するため、「アプリが死んだ」が「データベースのコンテナが4秒前に OOM していた」にどうつながるのかが分かります。

設計メモ

すべての結果は上限つきで、上限に達したことも明示されます。 ログは無限ですが、この出力はモデルのコンテキストウィンドウに入ります。各ツールは、返す結果の数とスキャンする行数にそれぞれ上限を設け、どちらかの上限に達したときはその旨を回答に注記します。

[!] Stopped after the 2,000,000-line scan limit, so this result is INCOMPLETE
    and an empty or short result does not mean nothing happened.

この注記は非常に重要です。「エラーが発生していなかった」と「調べるのをやめた」を区別できない呼び出し側は、空の結果から誤った結論を引き出してしまうからです。このサーバーは、復旧の意思決定に情報を提供するために存在します。

時間による絞り込みは安価です。 コレクタはファイル名に日付を入れるため、10分間のクエリは90日分の履歴を読むのではなく、1つのファイルを開くだけで済みます。

ソース名は信頼しません。 ソース名はモデルから渡され、ファイルシステムのパスを組み立てるために使われますません。そのため、各ソース名を解決した上で、ログのルートディレクトリ内部にあることを確認します。これにより、パストラバーサル、絶対パス、ツリーの外方を指すシンボリンクを検出できます。tests/test_security.py を参照してください。

重大度は「これ以上の深刻さ」を意味します。 severity="ERR" は ERR、CRIT、ALERT、EMERG を返します。認識できない重大度は捨てずに残します。理解できない1行であっても、隠してしまう方が表示するよりも悪いからです。ただし、それは syslog_stats_tool のエラーとしては数えません。数えた場合、正常なサービスでもエラー率が57%になってしまいます。

重大度は悪いことを意味しません。 Podmanは、コンテナが stderr に書き込んだものを、優先度 err として記録します。多くのサービスがそこに定例の INFO を記録しています。lotor 上の `mcp-trentXX は、完全に正常でありながら65%が「ERR」として記録されいます。

PRIORITY=3 | 2026-08-23 15:55:24 INFO  httpx: HTTP Request: GET https://... "200 OK"

コレクタはジャーナルを忠実に報告しており、ジャーナルはファイル記子を報告しています。メッセージを読み、エラー率の絶対値ではなく、その変化に注目してください。この注意点はサーバーの MCP インタラクションにも含まれているため、問い合わせるエージェントにも同じことが伝わります。

2種類の行形式を解析します。 コレクタは 2026-08-23 より前は5つのフィールドを、それ以降は6つのフィールドを出力しています。古い行は90日間保持されます。ある行がどのレイアウトかを決めるのは、フィールド数ではなく、実際の重大度がどこに位置するかです。

ログ形式

コレクタは、スペース区切りの6つのフィールドを書き出します。

2026-08-23T15:41:52+00:00 crunchtools.com crunchtools.com httpd ERR AH00169: caught SIGTERM
└─ timestamp ───────────┘ └─ host ──────┘ └─ source ────┘ └prog┘ └sev┘ └─ message ────────┘

source はログストリームです。通常はコンテナ名です。program はコンテナ内のプロセスで、systemdコンテナでは httpd、php-fpm、mariadb のすべてが1つのサービス名にまとめられるため、重要です。

設定

変数

既定値

目的

SYSLOG_LOG_ROOT

/logs

コレクタのログ・ルート。読み取り専用でマウント

SYSLOG_MAX_RESULTS

200

1回の呼び出しで返すエントリ数の上限

SYSLOG_SCAN_LIMIT

2000000

1回の呼び出しで検査する行数の上限

認証情報は不要です。このサーバーは読み取り専用のバインドマウントからファイルを読むだけです。

実行

podman run -d --name mcp-syslog \
  --network crunchtools \
  -p 127.0.0.1:8027:8027 \
  -v /srv/syslog.crunchtools.com/data/logs:/logs:ro \
  quay.io/crunchtools/mcp-syslog:latest \
  --transport streamable-http --host 0.0.0.0 --port 8027

:ro でマウントします。このサーバーが書き込みを行う必要は一切ありません。読み取り専用でマウントしておくことは、万が一このサーバーにバグがあっても、保護すべき証拠の記録を破壊してしまわないようにするためです。

開発

uv sync
uv run ruff check src tests
uv run mypy src
uv run pytest -v

Available Tools

6 tools
syslog_context_toolSyslog Context ToolA
Read-only

Return log entries surrounding a specific moment.

Use this after an alert names a time. Omitting source spans the whole fleet, which is how a failure gets correlated with whatever else was happening.

Inputs: timestamp (required), limit, source, severity, +2 more. Returns: result

syslog_grep_toolSyslog Grep ToolA
Read-only

Regex search across all sources, or within one named source.

Inputs: pattern (required), limit, since, source, +1 more. Returns: result

syslog_search_toolSyslog Search ToolC
Read-only

Search collected logs by source, time window, severity and pattern.

Inputs: limit, since, until, source, +3 more. Returns: result

syslog_sources_toolSyslog Sources ToolA
Read-only

List log sources available to query, with size and last-write time.

Inputs: pattern, include_internal. Returns: result

syslog_stats_toolSyslog Stats ToolB
Read-only

Summarise log volume and error rate per source.

Inputs: top, since, source. Returns: result

syslog_tail_toolSyslog Tail ToolB
Read-only

Return the most recent entries for one source.

Inputs: source (required), limit, severity. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 6 tools

    Disambiguation4/5

    Each tool targets a distinct query mode: listing sources, filtered search, regex grep, tailing, contextual windows, and stats. The main overlap is between syslog_search_tool (severity/pattern) and syslog_grep_tool (regex), which an agent could confuse, but the descriptions draw a reasonable line between structured filtering and regex matching.

    Naming Consistency4/5

    All tools follow a clear syslog_<action>_tool pattern, which is highly predictable. The action terms mix nouns (sources, stats) and verbs (search, grep, tail), a minor inconsistency within an otherwise uniform convention.

    Tool Count5/5

    Six tools is well-scoped for a log query server, with each tool covering a genuinely distinct access pattern (discovery, search, grep, tail, context, stats). No tool feels redundant or vestigial.

    Completeness4/5

    The read-only query lifecycle is well covered: discovery, filtering, regex, recency, surrounding context, and aggregate stats. Minor gaps exist around schema/field discovery or export, but core investigative workflows are fully supported without dead ends.

    Maintenance

    ActivityActive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables querying and analyzing logs from multiple remote Unix hosts via the Log Collector API, with tools for search, error detection, and summary generation.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Provides telemetry tools for retrieving recent logs and system metrics to support root-cause analysis of infrastructure incidents. Enables autonomous incident triage with grounded verification and human-in-the-loop remediation.
      1
      -
    • A
      license
      A
      quality
      D
      maintenance
      Enables debugging of distributed transactions by continuously ingesting Docker container logs, indexing them by trace/request ID, and exposing MCP tools to search, tail, and correlate logs across services.
      7
      ISC
    • A
      license
      A
      quality
      C
      maintenance
      Enables log analysis through MCP tools for searching logs, retrieving error contexts, and summarizing incidents with self-verified root-cause hypotheses.
      3
      ISC