Skip to main content
Glama
capstone-mcp-server

capstone-mcp-server

by Tokeii0

Capstone MCP Server

中文 | English

基于 Capstone 反汇编引擎的 MCP (Model Context Protocol) 服务器,为大语言模型提供二进制分析能力。

功能特性

  • 多架构支持: x86 (16/32/64)、ARM/ARM64、MIPS (32/64)、PowerPC (32/64)

  • 多格式解析: PE、ELF、Mach-O 二进制文件自动识别与解析

  • 反汇编工具: 支持 hex 字节串、文件区段、虚拟地址、文件偏移等多种输入方式

  • 控制流分析: 基本块识别、跳转/调用/返回分析

  • 指令搜索: 按助记符或指令类别过滤搜索

  • 架构自动检测: 从 PE/ELF/Mach-O 文件头自动推断 CPU 架构

  • ROP Gadget 搜索: 查找以 ret 结尾的指令片段,用于 ROP 链构造

  • 安全特性检测: 类似 checksec,检测 NX/PIE/RELRO/Canary/ASLR 等

  • PLT/GOT & IAT 分析: ELF 动态链接表与 PE 导入表分析

  • 字符串提取: 支持 ASCII 和 UTF-16LE 编码的可读字符串扫描

  • XOR 编解码: 单字节暴力破解与多字节密钥 XOR 运算

  • 缓冲区溢出辅助: De Bruijn 序列生成与偏移计算(pattern_create/offset)

  • 加密常量识别: 检测 AES S-Box、SHA、MD5、TEA、CRC32、Base64 等常量

  • Shellcode 分析: NOP sled、syscall、jmp/call esp 等模式检测

  • Syscall 查找: Linux x86/x64/ARM/ARM64 系统调用表查询

  • Hex Dump: 格式化的十六进制转储查看

  • 交叉引用查询: 在代码中搜索对指定地址的所有引用(call/jump/立即数/内存访问)

Related MCP server: Reversecore_MCP

提供的 MCP 工具

基础反汇编工具

工具

说明

list_supported_architectures

列出所有支持的 CPU 架构

disassemble_hex

反汇编十六进制字节串

disassemble_file_section

反汇编二进制文件的指定区段

disassemble_at_address

反汇编文件中指定虚拟地址处的代码

disassemble_entrypoint

反汇编二进制文件入口点

disassemble_raw_offset

反汇编文件偏移处的原始字节

get_binary_info

获取二进制文件元信息(格式、架构、区段、导入/导出)

search_instructions

在 hex 字节串中搜索指令模式

search_instructions_in_file

在二进制文件中搜索指令模式

analyze_code_flow

对机器码进行控制流分析

find_xrefs_hex

在 hex 字节串中搜索对目标地址的交叉引用

find_xrefs_in_file

在二进制文件中搜索对目标地址的交叉引用

CTF / 逆向扩展工具

工具

说明

CTF 场景

find_rop_gadgets_hex

在 hex 字节串中搜索 ROP gadgets

Pwn - ROP 链构造

find_rop_gadgets_in_file

在二进制文件中搜索 ROP gadgets

Pwn - ROP 链构造

extract_strings_from_file

提取可读字符串(类似 strings)

RE / Misc / Forensics

xor_brute_force

单字节 XOR 暴力破解

Crypto / RE

xor_encode_decode

指定密钥 XOR 编解码

Crypto / RE

buffer_overflow_pattern

生成/查找缓冲区溢出 pattern(De Bruijn)

Pwn - 偏移计算

check_security

检测安全特性(类似 checksec)

Pwn - 漏洞利用前置

analyze_plt_got_table

分析 ELF PLT/GOT 或 PE IAT 表

Pwn - GOT overwrite

hex_dump_file

十六进制转储查看文件内容

RE / Forensics

detect_crypto_in_file

检测加密算法常量(AES/SHA/MD5/TEA 等)

Crypto / RE

analyze_shellcode_hex

Shellcode 综合分析(模式检测+统计)

Pwn / RE

syscall_lookup

Linux 系统调用查找(按编号或名称)

Pwn / RE

syscall_list

列出平台全部系统调用表

Pwn / RE

安装

# 克隆项目
git clone <repo-url>
cd capstone-mcp-server

# 安装依赖
pip install -e .

运行

直接运行

capstone-mcp

通过 Python 模块运行

python -m capstone_mcp.server

使用 MCP Inspector 调试

mcp dev src/capstone_mcp/server.py

配置 MCP 客户端

Windsurf / Claude Desktop

在 MCP 配置文件中添加:

