Skip to main content
Glama

stacktrace-mcp

Paste a crash. Get the root cause, the line of your code that matters, and a hash that tells you whether you have seen it before.

stacktrace-mcp is an MCP server that turns raw crash output (Python, Node/V8, Java/Kotlin, Go, Rust, .NET) into a compact, correct report, and maps it onto the code in your project.

Why another stack trace tool?

Existing MCP servers in this space are either narrow or lossy: a paid hosted "log fingerprint" service (Apify Log Fingerprint & Triage), regex-based log analysers that read three languages (log-analyzer-mcp), or crash-dump tooling tied to WinDbg (mcp-windbg). What this one does differently:

  • Six hand-written parsers, one model. Python chains and ExceptionGroup trees, Node [cause] / AggregateError, Java Caused by: with ... N more reconstructed, Go goroutine dumps and race reports, Rust RUST_BACKTRACE, .NET inner exceptions. Every trace gets a root cause, not just a first line.

  • Application vs library frames per language (site-packages, node_modules, JDK/framework packages, Go module cache, rustc std, .NET framework), so the innermost frame that is yours is highlighted.

  • Maps frames onto your checkout even when the trace came from a container (/app/src/x.py vs ./src/x.py), a Windows box, or a webpack bundle, with strict directory-sandbox protection.

  • Honest about bad input: truncated or garbled traces are parsed as far as possible and flagged PARTIAL with a reason.

  • Local, free, zero dependencies beyond mcp, linear-time parsing, and every output is redacted (secrets, emails, IPs, home-directory user names) by default.

Related MCP server: @debugai/mcp

Install

Needs uv. Nothing to clone.

Claude Code

claude mcp add stacktrace -- uvx stacktrace-mcp --dir .

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "stacktrace": {
      "command": "uvx",
      "args": ["stacktrace-mcp", "--dir", "C:\\path\\to\\your\\project"]
    }
  }
}

--dir is the sandbox for map_to_code and find_traces_in_file (repeat it for several directories). Without it, the pure-text tools (parse_trace, fingerprint, compare_traces, explain_exception, redact_trace) still work.

Try asking

  • "Here is the crash from CI: (paste). What is the root cause and which of my files is responsible?"

  • "Map this production traceback onto my repo and show me the offending lines."

  • "Scan logs/app.log and group every stack trace by fingerprint. Which bug happens most, and when did it first appear?"

  • "Are these two tracebacks the same bug?"

  • "What does ECONNREFUSED usually mean, and what do I check first?"

  • "Redact this trace so I can paste it into a ticket."

Tools

Tool

What it does

parse_trace(text)

Auto-detects the language; returns exception chain with the root cause, frames classified app/library/stdlib/framework/runtime, innermost application frame, fingerprint, PARTIAL notes. format="json" for the full structure.

find_traces_in_file(path)

Streams a big log (cap 256 MB), finds every trace among normal lines, groups by fingerprint with counts and first/last seen.

fingerprint(text)

Stable hash over language + exception types + innermost application frames. Ignores messages, addresses, ids, path prefixes, generated class names and (by default) line numbers. Shows its components.

map_to_code(text)

Resolves frames to files under --dir, verifies the line exists, shows the line with context, warns when the source changed since the crash.

compare_traces(a, b)

SAME / LIKELY SAME / POSSIBLY related / DIFFERENT with a per-frame diff.

explain_exception(type, language?)

About 80 common exceptions: meaning, three most common causes, what to check first.

redact_trace(text)

Removes tokens, passwords, JWTs, emails, IPs and home-directory user names.

All tools except explain_exception take redact (default true).

