Log Detective MCP
MCP server implementing core log analysis tools of Log Detective for use by other agents.
The server uses the Drain3 algorithm to cluster log messages into templates and extract a representative subset of snippets, reducing large logs to a manageable size for downstream analysis.
Installation
Requires Python 3.11+.
pip install .
Or with uv:
uv pip install .
Usage
Running the server
logdetective-mcp
Or directly:
python -m logdetective_mcp.main
MCP client configuration
Claude Code
claude mcp add logdetective -- logdetective-mcp
Claude Desktop
Add to your Claude Desktop configuration file:
{
"mcpServers": {
"logdetective": {
"command": "logdetective-mcp"
}
}
}
Tools
extract_log_snippets
Extracts representative log snippets using Drain3 clustering. The tool chunks the log into logical messages, clusters similar messages, and returns one representative snippet per cluster.
Log content can be provided in three ways (exactly one must be used):
| Parameter | Type | Description |
|---|---|---|
log_text |
str |
Raw log text passed directly. |
log_path |
str |
Path to a log file on the server's filesystem. |
log_url |
str |
HTTP(S) URL to fetch log content from. |
Optional parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
max_clusters |
int |
8 | Maximum number of snippets to extract. |
max_snippet_len |
int |
2000 | Maximum character length per snippet. |
skip_patterns |
list[str] |
null |
List of regex patterns. Chunks matching any pattern are excluded before clustering. |
Returns a list of Snippet objects, each with line_number (position in the original log) and text (the extracted snippet content).
Size limits
All downloaded inputs (via log_url) are limited to 100 MB regardless of format.
Downloads are streamed in chunks and aborted as soon as the limit is exceeded.
Archives read via log_path are also checked against the 100 MB limit during decompression.
Compressed file support
Both tools transparently decompress archived log files. Supported formats:
- Single-file compression:
.gz,.bz2,.xz,.lzma - Archives:
.zip,.tar,.tar.gz,.tar.bz2,.tar.xz
Format is detected from the file extension (or URL path). Archives must contain exactly one file.
Zip bomb protection is enforced via:
- Maximum decompressed size of 100 MB
- Maximum compression ratio of 100:1
- Pre-check of declared sizes in zip/tar headers
- No recursive decompression (nested archives are not unpacked)
Contributing
All changes to this repository must pass pre-commit checks and tests.
uv run pytest tests/
Metadata
Release files for logdetective-mcp 0.5.2
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 |
|---|---|---|---|---|
| logdetective_mcp-0.5.2.tar.gz | 66.4 kB | With provenance | Details for logdetective_mcp-0.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| logdetective_mcp-0.5.2-py3-none-any.whl | Python 3 | none | any | Details for logdetective_mcp-0.5.2-py3-none-any.whl |
Total release size: 81.6 kB
Release files / logdetective_mcp-0.5.2.tar.gz
| Download URL | logdetective_mcp-0.5.2.tar.gz |
|---|---|
| Size | 66.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d3eb3b03446bb3d22a889b88901811be79def936e47d99a581aba3dbb4474f4
|
|
BLAKE2b-256 checksum How to use checksums |
95bd155a27d6d8744d90c8d09189984c529ffaf9a482f08eee1c0a4136552b9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 20, 2026.
Transparency logRelease files / logdetective_mcp-0.5.2-py3-none-any.whl
| Download URL | logdetective_mcp-0.5.2-py3-none-any.whl |
|---|---|
| Size | 15.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4e0299fdfb58bde225711cd0fbe5d8da6e75feca5873238390a9dc35e17281d1
|
|
BLAKE2b-256 checksum How to use checksums |
c9b966462e2c20402ac146a149658992adf7eba491e27a44d5e8d7979287e04d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 20, 2026.
Transparency logSecurity for logdetective-mcp 0.5.2
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for logdetective_mcp-0.5.2.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 Oct 20, 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.