Content
# Crash MCP Server
Based on MCP (Model Context Protocol) server for **Crash Dump** analysis.
Integrates Linux `crash` utility and `drgn` programmable debugger, providing a unified analysis interface.
## Features
- **Unified Session**: Supports both `crash` and `drgn` engines simultaneously
- **Session Deduplication**: Automatically reuses existing sessions for the same vmcore
- **Command Persistence**: Outputs are automatically saved to disk, supporting pagination and search
- **Remote Analysis**: Connects to remote hosts via SSH without downloading vmcore
- **Multiple Transport Modes**: Stdio (default) / SSE (HTTP)
- **Intelligent Architecture Recognition**: Automatically detects vmcore architecture and selects the corresponding crash version
- **Automatic Compilation**: Built-in crash tool compiler, supports multiple architectures and compression formats
## Installation
### Prerequisites
- Python 3.10+
- `crash` tool (can be installed via the built-in compiler)
- `python3-dev` (required for compiling PyKdump)
- `drgn` tool (automatically installed via pip)
### Quick Installation
```bash
chmod +x install.sh && ./install.sh
```
### Compile Crash Tool
```bash
# Activate virtual environment
source venv/bin/activate
# View dependency installation instructions
compile-crash --deps
# Compile x86_64 version
compile-crash
# Compile ARM64 version (analyze ARM64 vmcore on x86_64)
compile-crash --arch ARM64
# Compile version with PyKdump support
compile-crash --pykdump-from-source
```
## Usage
### Start Server
```bash
# Stdio mode
crash-mcp
# SSE mode
crash-mcp --transport sse --port 8000
```
### MCP Tools
| Tool | Description |
|------|------|
| `open_vmcore_session` | Opens a vmcore crash dump file for analysis |
| `run_crash_command` | Executes crash commands, supports PyKdump extensions |
| `run_drgn_command` | Executes drgn Python code |
| `close_vmcore_session` | Closes the current analysis session |
| `get_command_output` | Paginates and retrieves long command outputs |
| `search_command_output` | Searches command outputs using regular expressions |
| `run_analysis_script` | Runs a predefined analysis script (requires configuring `DRGN_SCRIPTS_PATH`) |
| `list_analysis_scripts` | Lists available analysis scripts (requires configuring `DRGN_SCRIPTS_PATH`) |
| `get_crash_info` | Retrieves a crash diagnostic report (requires configuring `GET_DUMPINFO_SCRIPT`) |
### Configuration
| Environment Variable | Default Value | Description |
|----------|--------|------|
| `CRASH_EXTENSION_LOAD` | `true` | Whether to automatically load extensions |
| `CRASH_MCP_TRUNCATE_LINES` | `20` | Number of lines to truncate in the output |
| `CRASH_MCP_WORKDIR` | `/tmp/crash-mcp-sessions` | Session working directory |
| `CRASH_MCP_CACHE` | `true` | Enable command caching |
| `LOG_LEVEL` | `INFO` | Log level |
| `GET_DUMPINFO_SCRIPT` | (empty) | Command template for automated diagnostic scripts (e.g., `python3 script.py {vmcore} {vmlinux}`) |
| `DRGN_SCRIPTS_PATH` | (empty) | External drgn script search path (colon-separated) |
### Client Configuration
**Claude Desktop** (`claude_desktop_config.json`):
```json
{
"mcpServers": {
"crash-analysis": {
"command": "/path/to/crash-mcp/venv/bin/crash-mcp"
}
}
}
```
## Examples
```python
# Local analysis
open_vmcore_session("/var/crash/vmcore", "/usr/lib/debug/vmlinux")
run_crash_command("bt")
run_crash_command("sys")
run_drgn_command("prog['init_task'].comm")
# Paginate long output
run_crash_command("ps") # Returns command_id
get_command_output("crash:ps", offset=20, limit=50)
# Search output
search_command_output("crash:bt", "schedule")
# Remote analysis
open_vmcore_session("/var/crash/vmcore", "/usr/lib/debug/vmlinux",
ssh_host="server-01", ssh_user="root")
```
## Common Issues
### 1. `no lzo compression support` error
The vmcore file uses LZO compression, but LZO support was not enabled when compiling the crash tool.
```bash
sudo apt-get install liblzo2-dev
compile-crash --clean
```
### 2. Missing GMP/MPFR libraries
```bash
sudo apt-get install libgmp-dev libmpfr-dev
```
### 3. View all compilation dependencies
```bash
compile-crash --deps
```
## License
[MIT License](LICENSE)
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
markitdown
MarkItDown-MCP is a lightweight server for converting URIs to Markdown.
firecrawl
Firecrawl MCP Server enables web scraping, crawling, and content extraction.
servers
Model Context Protocol Servers
Time
A Model Context Protocol server for time and timezone conversions.
Filesystem
Node.js MCP Server for filesystem operations with dynamic access control.
Sequential Thinking
A structured MCP server for dynamic problem-solving and reflective thinking.