What it understands

  • Python: 3.8-3.13 tracebacks including ^^^^/~~~~ caret ranges, __cause__/__context__ chains, ExceptionGroup/TaskGroup boxes (nested), SyntaxError with caret lines, KeyboardInterrupt, [Previous line repeated N more times], add_note() lines.

  • Node/V8 and browsers: at fn (file:line:col), at async, eval at, [cause], AggregateError [errors], webpack-internal and Vite URLs, minified frames (flagged), props such as code: 'ENOENT'.

  • Java/Kotlin/Scala: Exception in thread, Caused by:, Suppressed:, ... 23 more (the elided frames are copied from the enclosing trace), Native Method, module prefixes (java.base/, app//), logback ~[jar:ver] suffixes.

  • Go: panic: (including [recovered] re-panics), fatal error: with runtime stack:, goroutine dumps with created by, the race detector's WARNING: DATA RACE.

  • Rust: thread 'x' panicked at in the old and the 1.73+ message layout, RUST_BACKTRACE short and full forms, std/core frames marked, cargo registry frames marked as library.

  • .NET: at Ns.Class.Method() in file:line N, ---> inner exceptions, AggregateException inner exception lists, async state-machine frames.

Security

Trace text is untrusted data.

  • Nothing in a trace is executed, imported or evaluated.

  • Input is capped at 5,000,000 characters and 4,000 characters per line; every parser is single-pass and linear time. The test suite feeds each parser pathological shapes (a million open parentheses, 100k repeated headers, quadratic-regex bait) with a time limit.

  • Paths in traces are data. map_to_code never opens a path taken from a trace: it indexes the files that actually exist under --dir and matches frames against that index by trailing path components, so ../../etc/passwd can only ever select a file already inside the sandbox. Symlinks are resolved with realpath before every read and refused when they leave the sandbox; symlinked directories are not followed.

  • find_traces_in_file and map_to_code(project_dir=...) only accept paths inside --dir.

  • Output is redacted by default. Redaction is pattern based (see redact_trace); it is a safety net, not a guarantee, so review before publishing. IPv6 coverage is partial (full 8-group, fe80::, and bracketed forms).

Limits

Heuristics decide app vs library: a project vendored into site-packages or node_modules looks like a library, and a library copied into your tree looks like your code. Minified JavaScript frames cannot be mapped without a source map. Trace formats evolve; if a real trace parses wrongly, please open an issue with the (redacted) text.

Development

uv sync --extra test
uv run pytest
uv run ruff check src tests
uv run mypy --strict src

MIT licensed. See also the companion course, stacktrace-mcp-the-hard-way.

Available Tools

7 tools
compare_tracesA

Decide whether two traces share a root cause and list the differences by frame.

Reports SAME / LIKELY SAME / POSSIBLY related / DIFFERENT with the fingerprints, the application frames both have, and the frames only one has (same function at a different line is called out as a code change).

Args: a: First trace text (the first trace in it is used). b: Second trace text. redact: Remove secrets etc. from the output (default true).

Inputs: a (required), b (required), redact. Returns: result

explain_exceptionA

Explain a common exception type: what it means, its three most common causes, what to check first.

Covers about 80 exceptions across Python, Node, Java/Kotlin, Go, Rust and .NET (for example KeyError, ECONNREFUSED, NullPointerException, "concurrent map writes", "unwrap on None", NullReferenceException). Package prefixes are ignored (java.lang.NullPointerException = NullPointerException).

Args: type: Exception name or distinctive message, e.g. "KeyError", "java.lang.OutOfMemoryError", "nil pointer dereference". language: Optional: python, node, java, go, rust or dotnet. Omit to search all.

Inputs: type (required), language. Returns: result

find_traces_in_fileA

Scan a log file for every stack trace and group them by fingerprint.

Streams the file (never loads it whole; caps: 256 MB scanned, 1000 distinct groups) and returns the groups sorted by count with first/last seen timestamps (when the lines have ISO timestamps) or line numbers, the exception, and the innermost application frame. The file must be inside the --dir sandbox (relative paths are relative to the first --dir).

Args: path: Log file path, absolute or relative to the sandbox directory. top: How many groups to list (default 15). redact: Remove secrets etc. from the output (default true).

Inputs: path (required), top, redact. Returns: result

fingerprintA

Compute a stable fingerprint for each trace in the text.

The hash covers the language, the top-level and root-cause exception types and the innermost application frames (function + file base name). Messages, memory addresses, ids, container-vs-local path prefixes, generated names ($$Proxy123) and, by default, line numbers are ignored, so the same bug on another run, host or commit hashes identically while a different bug does not. The components that went into the hash are listed so a changed fingerprint can be explained.

Args: text: One or more traces (max 5,000,000 characters). include_line_numbers: Also hash line numbers (stricter: edits to the file change the hash). redact: Remove secrets etc. from the output (default true).

Inputs: text (required), redact, include_line_numbers. Returns: result

map_to_codeA

Map the application frames of a trace onto files in the project and show the code.

Works when the trace's paths differ from the local ones: container paths (/app/src/x.py vs ./src/x.py), Windows vs POSIX separators, webpack/vite URLs, Java package paths. Frames are matched on their trailing path components against files that actually exist under the sandbox directory. For each frame it reports FOUND / NOT FOUND / ambiguous, whether the line number exists, the offending line with +-context lines, and warns when the source line recorded in the trace differs from the file (the code changed since the crash). Paths in the trace are treated as data: '../' tricks cannot reach outside --dir and symlinks that resolve outside it are refused.

Args: text: The trace (max 5,000,000 characters). project_dir: Directory to search; must be inside --dir. Default: the first --dir. context: Lines of context before/after the offending line (0-10, default 3). max_frames: Maximum application frames to map (default 8). index: Which trace if the text contains several (0-based). redact: Remove secrets etc. from the output, including source lines (default true).

Inputs: text (required), index, redact, context, +2 more. Returns: result

parse_traceA

Parse a pasted stack trace / crash output and explain it.

Auto-detects Python (chained exceptions, ExceptionGroup, SyntaxError), Node/V8 (cause, AggregateError, async frames), Java/Kotlin (Caused by, suppressed, "... N more"), Go (panic, fatal error, goroutine dumps, race reports), Rust (panic + RUST_BACKTRACE) and .NET (inner exceptions). Returns the exception chain with the ROOT CAUSE marked, every frame classified as application vs library/stdlib/framework/runtime, the innermost application frame, and a fingerprint. Truncated or garbled input is parsed as far as possible and flagged PARTIAL with a reason.

Args: text: The raw trace, optionally surrounded by other log lines (max 5,000,000 characters). index: If the text contains several traces, which one (0-based). The report says how many. format: "report" (compact text, default) or "json" (full structure). full: Show every frame instead of collapsing runs of library frames. max_frames: Maximum frames listed for the root cause (default 25). redact: Remove secrets, emails, IPs and home-directory names from the output (default true).

Inputs: text (required), full, index, format, +2 more. Returns: result

redact_traceA

Remove secrets and personal data from a trace or log excerpt, returning the cleaned text.

Removes API keys and tokens (JWT, Bearer, AWS, GitHub, Slack, Stripe, Google, sk-...), password=/token= style values, credentials in URLs, emails, IPv4 and full IPv6 addresses, and user names in home directories (C:\Users\name, /home/name, /Users/name). Safe to run before pasting a trace into a ticket. Every other tool also redacts its output by default.

Args: text: Text to clean (max 5,000,000 characters).

Inputs: text (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool maps to a distinct action in a clear pipeline: parse a trace, fingerprint it, scan a file for traces, map frames to source, compare two traces, explain a named exception type, and redact text. The only near-neighbors (parse_trace vs explain_exception, redact_trace vs the per-tool redact flag) are clearly separated by input type and scope, so misselection is unlikely.

    Naming Consistency4/5

    All names are snake_case and almost all follow a verb_noun pattern (parse_trace, compare_traces, map_to_code, redact_trace, find_traces_in_file). The lone outlier is 'fingerprint', which is a bare verb with no object, a minor deviation but still unambiguous.

    Tool Count5/5

    Seven tools is well within the ideal 3-15 range and each one covers a distinct step in a trace-triage workflow with no filler or redundancy. Nothing feels padded or missing at the count level.

    Completeness4/5

    The surface covers the full workflow: parse, stable identity via fingerprint, batch scanning of logs, source mapping, comparison, per-exception guidance, and sanitization. Minor gaps remain, such as no direct way to extract/normalize a single trace out of an arbitrary file path or to persist results, but agents can work around these with parse_trace and find_traces_in_file.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • -
      license
      Not graded
      quality
      Not graded
      maintenance
      MCP server that parses stack traces and logs to generate deduplicated issue drafts with severity, repro steps, and owner guesses.
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI coding agents to observe real-time Node, Vite, Next.js, Storybook, TypeScript, and browser runtime errors from a wrapped dev server, source-mapped to exact file, line, and column with the log lines preceding each crash. It exposes MCP tools for listing open errors, fetching full stack details, and checking or marking fixes as resolved, all locally with no code changes.
      4
      43 npm
      MIT