{
  "mcpServers": {
    "capstone-disasm": {
      "command": "python",
      "args": ["-m", "capstone_mcp.server"],
      "cwd": "/path/to/capstone-mcp-server"
    }
  }
}

或者使用 uv 运行:

{
  "mcpServers": {
    "capstone-disasm": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/capstone-mcp-server", "capstone-mcp"]
    }
  }
}

使用示例

反汇编 hex 字节串

大模型可调用 disassemble_hex 工具:

输入: hex_code="554889e54883ec10c745fc00000000b8000000004883c4105dc3", arch="x86_64"

输出:

Architecture: x86_64
Base Address: 0x0
Input Size:   25 bytes
────────────────────────────────────────────────────────────────
0x00000000:  55                        push     rbp
0x00000001:  4889e5                    mov      rbp, rsp
0x00000004:  4883ec10                  sub      rsp, 0x10
0x00000008:  c745fc00000000            mov      dword ptr [rbp - 4], 0
0x0000000f:  b800000000                mov      eax, 0
0x00000014:  4883c410                  add      rsp, 0x10
0x00000018:  5d                        pop      rbp
0x00000019:  c3                        ret

分析二进制文件

1. 调用 get_binary_info("C:/path/to/program.exe")  → 获取文件概要
2. 调用 disassemble_entrypoint("C:/path/to/program.exe")  → 查看入口点
3. 调用 search_instructions_in_file("C:/path/to/program.exe", group="call")  → 查找所有调用

依赖

  • Python >= 3.10

  • mcp - Model Context Protocol SDK

  • capstone - 反汇编引擎

  • LIEF - 二进制文件解析库

许可证

MIT

Available Tools

25 tools
analyze_code_flowA

Perform control flow analysis on machine code, identifying basic blocks, jumps, calls and returns.

Args: hex_code: Hex-encoded machine code bytes. arch: CPU architecture. Default: x86_64. base_address: Base address. Default: "0".

Returns: JSON-formatted control flow analysis with basic blocks, edges, calls and return info.

Inputs: hex_code (required), arch, base_address. Returns: result

analyze_plt_got_tableA

Analyze PLT/GOT tables (ELF) or IAT (PE) of a binary file.

PLT/GOT is the core of ELF dynamic linking and the target of GOT overwrite attacks. IAT is the PE Import Address Table, commonly used for hooking and patching.

Args: file_path: Absolute path to the binary file.

Returns: PLT/GOT or IAT analysis results in JSON format.

Inputs: file_path (required). Returns: result

analyze_shellcode_hexA

Comprehensively analyze shellcode: disassembly + pattern detection + statistics.

Detects NOP sleds, syscalls, common shellcode jump patterns, null bytes, etc.

Args: hex_code: Hex-encoded shellcode. arch: CPU architecture. Default: x86_64. base_address: Base address. Default: "0".

Returns: JSON-formatted shellcode analysis results.

Inputs: hex_code (required), arch, base_address. Returns: result

buffer_overflow_patternA

Generate or find offset in a cyclic buffer overflow pattern (De Bruijn sequence).

Used to determine the exact EIP/RIP overwrite offset. Similar to Metasploit's pattern_create / pattern_offset.

Args: action: "create" to generate a pattern, "offset" to find an offset. value: When action="offset", the value to search for (hex like "0x41386141" or ASCII string). length: When action="create", pattern length (default 200). When action="offset", search range.

Returns: Generated pattern or offset lookup result.

Inputs: action (required), value, length. Returns: result

check_securityA

Check security features of a binary file (similar to the checksec tool).

ELF: NX, PIE, RELRO, Stack Canary, FORTIFY, RPATH, Stripped PE: DEP/NX, ASLR, SEH, CFG, Authenticode Mach-O: PIE, Stack Canary, Code Signing

Args: file_path: Absolute path to the binary file.

Returns: Security feature detection results.

Inputs: file_path (required). Returns: result

detect_crypto_in_fileA

Scan a binary file for known cryptographic algorithm constants and signatures.

Detects: AES S-Box, SHA-256, SHA-1, MD5, DES, RC4, Blowfish, TEA/XTEA, CRC32, Base64 alphabet, and common file format signatures.

Args: file_path: Absolute path to the file.

Returns: List of detected crypto constants.

Inputs: file_path (required). Returns: result

disassemble_at_addressA

Disassemble code at a specific virtual address in a binary file.

Args: file_path: Absolute path to the binary file. virtual_address: Starting virtual address as hex string (e.g. "0x401000"). size: Number of bytes to read. Default: 256. arch: CPU architecture. Auto-detected if omitted. max_instructions: Maximum instructions to disassemble. Default: 50.

Returns: Disassembly output at the specified address.

