Dynamic MCP Server

Dynamic MCP Server

Enables crash dump analysis and kernel debugging by integrating the real crash utility with automatic dump discovery, kernel matching, and session management.

Category
访问服务器

README

Dynamic MCP Server

A professional MCP (Model Context Protocol) server for crash dump analysis and kernel debugging.

Features

  • Real Crash Utility Integration: Execute actual crash utility commands with real output
  • Automatic Crash Dump Discovery: Find and list crash dumps in /var/crash
  • Intelligent Kernel Matching: Automatic kernel debug symbol detection and matching
  • Session Management: Robust crash analysis session lifecycle management
  • Multiple Dump Formats: Support for vmcore, core, crash, and dump files
  • Professional Forensics: Real kernel debugging and system forensics capabilities

Requirements

  • Crash Utility: Version 8.0.4+ (system package: crash)
  • Python: 3.10+ (3.11+ recommended)
  • Kernel Debug Symbols: Available in /usr/lib/debug/lib/modules/
  • Crash Dumps: Accessible in /var/crash/ or custom location
  • Permissions: Read access to crash dumps and kernel files

Installation

Quick Install (Recommended)

# Install directly from source
pip install -e .

Development Install

# Create virtual environment (optional but recommended)
python3 -m venv dynamic_mcp_env
source dynamic_mcp_env/bin/activate

# Install dependencies and package
pip install -e .

System Install

# Install system-wide (requires sudo)
sudo pip install .

System Install with Systemd Service

# Install system-wide with automatic systemd service setup
sudo pip install .

This automatically:

  • Installs the package
  • Copies the systemd service file
  • Creates the dynamic-mcp user and group
  • Creates required directories
  • Registers the service with systemd

See SYSTEMD_INSTALLATION.md for detailed systemd setup instructions.

Usage

Running the MCP Server

Stdio Mode (Default)

# Run the server with stdio transport
dynamic-mcp

# Or with module syntax
python -m dynamic_mcp.server

HTTP/SSE Mode

# Run the server with HTTP transport on default port 8080
dynamic-mcp-http

# Or with module syntax
python -m dynamic_mcp.server --http

# Access the server at: http://localhost:8080/sse

MCP Client Configuration

For Stdio Transport

Add to your MCP client configuration (e.g., Claude Desktop):

{
  "mcpServers": {
    "dynamic-mcp": {
      "command": "python",
      "args": ["-m", "dynamic_mcp.server"],
      "env": {
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

For HTTP/SSE Transport

Configure your MCP client to connect to the HTTP endpoint:

{
  "mcpServers": {
    "dynamic-mcp": {
      "url": "http://localhost:8080/sse",
      "env": {
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

Testing

# Run crash analysis tests
pytest tests/crash/

# Test crash utility integration
python tests/crash/test_crash_server.py

# Run all tests
pytest

Configuration

Create a .env file with optional configuration:

# Crash dump paths
CRASH_DUMP_PATH=/var/crash
KERNEL_PATH=/boot

# Session timeouts
CRASH_SESSION_TIMEOUT=180
CRASH_COMMAND_TIMEOUT=120

# Logging configuration
LOG_LEVEL=INFO
SUPPRESS_MCP_WARNINGS=true

MCP Tools

The server provides 5 comprehensive crash analysis tools:

1. crash_command

Execute crash utility commands with real output.

Parameters:

  • command (string): Crash utility command to execute
  • timeout (integer, optional): Command timeout in seconds (default: 120)

Example:

{
  "command": "sys",
  "timeout": 60
}

2. get_crash_info

Get information about current crash dump and session.

Returns:

  • Active session details
  • Available crash dumps
  • System requirements status

3. list_crash_dumps

List all available crash dumps.

Parameters:

  • max_dumps (integer, optional): Maximum number of dumps to return (default: 10)

Returns:

  • Crash dump details (name, path, size, timestamp)
  • Readability status

4. start_crash_session

Start a new crash analysis session.

Parameters:

  • dump_name (string, optional): Specific dump name (uses latest if not specified)
  • timeout (integer, optional): Session startup timeout (default: 180)

Returns:

  • Session startup status
  • Matched kernel information

5. close_crash_session

Close the active crash analysis session.

Returns:

  • Session closure status

Example Usage

Basic Crash Analysis Workflow

  1. List available crash dumps:

    # Use the list_crash_dumps tool
    
  2. Start a crash session:

    # Use start_crash_session tool (auto-selects latest dump)
    
  3. Execute crash commands:

    # System information
    crash_command: "sys"
    
    # Backtrace
    crash_command: "bt"
    
    # Process list
    crash_command: "ps"
    
    # Kernel log
    crash_command: "log"
    
    # Module information
    crash_command: "mod"
    
  4. Close session when done:

    # Use close_crash_session tool
    

Troubleshooting

System Requirements

Crash utility not found:

# Install crash utility (RHEL/CentOS/Fedora)
sudo yum install crash
# or
sudo dnf install crash

# Install crash utility (Ubuntu/Debian)
sudo apt-get install crash

No crash dumps found:

  • Check /var/crash/ directory exists and has crash dumps
  • Ensure read permissions on crash dump files
  • Verify crash dumps are valid format (vmcore, core, etc.)

Kernel debug symbols missing:

  • Install kernel debug packages
  • Check /usr/lib/debug/lib/modules/ for debug symbols
  • Ensure kernel version matches crash dump

MCP Initialization Warnings

You may see warnings like:

WARNING - Failed to validate request: Received request before initialization was complete

This is normal MCP protocol behavior and doesn't affect functionality.

To suppress these warnings:

export SUPPRESS_MCP_WARNINGS=true

How It Works

  1. Crash Dump Discovery: Automatically scans /var/crash/ for crash dumps
  2. Kernel Matching: Finds matching kernel debug symbols in /usr/lib/debug/
  3. Session Management: Starts crash utility process with proper kernel and dump
  4. Command Execution: Uses pexpect to interact with crash utility process
  5. Output Capture: Returns real crash utility output with proper formatting

Supported Crash Analysis

Crash Commands

  • System Info: sys, mach, help
  • Process Analysis: ps, task, files
  • Memory Analysis: kmem, vm, search
  • Stack Analysis: bt, bt -a, bt -f
  • Kernel Analysis: log, dmesg, mod
  • Disassembly: dis, gdb
  • Lustre Analysis: Lustre-specific commands for filesystem debugging

Crash Dump Formats

  • vmcore: Standard Linux kernel crash dumps
  • core: Core dump files
  • crash: Crash utility format
  • dump: Generic dump files

Kernel Support

  • Debug Symbols: Automatic detection from /usr/lib/debug/
  • Kernel Versions: Support for multiple kernel versions
  • Lustre Kernels: Special support for Lustre filesystem kernels

Architecture

  • MCP Protocol: Full compliance with Model Context Protocol
  • Real Integration: Uses actual crash utility (not simulation)
  • Session Management: Robust process lifecycle management
  • Error Handling: Comprehensive error handling and recovery
  • Logging: Detailed logging for debugging and monitoring

License

This project is licensed under the MIT License.

Copyright © 2025 42Research Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software.

For full license terms, see the LICENSE file.

Contact: Email: software@42research.co.uk | Website: https://42research.co.uk

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

Support

For issues and questions:

  • Check the troubleshooting section above
  • Review system requirements
  • Ensure crash utility and debug symbols are properly installed

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选