PCILeech MCP Server

PCILeech MCP Server

Enables AI assistants to perform DMA-based memory operations through PCILeech hardware using natural language commands, supporting memory reading, writing, and multi-format visualization for debugging and security research.

Category
访问服务器

README

MCP Server for PCILeech

English | 中文

English

A Model Context Protocol (MCP) server that provides a standardized interface to PCILeech for DMA-based memory operations. This server enables AI assistants like Claude to perform memory debugging through natural language commands.

Authors: EVAN & MOER Support: Join our Discord

Features

  • Three MCP Tools:

    • memory_read: Read memory from any address
    • memory_write: Write data to memory
    • memory_format: Multi-view memory formatting (hex dump, ASCII, byte array, DWORD)
  • Low Latency: Direct subprocess calls to PCILeech binary

  • AI-Friendly: Natural language interface through MCP protocol

  • Simple Configuration: Minimal dependencies, easy setup

  • Multiple Formats: View memory in hex, ASCII, byte arrays, and DWORD arrays

Prerequisites

  • Windows 10/11 (x64)
  • Python 3.10+
  • PCILeech hardware properly configured and working
  • PCILeech binary (included in pcileech/ directory)

Quick Start

1. Clone Repository

git clone https://github.com/Evan7198/mcp_server_pcileech
cd mcp_server_pcileech

2. Install Dependencies

Create and activate virtual environment:

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt

3. Verify PCILeech

Test that PCILeech hardware is working:

cd pcileech
pcileech.exe probe

You should see hardware detection output.

4. Configure for Claude Code

Add this configuration to your Claude Code MCP settings:

"mcpServers": {
  "pcileech": {
    "command": "C:\\path\\to\\mcp_server_pcileech\\.venv\\Scripts\\python.exe",
    "args": [
      "C:\\path\\to\\mcp_server_pcileech\\main.py"
    ],
    "cwd": "C:\\path\\to\\mcp_server_pcileech",
    "env": {}
  }
}

Important: Replace C:\\path\\to\\mcp_server_pcileech with your actual project path.

5. Restart Claude Code

After adding the configuration, restart Claude Code to load the MCP server.

Configuration

The server uses config.json for configuration:

{
  "pcileech": {
    "executable_path": "pcileech\\pcileech.exe",
    "timeout_seconds": 30
  },
  "server": {
    "name": "mcp-server-pcileech",
    "version": "0.1.0"
  }
}

Adjust executable_path and timeout_seconds if needed for your setup.

Usage Examples

Once configured in Claude Code, you can use natural language commands:

Reading Memory

Read 256 bytes from address 0x1000

Writing Memory

Write the hex data 48656c6c6f to address 0x2000

Formatted Memory View

Show me a formatted view of 64 bytes at address 0x1000

This will display:

  • Hex dump with ASCII sidebar
  • Pure ASCII view
  • Byte array (decimal)
  • DWORD array (little-endian)
  • Raw hex string

MCP Tools Reference

memory_read

Read raw memory from specified address.

Parameters:

  • address (string): Memory address in hex format (e.g., "0x1000" or "1000")
  • length (integer): Number of bytes to read (1-1048576, max 1MB)

Returns: Hex string of memory data with metadata

memory_write

Write data to memory at specified address.

Parameters:

  • address (string): Memory address in hex format
  • data (string): Hex string of data to write (e.g., "48656c6c6f")

Returns: Success status with confirmation

memory_format

Read memory and format in multiple views for AI analysis.

Parameters:

  • address (string): Memory address in hex format
  • length (integer): Number of bytes to read (1-4096, max 4KB)
  • formats (array, optional): Format types to include - ["hexdump", "ascii", "bytes", "dwords", "raw"]

Returns: Multi-format memory view

Architecture

Two-Layer Design

  1. MCP Server Layer (main.py)

    • Handles MCP protocol communication via stdio transport
    • Defines tool schemas and parameter validation
    • Formats output for AI analysis
    • Async tool handlers: handle_memory_read, handle_memory_write, handle_memory_format
  2. PCILeech Wrapper Layer (pcileech_wrapper.py)

    • Manages PCILeech executable subprocess calls
    • Handles address alignment and chunked reads (256-byte blocks, 16-byte alignment)
    • Parses PCILeech output format
    • Timeout and error handling

Key Implementation Details

Memory Read Alignment:

  • PCILeech display command always returns 256 bytes aligned to 16-byte boundaries
  • read_memory() automatically handles:
    • Calculating aligned addresses
    • Chunked reading of 256-byte blocks
    • Extracting and concatenating requested byte ranges
    • Supporting arbitrary addresses and lengths

Troubleshooting

PCILeech Not Found

Error: PCILeech executable not found

Solution: Verify the path in config.json points to the correct location of pcileech.exe

Hardware Not Connected

Warning: PCILeech connection verification failed

Solution:

  • Ensure PCILeech hardware is properly connected
  • Test with pcileech.exe probe directly
  • Check hardware drivers are installed

Memory Read/Write Fails

Error: Memory read/write failed

Possible causes:

  • Invalid memory address
  • Hardware access denied
  • Target system not accessible
  • Insufficient permissions

Solution: Verify the target address is valid and accessible by testing with PCILeech CLI first.

Timeout Errors

Error: PCILeech command timed out

Solution: Increase timeout_seconds in config.json if operations are legitimately slow.

Project Structure

mcp_server_pcileech/
├── main.py                 # MCP server entry point
├── pcileech_wrapper.py     # PCILeech integration layer
├── config.json             # Configuration file
├── requirements.txt        # Python dependencies
├── pyproject.toml          # Project metadata
├── README.md               # This file (English)
├── README_CN.md            # Chinese version
├── CLAUDE.md               # Claude Code guidance
├── docs/
│   └── brief.md            # Project brief
└── pcileech/               # PCILeech binary and dependencies
    └── pcileech.exe

Development

Code Formatting

black main.py pcileech_wrapper.py

Type Checking

mypy main.py pcileech_wrapper.py

Running Tests

pytest

Performance

  • MCP Server overhead: < 100ms per operation
  • PCILeech native performance: Maintained (no additional overhead)
  • End-to-end latency: < 5 seconds (including AI processing)

Limitations

  • Windows only: PCILeech is Windows-specific
  • Hardware dependent: Requires PCILeech hardware connection
  • Read size limits:
    • memory_read: Maximum 1MB
    • memory_format: Maximum 4KB (for readable output)
  • Synchronous PCILeech calls: Wrapper uses subprocess.run (blocking), called in async context
  • No concurrent memory operations: Each PCILeech command executes sequentially

Security & Legal

IMPORTANT DISCLAIMER

This tool is designed for:

  • Authorized hardware debugging
  • Security research with proper authorization
  • Educational purposes
  • Personal hardware development

DO NOT use for:

  • Unauthorized access to systems
  • Malicious activities
  • Circumventing security measures without permission

Users are responsible for ensuring their use complies with all applicable laws and regulations.

License

This project wraps PCILeech which has its own license. See pcileech/LICENSE.txt for PCILeech licensing.

Credits

Version

v0.1.0 - Initial MVP Release

Support

Changelog

v0.1.0 (2025-12-10)

  • Initial release
  • Three MCP tools: memory_read, memory_write, memory_format
  • PCILeech subprocess integration
  • Basic error handling and timeout support
  • Claude Code integration support
  • Multi-format memory visualization

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选