logs-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@logs-mcp what's erroring in api.log? group the top 5"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
logs-mcp
Let your AI agent investigate log files that are far too big to read.
logs-mcp is an MCP server that streams through gigabytes of logs and hands the agent only the part that matters: what format it is, what is failing, when it started, which request it touched, and what changed since last hour.
How it differs from other log MCP servers. The existing ones I found
(Log Detective MCP and the
Log Analyzer MCP) chunk logs and rely on Drain3,
embeddings/vector stores or a cloud model. logs-mcp has zero dependencies beyond mcp, needs no
model, index or network, and works on the file where it sits: constant memory, .gz and rotated
files read in place, multi-line stack traces as single events, a since/until window that seeks
instead of scanning, plus timeline, request tracing and "what's new in the last hour" comparison.
What it looks like
Real output (a generated 17 MiB app log, tests/loggen.py):
> error_clusters app.log top=2
6019 event(s) at level >= ERROR grouped into 2 template(s) (of 200000 events scanned). Showing top 2 by count.
#1 x4000 first 2026-11-06 00:00:01 last 2026-11-06 02:46:37 levels ERROR:4000
template: [db] req=<hex> connection timeout after <n>ms to <ip>
e.g. app.log:35 [2026-11-06 00:00:01] ERROR | 2026-11-06 00:00:01,750 ERROR [db] req=c541013d connection timeout after 3204ms to 10.0.0.5:5432
#2 x2019 first 2026-11-06 00:00:20 last 2026-11-06 02:46:34 levels ERROR:2019
template: [pay] req=<hex> charge failed order=<n> || ConnectionResetError: [Errno <n>] Connection reset by peer
e.g. app.log:405 [2026-11-06 00:00:20] ERROR | 2026-11-06 00:00:20,250 ERROR [pay] req=d065c0e7 charge failed order=5263
Traceback (most recent call last):
File "/srv/app/handlers.py", line 88, in charge
gateway.post(order)
ConnectionResetError: [Errno 104] Connection reset by peerRelated MCP server: Log MCP Server
Tools
Tool | Use it to |
| Start here. Size, exact line count, detected format, multi-line style, time range, level histogram. |
| Text/regex + minimum level + time window, with context events, hard caps and an exact "N more matches" notice; |
| Group errors into templates (numbers, UUIDs, IPs, hex ids, paths, URLs normalised) with count, first/last seen, example. |
| Counts per time bucket for a pattern/level with an ASCII sparkline: when did it start? |
| Last N lines read from the end of the file; optional filter and a short follow window. |
| Follow a request/correlation/trace id across many files, merged into time order. |
| Which error templates are new, spiked or gone in window B versus A. Default: last hour vs the hour before. |
Supported inputs: plain text and .gz, rotated sets (app.log pulls in app.log.1, app.log.2.gz,
dated names), directories and globs (/var/log/app/*.log*). Formats: JSON lines, logfmt, syslog
(no year: inferred from the file's modification time), nginx/apache access logs (5xx counts as
ERROR), and ISO-8601-style text. Python tracebacks and Java stack traces stay attached to the
event that caused them. Timestamps with zones (Z, +02:00) are normalised to UTC; zone-less ones
use the tz argument (default +00:00).
since / until accept ISO times (2026-11-06T12:30:00Z, 2026-11-06 12:30, 2026-11-06) or
relative values like -30m, -2h, which count back from the newest entry in the log, not from
the wall clock (you are usually looking at yesterday's file).
Install
Needs Python 3.10+ and uv.
Claude Code
claude mcp add logs -- uvx logs-mcp --dir /var/log/myappClaude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"logs": {
"command": "uvx",
"args": ["logs-mcp", "--dir", "C:\\logs", "--dir", "D:\\exports\\prod"]
}
}
}Windows paths work with backslashes or forward slashes. Until it is on PyPI:
uvx --from git+https://github.com/0xmortuex/logs-mcp logs-mcp --dir ...
Try asking
"Give me an overview of everything in the logs folder."
"What is erroring in
api.log? Group it and show me the top five.""When did the
connection timeouterrors start? Show a timeline.""What changed in the last hour compared to the hour before?"
"Follow request
3f9c1ab2through all the service logs.""Show me the 20 newest
paymenterrors with 2 events of context.""Anything at WARN or above between 02:00 and 02:30 yesterday (my logs are UTC+3)?"
Security
Read-only. The server never writes, deletes or executes anything.
--dirsandbox. Every file is resolved withrealpath(symlinks followed) and must sit inside an allowed directory, from--dir(repeatable) orLOGS_MCP_DIR. With neither, only the current working directory is allowed. Path traversal (../) and symlink escapes are rejected; globs are checked per match.Logs are untrusted input. Anything in a log line reaches the agent verbatim; a hostile line can contain prompt-injection text. Do not point the server at logs that attackers can write to unless you accept that, and treat suggestions derived from them with care.
Output is capped per call (default 30,000 characters, 400 characters per line, 500 matches), so a hostile or runaway file cannot flood the agent's context.
Logs often hold secrets and personal data. Whatever the agent reads is sent to your model provider; restrict
--dirto what you are willing to share.
Performance (measured, not promised)
Generated 601 MiB file, 7,279,444 lines, one process, Windows 11, Python 3.12, tests/test_big.py:
Call | Time |
| 1.5 s |
| 20.5 s |
| 24.3 s |
| 0.5 s |
| 29.7 s |
| 20.8 s |
| 23.4 s |
| 1.8 s |
| under 0.01 s |
Peak resident memory of the whole process | 25.5 MiB |
That is roughly 25-30 MiB/s of text for a full scan in pure Python, and memory does not grow with
the file. A 2 GB file is therefore expected to take about a minute or more for a full scan; I
have not run a 2 GB file. Windowed calls (since/until) on large uncompressed, roughly
chronological files seek by bisection and stay fast. .gz files are always read from the start.
Files above max_scan_mb (default 256) get a sampled level histogram, labelled ESTIMATED.
Limits worth knowing: early stop and bisection assume each file is chronological to within an hour; an event keeps at most 200 lines for matching and clustering; at most 5,000 distinct templates are tracked (overflow is counted and reported); the template normaliser is regex-based, not Drain-style learning, so unusual id formats can produce more templates than you expect.
Development
uv sync --extra test
uv run pytest tests -v # ~45 tests, real files and a real stdio server
LOGS_MCP_BIG=1 LOGS_MCP_BIG_MB=600 uv run pytest tests/test_big.py -s # the benchmark above
uvx ruff==0.16.0 check src tests && uvx --with mcp mypy==2.3.0 --strict srcThere is a companion tutorial that builds a minimal version from scratch: logs-mcp-the-hard-way.
License
MIT. Built by 0xmortuex.
Available Tools
7 toolscompare_windowsB
What changed? Compare error templates between window A (baseline) and window B. Reports templates
that are NEW in B, SPIKED in B (event rate at least spike_factor times A's, normalised if the windows
differ in length), and GONE. With no window arguments, B is the last window (default 1h) of the logs and A
is the equal-length window just before it - ideal for 'what broke just now'.
Inputs: path (required), tz, top, level, +8 more. Returns: result
error_clustersB
Group events at or above level into message templates. Numbers, UUIDs, IPs, hex ids, paths and
URLs are normalised away so 'timeout after 31ms for user 8f2c...' and '... 47ms for user 91ab...'
become one template. For stack traces the exception line is part of the template. Each cluster shows
count, first/last seen, levels and a real example event. Use level='all' to cluster everything.
Inputs: path (required), tz, top, level, +3 more. Returns: result
log_overviewA
Start here. Summarise a log file, rotated set, directory or glob: size, exact line count, detected format (JSON lines, logfmt, syslog, nginx/apache access, ISO-timestamped text, plain), multi-line style (Python traceback / Java stack trace), time range, and a level histogram.
Files larger than max_scan_mb MiB get a sampled (clearly marked ESTIMATED) level histogram;
line counts and first/last timestamps stay exact. tz is the UTC offset used to interpret
timestamps that carry no zone and to display times (e.g. +03:00).
Inputs: path (required), tz, max_scan_mb, include_rotated. Returns: result
search_logsA
Find log events by text/regex, minimum level and time window. A stack trace is ONE event, so
a match shows the whole trace. level is a minimum (WARN, ERROR, ...). context adds that many
neighbouring events either side. Output is capped at max_matches (max 500) and always states how many
more matches exist; newest_first=true keeps the NEWEST matches instead of the oldest.
since/until: ISO ('2026-11-06T12:30:00Z', '2026-11-06 12:30') or relative to the newest log entry
('-30m', '-2h'). Naive times use tz.
Inputs: path (required), tz, level, regex, +8 more. Returns: result
tail_logsA
The last lines physical lines (max 1000), read from the end of the file without scanning the
rest. If the newest file is short, earlier rotated files are used. Optional pattern filter
(scans at most 64 MiB backwards). follow_seconds (max 60) then waits and returns lines appended
during that window.
Inputs: path (required), lines, regex, pattern, +3 more. Returns: result
timelineB
Event counts per time bucket for a pattern and/or minimum level, with an ASCII sparkline and bars. Shows WHEN something started or spiked. bucket is 'auto' (about 60 buckets) or a duration such as 10s, 5m, 1h, 1d.
Inputs: path (required), tz, level, regex, +6 more. Returns: result
trace_requestB
Follow one request / correlation / trace / user id across ALL matching files (use a directory or glob to span services). Returns every event mentioning the id, merged into time order, with the file each came from, the time span and how many were errors. Stack traces stay attached to their event.
Inputs: path (required), request_id (required), tz, since, +4 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a distinct investigative role: overview, text search, clustering, time-bucket analysis, tailing, cross-file tracing, and window comparison. Overlaps such as error_clusters vs compare_windows and search_logs vs trace_request are clearly separated by their descriptions and intended use.
All names use snake_case and are readable, with several clear verb_noun names such as search_logs, tail_logs, trace_request, and compare_windows. However, log_overview, error_clusters, and timeline use noun-phrase conventions, creating minor inconsistency in pattern.
Seven tools is well-scoped for a log-analysis server. Each tool adds a distinct capability and none appears redundant or filler.
The surface covers the key log investigation workflow: summarization, search, error grouping, temporal analysis, tailing, request tracing, and change comparison. There are no obvious dead ends for the stated purpose, and caps/pagination behavior are described where relevant.
Related MCP Connectors
Ingest and search LogsLoom logs from coding agents.
AI agent observability for production traces, natural-language insights, and improvement loops.
Persistent memory, inline redaction, per-agent access, and code localization for AI agents.
Open-source agent that observes and fixes your application. Query logs, traces, metrics, incidents.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables intelligent handling of large files through smart chunking, search with regex support, line navigation, and streaming capabilities without loading entire files into memory.633 npm18MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to automatically inspect and analyze application runtime log files for debugging and troubleshooting. Supports monitoring multiple log directories simultaneously with tools for listing, reading, searching, and paginating through log files.8MIT
- AlicenseNot gradedqualityFmaintenanceEnables LLMs to analyze logs by extracting patterns, redacting secrets, and providing token-efficient summaries from files, Docker containers, or journald.5MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to read and analyze Linux system logs—including systemd journal, syslog, kernel, application, and Docker container logs—for diagnostics and predictive analysis.MIT