Inputs: file_path (required), virtual_address (required), size, arch, +1 more. Returns: result

disassemble_entrypointA

Disassemble code at the binary file's entrypoint.

Automatically locates the entrypoint address and disassembles from there.

Args: file_path: Absolute path to the binary file. size: Number of bytes to read from the entrypoint. Default: 512. arch: CPU architecture. Auto-detected if omitted. max_instructions: Maximum instructions to disassemble. Default: 100.

Returns: Disassembly output at the entrypoint.

Inputs: file_path (required), size, arch, max_instructions. Returns: result

disassemble_file_sectionA

Disassemble a named section from a binary file (PE/ELF/Mach-O).

Args: file_path: Absolute path to the binary file. section_name: Section name to disassemble. Default: ".text". arch: CPU architecture. Auto-detected from file header if omitted. max_instructions: Maximum instructions to disassemble. Default: 200. Set 0 for unlimited.

Returns: Disassembly output for the section, including file metadata.

Inputs: file_path (required), section_name, arch, max_instructions. Returns: result

disassemble_hexA

Disassemble a hex-encoded byte string into assembly code.

Args: hex_code: Hex-encoded machine code bytes, e.g. "554889e5" or "55 48 89 e5" (spaces are auto-stripped). arch: CPU architecture. Use list_supported_architectures to see available values. Default: x86_64. base_address: Base address as a hex string (e.g. "0x401000"). Default: "0". max_instructions: Maximum number of instructions to disassemble. 0 means unlimited.

Returns: Formatted disassembly output with address, bytes, mnemonic and operands.

Inputs: hex_code (required), arch, base_address, max_instructions. Returns: result

disassemble_raw_offsetA

Read raw bytes at a file offset and disassemble them.

Unlike disassemble_at_address, this uses a raw file offset instead of a virtual address.

Args: file_path: Absolute path to the file (any file, not limited to PE/ELF). offset: File offset as hex string (e.g. "0x400"). size: Number of bytes to read. Default: 256. arch: CPU architecture. Default: x86_64. base_address: Display base address for disassembly. Defaults to offset value. max_instructions: Maximum instructions to disassemble. Default: 50.

Returns: Disassembly output at the file offset.

Inputs: file_path (required), offset (required), size, arch, +2 more. Returns: result

extract_strings_from_fileA

Extract readable strings from a binary file (similar to the strings command).

Args: file_path: Absolute path to the file. min_length: Minimum string length. Default: 4. encoding: Encoding type: "ascii", "utf16le", or "both" (default). max_results: Maximum results to return. Default: 300.

Returns: List of extracted strings with offset and encoding info.

Inputs: file_path (required), min_length, encoding, max_results. Returns: result

find_rop_gadgets_hexA

Search for ROP gadgets (instruction sequences ending with ret) in hex-encoded machine code.

Used for ROP chain construction in CTF Pwn challenges.

Args: hex_code: Hex-encoded machine code bytes. arch: CPU architecture. Default: x86_64. base_address: Base address. Default: "0". max_gadget_len: Maximum number of instructions per gadget. Default: 5. max_results: Maximum number of results to return. Default: 100.

Returns: List of ROP gadgets with addresses and instruction sequences.

Inputs: hex_code (required), arch, base_address, max_gadget_len, +1 more. Returns: result

find_rop_gadgets_in_fileB

Search for ROP gadgets in a binary file's section.

Args: file_path: Absolute path to the binary file. section_name: Section name. Default: ".text". arch: CPU architecture. Auto-detected if omitted. max_gadget_len: Maximum instructions per gadget. Default: 5. max_results: Maximum results to return. Default: 100.

Returns: List of ROP gadgets found.

Inputs: file_path (required), section_name, arch, max_gadget_len, +1 more. Returns: result

find_xrefs_hexA

Find all cross-references to a target address in hex-encoded machine code.

Searches for call, jump, immediate value, and memory displacement references to the specified target address.

Args: hex_code: Hex-encoded machine code bytes. target_address: Target address to find references to (hex string, e.g. "0x401000"). arch: CPU architecture. Default: x86_64. base_address: Base address. Default: "0".

Returns: List of cross-references with source address, type, and instruction.

Inputs: hex_code (required), target_address (required), arch, base_address. Returns: result

find_xrefs_in_fileA

Find all cross-references to a target address in a binary file's section.

Scans the specified section for all instructions that reference the target address via call, jump, immediate operand, or memory displacement.

Args: file_path: Absolute path to the binary file. target_address: Target address to find references to (hex string, e.g. "0x401000"). section_name: Section to scan. Default: ".text". arch: CPU architecture. Auto-detected if omitted.

