Logcut MCP
Provides the slice_container MCP tool to retrieve Docker container logs and run them through logcut's slicing engine, with options for container, tail_lines, since, workspace_root, and max_chars.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
logcut
Local-First Stacktrace, Runtime Log, Test & Compiler-Error Slicing for AI Coding Agents
Stop pasting 10,000-line logs and compiler walls into your LLM.
logcut keeps the crashing frames, root causes, failing assertions, and exact source lines—and drops the rest.
Why logcut? • Quickstart • MCP Setup • CLI Usage • Architecture
MCP Registry: mcp-name: io.github.bigwalkdoe/logcut
$ wc -l app.log
10482 app.log
$ logcut slice app.log --stats
== Error bursts ==
[x3 | first: 02:14:02 | last: 02:14:58] ERROR Connection refused to <UUID>
== Stacktrace ==
thread 'main' panicked at src/handler.rs:42:9:
... [3 framework/runtime frames hidden] ...
at logcut::handler::process (src/handler.rs:42:9)
== Source context ==
--- src/handler.rs (39:45) ---
39 | // line 39
> 42 | let conn = connect();--stats writes JSON size/token savings to stderr, so the report on stdout stays pipe-safe.
Why logcut?
logcut is one Rust binary with two interfaces over the same pure-Rust core: an MCP server for AI hosts and a CLI for terminal pipelines. Each mode is built for the moment an agent or an engineer needs the failure, not the whole file.
Stacktrace Slicing (
slice_log/logcut slice) — Redacts secrets, deduplicates error bursts, collapses consecutive vendor frames, and inlines the exactpath:linesource around surviving application frames.Compiler Cascade Collapsing (
slice_build/logcut build) — Parsesrustc/cargo,tsc,go build, andgcc/clangoutput, merges repeated cascades, and reports root causes with occurrence counts.Test-Failure Slicing (
slice_test/logcut test) — Handles cargo, pytest, jest/vitest, and go test; strips passing lines while keeping assertion diffs and source context.Structured NDJSON (
--min-level,--where) — Detects NDJSON automatically, drops staticpid/hostname/vmetadata, filters by severity and field value, and attaches up to five correlatedINFO/WARNbreadcrumbs to each error.Redaction by Default — Masks Bearer tokens,
sk-/rk-keys, GitHub and AWS credentials, credential-bearing database URLs, andapi_key/password/secretassignments before anything reaches your LLM.Crash Capture (
logcut watch/get_last_crash) — Streams a command, keeps a 500-line ring buffer, and atomically writes.logcut/last-crash.mdwhen a panic, traceback, fatal error, or non-zero exit appears.Docker & systemd Sources (
slice_container/slice_service) — Runs the same slicing engine overdocker logsandjournalctloutput, with explicit argument arrays instead of shell interpolation.Hosted Streamable HTTP (
serve-http) — Serves the same six MCP tools at/mcpbehind thehttpfeature for managed hosting, with a stateless server and no persistent disk.One Core, Two Interfaces —
logcut mcpand the CLI share one pure-Rust core, and MCP schemas are generated from the same structs so the contracts cannot drift.Built to Pair with treecut —
treecutmaps the codebase;logcutexplains what broke at runtime. Together they give an agent the code map and the failure evidence.
Related MCP server: tokencut
Quickstart
Install via Cargo
cargo install logcutHomebrew (macOS/Linux)
brew install bigwalkdoe/tap/logcutPrebuilt archives
Prebuilt archives for Linux x86_64, macOS x86_64, macOS aarch64, and Windows x86_64 are attached to the v0.3.0 release. Each archive has a matching .sha256 checksum; unpack it and put the logcut binary on your PATH.
Build from source
git clone https://github.com/bigwalkdoe/logcut.git
cd logcut
cargo install --path .For an MCP-only build that leaves out the ask HTTP client:
cargo install --path . --no-default-features --features mcpFor a one-command install of both logcut and treecut with shared agent setup, see agentcut.
MCP Server Setup
logcut mcp speaks JSON-RPC 2.0 over standard stdio with no background daemons and no API keys. JSON-RPC stays on stdout; diagnostics and tracing go to stderr.
Quick setup (logcut init)
logcut init --all # or --opencode / --claude / --cursorWith no flags, init writes all three sets.
Host | Server config | Slash command |
OpenCode |
|
|
Claude Code |
|
|
Cursor |
|
|
Existing files are left untouched, so rerunning init is safe.
OpenCode (opencode.json)
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"servers": {
"logcut": {
"type": "local",
"command": ["logcut", "mcp"]
}
}
}
}Claude Code (.mcp.json) and Cursor (.cursor/mcp.json)
{
"mcpServers": {
"logcut": {
"type": "stdio",
"command": "logcut",
"args": ["mcp"],
"description": "Run logcut mcp over stdio"
}
}
}Exposed MCP tools
Tool | Purpose | Key arguments |
| Redacted, deduplicated logs with frames and source |
|
| Failing tests with assertion diffs and source |
|
| Compiler root causes and collapsed cascades |
|
| Docker logs through the same engine |
|
| systemd journal through the same engine |
|
| Report written by |
|
All tools accept an optional workspace_root for resolving path:line snippets. slice_log additionally accepts min_level and where_filters for NDJSON streams.
Hosted HTTP
For hosted deployments (including MCPRush managed hosting), build with the http feature and run:
cargo build --release --features http
logcut serve-http --host 0.0.0.0 --port 8080 # MCP at /mcp--host and --port default to 0.0.0.0 and 8080 and read LOGCUT_HTTP_HOST / LOGCUT_HTTP_PORT from the environment. A root Dockerfile builds the same binary into a small Alpine image. The hosted server declares all six tools, but slice_container, slice_service, and get_last_crash need the host machine and return a "requires a local logcut install" error there; use a local install for those three.
CLI Usage
Use logcut directly in terminal pipelines, Git hooks, or standalone debugging sessions.
# Slice a file, piped output, or inline text
logcut slice /var/log/app.log --context-lines 10 --stats
cargo test 2>&1 | logcut slice --stats
# Filter structured NDJSON by severity and fields
logcut slice app.ndjson --min-level warn --where 'status>=500' --where 'service=auth'
# Keep only failing tests with source context
cargo test 2>&1 | logcut test --stats
logcut test pytest-output.txt --workspace-root /path/to/repo
# Watch a command and save its last crash
logcut watch --workspace-root /path/to/repo -- cargo test
# Collapse compiler error walls into root causes
cargo build 2>&1 | logcut build --stats
logcut build compiler.log --workspace-root /path/to/repo --max-errors 5
# Container and systemd sources
logcut docker my-api --tail-lines 2000 --since 1h
logcut journal api.service --lines 1000
# Agentic loop (needs OPENAI_API_KEY; optional OPENAI_BASE_URL / OPENAI_MODEL)
logcut ask "why does the worker panic on startup?"--stats writes JSON size/token statistics to stderr, so stdout stays pipe-safe. --workspace-root controls which frames count as application code and where path:line snippets are read from.
Defaults: slice tails 5,000 lines (--tail-lines 5000), keeps 3 context lines (--context-lines 3), and caps rendered text at 12,000 characters (--max-chars 12000); build reports 10 root causes (--max-errors 10) with 3 context lines (--context-lines 3) and a 12,000-character cap (--max-chars 12000), and tails the last 5,000 lines when reading a file (--tail-lines 5000); watch keeps a 500-line ring (--ring-lines 500); docker tails 2,000 lines and journal 1,000 lines. ask requires OPENAI_API_KEY; OPENAI_MODEL defaults to gpt-4o-mini and OPENAI_BASE_URL to https://api.openai.com/v1.
Reports
A slice report deduplicates error bursts, keeps surviving stack frames, and inlines source around application frames. A compiler report collapses cascades into root causes. Structured NDJSON keeps entries and breadcrumbs. Test reports keep failures and assertion diffs.
Stacktrace report
== Error bursts ==
[x3 | first: 02:14:02 | last: 02:14:58] ERROR Connection refused to <UUID>
== Stacktrace ==
thread 'main' panicked at src/handler.rs:42:9:
... [3 framework/runtime frames hidden] ...
at logcut::handler::process (src/handler.rs:42:9)
== Source context ==
--- src/handler.rs (39:45) ---
39 | // line 39
> 42 | let conn = connect();Compiler report
== Compiler errors ==
[1] E0277 src/api.rs:42:18 — the trait bound `User: Serialize` is not satisfied
[+3 trait/note lines collapsed]
| serde_json::to_string(user)
== Source context ==
--- src/api.rs (39:45) ---
39 | // line 39
> 42 | serde_json::to_string(user)Structured NDJSON report
== Structured logs ==
02:14:58 ERROR Connection refused
fields: service=auth status=500
breadcrumbs:
02:14:57 INFO retrying requestTest report
== Test failures ==
--- failure 1 ---
name: checkout_rejects_expired_card
location: tests/checkout.rs:88
message:
assertion `left == right` failed
left: 402
right: 200
== Source context ==
--- tests/checkout.rs (85:91) ---
85 | // line 85
> 88 | assert_eq!(status, 200);
[passing lines stripped: 1204 | failures: 1]slice keeps the last 5,000 lines by default. --max-chars truncates rendered text only, while structured fields stay complete.
Working with treecut
treecut maps a codebase; logcut explains what broke at runtime. Use them together in OpenCode, Claude Code, or Cursor:
Ask the agent to run
treecuton the repository to find the modules involved.Reproduce the failure and pipe runtime output into
logcut sliceor compiler output intologcut build(or let the agent call the MCP tools).logcutreturns redacted, deduplicated errors, vendor-collapsed stack frames, collapsed compiler cascades, and inlinedpath:linesnippets.The agent uses the treecut map to navigate from those frames to related code, then proposes a fix.
The /debug-log command created by logcut init gives the agent that workflow in one step.
Architecture
logcut is structured around a pure, UI-agnostic Rust core shared identically by the MCP server, the CLI, and the hosted HTTP layer:
┌──────────────────────────┐
│ logcut (binary) │
└────────────┬─────────────┘
│
┌────────────────────┼────────────────────┐
▼ ▼ ▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ MCP stdio (rmcp) │ │ CLI (clap) │ │ HTTP (axum) │
│ JSON-RPC / stdio │ │ slice · test · │ │ /mcp │
│ │ │ watch · build │ │ │
└────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘
└────────────────────┼────────────────────┘
▼
┌──────────────────────────────────────────────────────────┐
│ Pure core engine │
│ redaction · dedup · stacktraces · NDJSON · tests · │
│ compiler cascades · source snippets · bounded reads │
└──────────────────────────────────────────────────────────┘stdout is reserved for reports and JSON-RPC. Diagnostics, tracing, and
--statsgo to stderr, so MCP framing and terminal pipelines stay clean.Redaction runs before rendering and again over the final text. Structured
snippetsremain raw source lines; treat them as sensitive if your sources hold credentials.File input is tailed backwards in 8 KiB chunks. The reader never seeks from the beginning or allocates the whole file, and
max_charstruncates rendered text only.MCP schemas are generated from the same Rust structs (
schemars). The published contract cannot drift from the implementation.Hosted mode is stateless. No tool writes files, creates caches, or needs a persistent disk, and host-dependent tools are refused there.
Feature flags
Feature | Default | Provides |
| yes |
|
| yes |
|
| no |
|
slice, test, watch, build, docker, journal, and init are available in every build.
cargo build --no-default-features --features mcp # MCP-only serverDocumentation
Start with the documentation index:
Usage guide — commands, flags, defaults, and examples
MCP and agent reference — stdio tools, host setup, and
logcut askArchitecture guide — modules, invariants, and extension points
Troubleshooting — common symptoms and fixes
Development
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test
cargo check --no-default-features --features mcp
cargo publish --dry-runContributing
Contributions are welcome—especially new language parsers, compiler-output fixtures, and redaction edge cases. See CONTRIBUTING.md for development setup, validation expectations, and PR guidance, and CHANGELOG.md for release notes.
Privacy
logcut is local-first and collects no telemetry. logcut itself makes no network calls in slice, test, watch, build, docker, or journal; ask is the exception and sends the sliced context to the OpenAI-compatible endpoint you configure. Redaction is on by default, but structured snippets are raw source lines.
License
Dual-licensed under either of:
Apache License, Version 2.0 (LICENSE-APACHE or http://apache.org)
MIT License (LICENSE-MIT or http://opensource.org)
at your option.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Production bugs with replay, network, console and stack, ranked for your coding agent to fix.
Errors, logs and AI-call costs for apps on Node.js, Next.js, Cloudflare Workers or the browser. Ask your AI what’s broken, why, and how to fix it, right inside Cursor or Claude.
Errors, traces, replays and logs from Talaria for coding agents.
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA terminal live-tail and a browser dashboard — one process, one event stream, served from localhost. Unified timeline across Claude Code, Codex, Gemini CLI, Cursor, Hermes, and OpenClaw. Token + cost accounting, compaction + anomaly detection, hybrid search, SVG call graphs, monaco-style diff attribution, agent-aware replay ("what would the agent say if I edited the prompt?"), policy editor, MCP s17 npm19MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to compress terminal output and file context in real time, preserving full error tracebacks while reducing token consumption by 60-85%.43MIT
- AlicenseAqualityBmaintenanceZero-dependency token optimizer, test-failure triage gate, and System 1.5 semantic guardrail for AI coding agents. Intercepts compiler errors, missing dependencies, and doom loops in < 500µs.633 PyPI12MIT
- AlicenseAqualityBmaintenanceLets AI coding agents read an outline of a large file or a digest of noisy command output instead of the full text, while every hidden line stays retrievable on disk through a run handle. Agents can request only the line ranges, slices, or grep matches they need and list recent runs, cutting token spend without losing information.519 PyPIMIT