crash-mcp
ELF-Core-Dateien und native Minidumps untersuchen, um abstürzende Threads, Stacks und Disassemblierungen mithilfe von MCP-stdio-Tools zu identifizieren.
Dokumentation
crash-mcp
crash-mcp is a Model Context Protocol (MCP) server for inspecting native crash dumps. It loads Linux/Unix ELF core files and Windows minidumps, then exposes crash summaries, threads, stack information, disassembly, and dump comparisons to an MCP client over stdio. It parses the supplied files; it does not execute a dump.
Turkish / Türkçe: crash-mcp, ELF core ve Windows minidump dosyalarını inceleyen bir MCP sunucusudur. Çökme özeti, iş parçacıkları, stack bilgisi, disassembly ve dump karşılaştırmasını stdio üzerinden MCP istemcilerine sunar. Döküm dosyasını çalıştırmaz.
What it supports
- ELF core dumps: format, architecture, process/thread/module data, registers, memory-backed disassembly, and optional GDB backtraces.
- Windows minidumps: architecture, exception, thread/module data, memory-backed disassembly, and best-effort frame-pointer stack walking.
- One active session:
crash_loadreplaces the current dump only after the new dump has been parsed successfully. - Bounded inspection: thread and stack results are paginated; input sizes, binary-path counts, and disassembly windows are capped.
- Python 3.10–3.12: the package is configured for Python 3.10 or newer; CI exercises 3.10, 3.11, and 3.12 on Linux.
Platform notes
| Platform | ELF core | Windows minidump | Notes |
|---|---|---|---|
| Linux | Full analysis; GDB backtraces when gdb is installed | Supported | Install gcc, gdb, and binutils for the full fixture/test workflow. |
| Windows | Summary/core metadata only | Supported | ELF stack traces are unavailable because the GDB path is Linux-oriented. |
| macOS | Summary/core metadata only | Supported | Minidump tests are supported; GDB may not be installed. |
Installation
The repository defines the crash-mcp console entry point as crash_mcp.server:main.
Install a tagged release from GitHub
python -m pip install \
"crash-mcp @ git+https://github.com/RivaExits0/crash-mcp.git@v0.1.1"
Install from a checkout
git clone https://github.com/RivaExits0/crash-mcp.git
cd crash-mcp
python -m pip install -e ".[dev]"
For a runtime-only editable install, use python -m pip install -e .. The package dependencies are mcp, pyelftools, minidump, and capstone; the dev extra adds pytest and the lint extra adds Ruff and mypy.
Optional system dependencies
- Linux runtime: install
gdbto enable ELF core backtraces;binutilsis useful for the native debugging toolchain. - Linux test fixture:
gccand a system that permits core-dump generation are required bymake core. - Windows/macOS: no native ELF fixture is required for the platform-compatible minidump tests.
Run the server
After installation, start the stdio server with the console command:
crash-mcp
The process communicates through stdin/stdout using MCP stdio transport. Keep stdout reserved for the MCP connection when embedding or launching the server from another process.
Client configuration
Claude Desktop
Add the server to claude_desktop_config.json:
{
"mcpServers": {
"crash-mcp": {
"command": "crash-mcp",
"args": [],
"env": {}
}
}
}
If the executable is not on PATH, replace command with its full path. On Windows, for example:
{
"mcpServers": {
"crash-mcp": {
"command": "C:\\path\\to\\.venv\\Scripts\\crash-mcp.exe",
"args": [],
"env": {}
}
}
}
OpenCode
Add this entry to opencode.json:
{
"mcp": {
"crash": {
"type": "local",
"command": ["crash-mcp"],
"enabled": true
}
}
}
MCP tools
All tools return JSON text on success or an error: ... string on failure. Call crash_load before session-dependent tools.
| Tool | Parameters | Purpose |
|---|---|---|
crash_load | dump_path, optional binary_paths, optional symbols_path | Parse an ELF core or Windows minidump and load it into the session. Detects format, architecture, threads, modules, and exception/crash information. |
crash_summary | none | Return a short summary of the loaded dump, including crash location/thread, architecture, module information, symbol-resolution status, and ELF GDB availability. |
crash_threads | optional limit (default 20), offset (default 0) | List threads with IDs, state, program counter, and a stack-summary hint. |
crash_stack | thread_id, optional limit (default 30), offset (default 0) | Return a paginated stack. ELF uses batch GDB when available; minidumps use a best-effort frame-pointer walk. |
crash_disassemble | address, optional before (default 8), after (default 8) | Disassemble instructions around an address present in the loaded dump. |
crash_compare | dump_path_a, dump_path_b | Load and compare two dumps. Same-format comparisons include architecture, crash signal/address, thread counts, and module counts; cross-format comparison is limited. |
A typical workflow is:
- Call
crash_loadwith the dump path and, for ELF symbolization, the matching executable(s) and optional symbols file. - Call
crash_summaryto identify the crash address and faulting thread. - Call
crash_threads, thencrash_stackfor the relevant thread. - Call
crash_disassemblearound the crash address when the dump contains readable memory. - Use
crash_comparewhen comparing two dump files.
Example calls
{"tool":"crash_load","args":{"dump_path":"tests/core","binary_paths":["tests/crash"]}}
{"tool":"crash_threads","args":{"limit":5,"offset":0}}
{"tool":"crash_stack","args":{"thread_id":4486,"limit":10,"offset":0}}
{"tool":"crash_disassemble","args":{"address":"0x4007c4","before":2,"after":2}}
{"tool":"crash_compare","args":{"dump_path_a":"tests/core","dump_path_b":"tests/core"}}
Pagination and bounds
crash_threads and crash_stack return total, offset, limit, returned, and has_more fields. The effective limit for both tools is capped at 1,000 items. Disassembly windows are capped at 32 instructions before and after the requested address.
By default, crash_load rejects dumps larger than 4 GiB and more than 256 binary paths. Override these process-level defaults only when appropriate:
CRASH_MAX_DUMP_BYTES=8589934592 CRASH_MAX_BINARY_PATHS=512 crash-mcp
Security and data handling
- The server does not execute the supplied dump and does not scan the filesystem beyond paths provided to its tools.
- External commands are invoked with argument lists rather than
shell=True; the GDB path uses an absolute executable, batch mode, a timeout, and disables GDB auto-loading. - Dump, binary, and symbol paths are validated, normalized, and checked for existence. Failed loads do not replace an already-loaded session.
- The server does not make network requests as part of crash analysis.
- Results focus on metadata, registers, addresses, frames, and disassembly. Treat dump files, paths, symbol files, and returned crash data as sensitive; access to the MCP server should be restricted accordingly.
Limitations
- ELF stack traces require a working
gdbinstallation and matching binary paths; without GDB, the tool reports registers/PC information or an unavailable-stack reason. - Minidump stacks are best-effort frame-pointer walks and may be incomplete. Thread-context support depends on the installed
minidumplibrary and the data present in the dump. - Disassembly requires readable memory at or around the requested address and an architecture that Capstone can decode.
- Cross-format comparisons provide only a limited common summary; missing symbols and missing dump fields are reported as unknown rather than inferred.
- Static dump inspection cannot guarantee the original runtime behavior.
Testing and development
Build the Linux ELF fixture
make core
This compiles tests/crash from tests/crash.c and creates tests/core. The helper intentionally crashes; this is only a test fixture. On non-Linux platforms, use the platform-compatible tests instead.
Run the full Linux suite
make test
# equivalent after the fixture exists:
python -m pytest -q
The suite covers ELF parsing, GDB-backed stacks, minidump mocks, MCP smoke behavior, validation, pagination, and hardening paths.
Run platform-compatible tests
python -m pytest tests/test_minidump_mock.py tests/test_extra.py -q
Run checks used by CI
python -m pip install -e ".[lint]"
ruff check src tests
mypy src/crash_mcp
Clean generated fixtures
make clean
Project layout
src/crash_mcp/
├── server.py MCP tool definitions and stdio entry point
├── analyzer.py Session management, validation, pagination, reporting
├── elf_core.py ELF core parsing and GDB-backed stack traces
├── minidump_reader.py Windows minidump parsing
└── platform_utils.py Cross-platform paths, subprocess, and file helpers
License
MIT — see LICENSE.