Returns: List of cross-references with source address, type, and instruction.

Inputs: file_path (required), target_address (required), section_name, arch. Returns: result

get_binary_infoA

Get detailed metadata of a binary file (PE/ELF/Mach-O).

Includes file format, architecture, entrypoint, section list, imports/exports, etc.

Args: file_path: Absolute path to the binary file.

Returns: File metadata in JSON format.

Inputs: file_path (required). Returns: result

hex_dump_fileA

View file contents as a formatted hex dump.

Args: file_path: Absolute path to the file. offset: Starting file offset as hex string. Default: "0". length: Number of bytes to display. Default: 256. Max: 4096.

Returns: Formatted hex dump with address, hex values, and ASCII display.

Inputs: file_path (required), offset, length. Returns: result

list_supported_architecturesA

List all supported CPU architectures.

Returns available architecture identifiers for the 'arch' parameter used by disassemble_hex, disassemble_file_section, etc.

Inputs: no named parameters. Returns: result

search_instructionsA

Search for instructions matching a specific pattern in disassembled code.

Filter by mnemonic name or instruction group (call/jump/ret/interrupt).

Args: hex_code: Hex-encoded machine code bytes. arch: CPU architecture. Default: x86_64. base_address: Base address. Default: "0". mnemonic: Mnemonic to search for (partial match), e.g. "mov", "call", "push". group: Instruction group to filter: call, jump, ret, interrupt.

Returns: List of matching instructions.

Inputs: hex_code (required), arch, base_address, mnemonic, +1 more. Returns: result

search_instructions_in_fileA

Search for instructions matching a pattern in a binary file's section.

Args: file_path: Absolute path to the binary file. section_name: Section name. Default: ".text". arch: CPU architecture. Auto-detected if omitted. mnemonic: Mnemonic to search for (partial match). group: Instruction group to filter: call, jump, ret, interrupt.

Returns: List of matching instructions.

Inputs: file_path (required), section_name, arch, mnemonic, +1 more. Returns: result

syscall_listA

List all system calls for a given platform.

Args: platform: Platform: x86, x86_64/x64, arm/arm32, arm64/aarch64. Default: x86_64.

Returns: Complete syscall table for the platform.

Inputs: platform. Returns: result

syscall_lookupA

Look up Linux system call information.

Supports lookup by number or name (partial match).

Args: query: Syscall number (e.g. "59") or name (e.g. "execve", supports partial match). platform: Platform: x86, x86_64/x64, arm/arm32, arm64/aarch64. Default: x86_64.

Returns: Matching syscall info including number, name, and arguments.

Inputs: query (required), platform. Returns: result

xor_brute_forceA

Brute-force single-byte XOR decryption, ranked by printable character ratio.

Commonly used in CTF to decrypt simple XOR-encrypted flags or strings.

Args: hex_data: Hex-encoded ciphertext data. min_printable_ratio: Minimum printable character ratio threshold. Default: 0.75.

Returns: Candidate decryption results sorted by printable ratio.

Inputs: hex_data (required), min_printable_ratio. Returns: result

xor_encode_decodeB

XOR encode/decode data with a specified key.

Args: hex_data: Hex-encoded data. hex_key: Hex-encoded key (supports multi-byte keys, applied cyclically).

Returns: XOR result as hex output with ASCII preview.

Inputs: hex_data (required), hex_key (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 25 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there are several disassembly variants (hex, address, entrypoint, section, raw offset) that could cause confusion despite clear descriptions. A minor overlap exists.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun snake_case pattern (e.g., disassemble_hex, check_security, find_xrefs_in_file). No mixing of conventions.

    Tool Count4/5

    25 tools is on the higher side but justified given the breadth of binary analysis (disassembly, ROP, crypto, security checks, etc.). Each tool has a clear role, so it's not excessive.

    Completeness4/5

    The set covers a wide range of static analysis tasks: disassembly, binary info, security, crypto, strings, ROP, xrefs, syscalls, XOR. Minor gaps like hex editing or patching are missing, but core workflows are well-covered.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      A multi-backend MCP server that exposes binary analysis capabilities from IDA Pro and Ghidra, allowing LLMs to directly drive reverse-engineering tools via natural language.
      11
      181
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      An enterprise-grade MCP server for AI-powered reverse engineering. Enables AI agents to perform comprehensive binary analysis through natural language commands.
      115 PyPI
      224
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server that provides disassembly and reverse engineering capabilities via the Capstone framework, supporting multiple architectures.
      19 PyPI
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server providing LLM clients with structured, transaction-safe access to Hopper-derived reverse-engineering snapshots, enabling binary analysis without the disassembler in the model's context window.
      3
      MIT