log-analyzer-mcp
log-analyzer-mcp
ログ分析およびシステムメトリクスツールを提供するMCP(Model Context Protocol)サーバーです。stdioトランスポート経由でClaude Codeに接続し、ローカルのログファイルを検索、カウント、分析するための5つのツールを公開します。
機能
ツール | 説明 |
| キーワードまたは正規表現でログファイルを検索 |
| 重要度レベル(ERROR/WARN/INFO/DEBUG)ごとにログエントリをカウント |
| 特定の時間範囲内のログをフィルタリング |
| CPU、メモリ、ディスク使用量のメトリクスを取得 |
| AIによる分析用にエラー内容をフォーマット |
クイックスタート
# Install dependencies
npm install
# Build TypeScript
npm run build
# Run the server
npm start開発
# Run with hot reload
npm run devClaude Codeとの統合
Claude Codeにサーバーを追加します:
# Project-level (only available in this directory)
claude mcp add log-analyzer -- node /path/to/log-analyzer-mcp/dist/index.js
# User-level (available globally)
claude mcp add log-analyzer --scope user -- node /path/to/log-analyzer-mcp/dist/index.js接続を確認します:
claude mcp listツールの詳細
search_logs
キーワードまたは正規表現でログファイルを検索します。単一の .log ファイルまたはディレクトリ全体の検索をサポートしています。
{
"keywords": ["ERROR", "timeout"],
"regex": "connection.*failed",
"logPath": "/var/log",
"limit": 100
}count_by_level
重要度レベルごとにログエントリをカウントします。オプションで時間範囲によるフィルタリングも可能です。
{
"logPath": "/var/log",
"startTime": "2026-04-29T00:00:00Z",
"endTime": "2026-04-30T00:00:00Z"
}query_by_timerange
特定の時間範囲内のログをフィルタリングします。オプションでレベルによるフィルタリングも可能です。
{
"startTime": "2026-04-29T00:00:00Z",
"endTime": "2026-04-30T00:00:00Z",
"logPath": "/var/log",
"level": "ERROR",
"limit": 100
}get_system_metrics
CPU、メモリ、ディスクのメトリクスを取得します。WindowsおよびLinuxをサポートしています。
{
"metrics": ["cpu", "memory", "disk"]
}explain_error
AIによる根本原因分析のためにエラー内容をフォーマットします。
{
"errorContent": "java.lang.NullPointerException\n at com.example.Service.process(Service.java:42)",
"contextLines": 10
}アーキテクチャ
src/
├── index.ts # MCP Server entry point
├── tools/ # Individual MCP tool implementations
├── utils/
│ ├── log_parser.ts # Timestamp/level parsing, keyword/regex matching
│ └── metrics.ts # Cross-platform CPU/memory/disk metrics
└── types/ # TypeScript type definitionsこのサーバーは @modelcontextprotocol/sdk と StdioServerTransport を使用しています。ツールは CallToolRequestSchema ハンドラーを介して登録されます。
主要な設計上の決定
ストリーム処理:
readline + createReadStreamを使用して、大きなログファイルをメモリにすべて読み込まずに処理しますクロスプラットフォーム: Windows (WMIC) と Linux (top/free/df) のデュアルパス実装により、実行時にプラットフォームを自動検出します
寛容な解析: 非標準のログ形式も破棄せずに保持します(レベルが不明な場合はINFO、タイムスタンプが不明な場合は現在時刻をデフォルトとします)
ライセンス
MIT
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/yufeizhou666/my_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server