LogLens MCP
Keep the evidence. Bound the output. Make omissions visible.
LogLens is an offline tool for explicitly supplied, benign compilation and unit-test logs. It classifies familiar diagnostic lines, groups exact repeated lines, retains numbered excerpts and reports omissions. It never runs the build, retrieves logs, intercepts tools, operates sessions, or accesses files and networks. It is not a security log analyzer.
Motivation
Reports in Codex issue #44305 and Claude Code issue #49048 describe context growth from tool loops or request output filtering. LogLens is an independent implementation of bounded build/test log summaries, not an official fix for either product. It measures actual JSON output characters and UTF-8 bytes, not token counts, savings, or cost.
Input → report
| Stage | Behavior |
|---|---|
| Accept | Explicit UTF-8 log string (up to 256 KiB / 10,000 lines) |
| Recognize | Common TypeScript, Dart, Gradle/Kotlin, pytest, Jest/Vitest line shapes |
| Group | Exact repeated raw diagnostic lines, not inferred root cause |
| Preserve | Source line numbers, excerpts, raw-line SHA-256 identity |
| Bound | Explicit omission counts, coverage totals, maximum JSON characters |
| Report | Diagnostics detected, incomplete, or no recognized diagnostic lines |
The parser is deliberately conservative and line-oriented. It does not parse all tool versions, stack traces or multiline exceptions. Unknown lines are not discarded silently; they are counted and some are included with evidence line numbers. ANSI color codes are stripped for display and other control characters escaped; raw grouping still uses the original line. Each group retains the first 12 line numbers and counts any remaining ones. Excerpts are limited to 220 characters plus an ellipsis.
Output status no_recognized_diagnostics is not a successful build verdict.
It requires the caller to explicitly attest the input is complete, a recognized
positive summary line, and no diagnostics, unknown content or omissions. If there are
recognized failures, diagnostics_detected is reported even for incomplete
input; consult coverage.incomplete separately. Missing or truncated evidence
never becomes a clean result.
Quick start
Python 3.10+. Install from source so the official MCP SDK dependency is present; package access is needed only for installation.
git clone https://github.com/ahmedsaeed1-eng/loglens-mcp.git
cd loglens-mcp
python -m venv .venv
# Activate the virtual environment for your OS.
python -m pip install .
python -m loglens_mcp serve
For a client supporting stdio MCP, adapt this configuration to its documentation:
{
"mcpServers": {
"loglens": {
"command": "/absolute/path/to/venv/bin/python",
"args": ["-m", "loglens_mcp", "serve"]
}
}
}
On Windows use the virtual environment's Python executable and escape backslashes in JSON. The official Python MCP SDK client was tested; specific Codex and Claude product UIs were not tested.
Example
The CLI reads an explicit JSON object from stdin and writes compact JSON to stdout. It does not read source paths or invoke commands. The example file is supplied by the caller via shell redirection.
python -m loglens_mcp summarize < examples/build.json
MCP tool: summarize_build_log(log, complete=false, max_chars=16000).
The returned string is compact JSON. max_chars (1,000–100,000) strictly
bounds the returned JSON content, not protocol framing. Oversized input is
rejected rather than silently truncated. Omission counts report groups,
underlying diagnostic occurrences, unknown lines, summary lines and omitted
numbered occurrences in retained groups. Diagnostic excerpts are prioritized
by severity, then source position, before summaries and unknown excerpts.
The metadata reports input/output characters and UTF-8 bytes and signed reductions. Negative reductions mean the report is larger than the input, which is common for short logs. Repeated large logs can yield smaller output, depending on budget and structure; no token-saving estimate is made.
Avoid submitting secrets, private records, or security/network/attack logs. LogLens is not a redaction or data-classification service. It processes the supplied strings as data and cannot validate that their details are safe to share.
Tests
python -m unittest discover -s tests -v
Tests cover repeated diagnostics, supported formats, line accounting, unknown content, limits, omitted evidence, byte/character metrics, CLI, and a real MCP stdio session using the official SDK. Local Python 3.12 tests passed; CI is configured for Python 3.10/3.12 on Windows, Linux and macOS. Remote workflow status is reflected by its live badge.
Distribution and MCP launch
After installation, loglens-mcp starts the same stdio MCP server as the module invocation above.
Once the version is published to PyPI, an MCP client with uvx can launch it using:
uvx loglens-mcp==0.1.0
This repository contains registry metadata and a manually dispatched packaging workflow. Package and MCP registry publication are separate steps; the metadata alone does not publish them.
Metadata
Release files for loglens-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| loglens_mcp-0.1.0.tar.gz | 13.6 kB | With provenance | Details for loglens_mcp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| loglens_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for loglens_mcp-0.1.0-py3-none-any.whl |
Total release size: 22.6 kB
Release files / loglens_mcp-0.1.0.tar.gz
| Download URL | loglens_mcp-0.1.0.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23636c148d39a25260e4526c84cfef24818bcf0542f0838bcba4c6d092a9ff2c
|
|
BLAKE2b-256 checksum How to use checksums |
91b184a817edb10629026df812f553afbfa19db1cd7d1c0079b5d8e8395f03cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / loglens_mcp-0.1.0-py3-none-any.whl
| Download URL | loglens_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c25fd94770e0de000735e8002d5fb516db46522461ea759284446db682f2274
|
|
BLAKE2b-256 checksum How to use checksums |
fed8386ca9744f83b538f690d8825c0c204b3e470a9f8019c6007ac216bba90b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for loglens-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for loglens_mcp-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.