Log Detective MCP server
Project description
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 |
dict[str, str] |
null |
Map of names to regex patterns. Matching chunks 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).
Contributing
All changes to this repository must pass pre-commit checks and tests.
uv run pytest tests/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logdetective_mcp-0.1.0.tar.gz.
File metadata
- Download URL: logdetective_mcp-0.1.0.tar.gz
- Upload date:
- Size: 54.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf94ec62a2d3ddac3524cb2eb4283f22e4f4252ffc2521be095c28d20b7bc038
|
|
| MD5 |
245895989eda2d2cc6ce3b1b25fc6a23
|
|
| BLAKE2b-256 |
2fbfdfc52caaa96bce743d6a71bf0b8db1d48f1c9c43d8f24da6ac6f2f4f12cd
|
Provenance
The following attestation bundles were made for logdetective_mcp-0.1.0.tar.gz:
Publisher:
publish.yml on fedora-copr/logdetective-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logdetective_mcp-0.1.0.tar.gz -
Subject digest:
cf94ec62a2d3ddac3524cb2eb4283f22e4f4252ffc2521be095c28d20b7bc038 - Sigstore transparency entry: 1923820191
- Sigstore integration time:
-
Permalink:
fedora-copr/logdetective-mcp@a14580a54672c1fca44f6d7b7159d40962e1db67 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/fedora-copr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a14580a54672c1fca44f6d7b7159d40962e1db67 -
Trigger Event:
release
-
Statement type:
File details
Details for the file logdetective_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: logdetective_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
574d55b1e225f71618e6f8185caa8d6b06db8010a301e06b4d0d52778148c6ba
|
|
| MD5 |
feb46c06fa8fde45e1fdad05056c0914
|
|
| BLAKE2b-256 |
912c930eaa91bba0619c20d5adc4b32c413959e9e0073c8998f42837242b93cb
|
Provenance
The following attestation bundles were made for logdetective_mcp-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on fedora-copr/logdetective-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
logdetective_mcp-0.1.0-py3-none-any.whl -
Subject digest:
574d55b1e225f71618e6f8185caa8d6b06db8010a301e06b4d0d52778148c6ba - Sigstore transparency entry: 1923820241
- Sigstore integration time:
-
Permalink:
fedora-copr/logdetective-mcp@a14580a54672c1fca44f6d7b7159d40962e1db67 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/fedora-copr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a14580a54672c1fca44f6d7b7159d40962e1db67 -
Trigger Event:
release
-
Statement type: