Skip to main content
Glama

MCPEmulate

This project was vibecoded.

An MCP server that exposes CPU emulation, disassembly, and assembly as tools for LLM agents. Built on Unicorn (emulation), Capstone (disassembly), Keystone (assembly), and LIEF (binary parsing).

Agents can create isolated emulation sessions, load code or full executables, set breakpoints, hook syscalls, step through instructions, inspect memory and registers, and diff execution traces -- all through the standard MCP tool interface.

Supported Architectures

Architecture

Emulation

Disassembly

Assembly

Syscall Hooking

x86 (32-bit)

Yes

Yes

Yes

int 0x80

x86-64

Yes

Yes

Yes

syscall

ARM (32-bit)

Yes

Yes

Yes

svc 0

AArch64

Yes

Yes

Yes

svc 0

MIPS32 (LE)

Yes

Yes

Yes

syscall

MIPS32 (BE)

Yes

Yes

Yes

syscall

RISC-V 32

Yes

Yes

No

ecall

RISC-V 64

Yes

Yes

No

ecall

RISC-V architectures lack a Keystone backend, so the assemble tool returns an error for them. Disassembly and emulation work normally.

Related MCP server: ghidraMCP

Install

Requires Python 3.10+.

# Run directly (no install needed)
uvx mcp-emulate

# Or install globally
uv pip install mcp-emulate

Usage

Claude Desktop / MCP Client

Add to your MCP client configuration:

{
  "mcpServers": {
    "mcp-emulate": {
      "command": "uvx",
      "args": ["mcp-emulate"]
    }
  }
}

CLI

# Default: stdio transport (for MCP clients)
mcp-emulate

# SSE transport (network, for web-based clients)
mcp-emulate --transport sse

# Streamable HTTP transport (newer MCP protocol)
mcp-emulate --transport streamable-http

Tools (41)

Session Management

Tool

Description

create_emulator

Create a new emulation session for a given architecture

destroy_emulator

Destroy a session and free resources

export_session

Export full session state (memory, registers, breakpoints, symbols) to JSON

import_session

Create a new session and restore state from a previous export

Memory

Tool

Description

map_memory

Map a memory region with specified permissions (r/w/x)

write_memory

Write hex or base64 data to memory

read_memory

Read memory as hex or base64

list_regions

List all mapped regions

hexdump

Formatted hex dump (up to 4KB) with ASCII sidebar

search_memory

Search for byte patterns across mapped memory

snapshot_memory

Capture all memory content under a named label

diff_memory

Compare two snapshots and return changed byte ranges

memory_map

/proc/self/maps-style layout with gaps and symbol annotations

Registers

Tool

Description

set_registers

Write one or more registers

get_registers

Read registers (specific or all)

get_stack

Read stack entries from SP, resolving values against symbols

Execution

Tool

Description

emulate

Run emulation with stop address, instruction count, or timeout

step

Execute a single instruction with full disassembly

add_breakpoint

Set a breakpoint, optionally with a register condition

remove_breakpoint

Remove a breakpoint

list_breakpoints

List all breakpoints with their conditions

save_context

Save a register snapshot under a label

restore_context

Restore registers from a saved snapshot

Breakpoint Conditions

Conditional breakpoints accept expressions like:

eax == 42
rax > 0x1000 and rcx != 0
r0 == 0 or r1 & 0xff

Supported operators: ==, !=, >, <, >=, <=, &. Connectives: and, or.

Syscall Hooking

Tool

Description

hook_syscall

Install a syscall hook (skip to log and continue, stop to halt)

unhook_syscall

Remove the syscall hook

get_syscall_log

Retrieve logged syscall invocations with pagination

Each logged entry includes the syscall number, argument register values, and PC. The hook is architecture-aware -- it intercepts int 0x80 on x86_32, syscall on x86_64, svc 0 on ARM/AArch64, syscall on MIPS, and ecall on RISC-V.

Watchpoints

Tool

Description

add_watchpoint

Watch a memory address for read, write, or both

remove_watchpoint

Remove a watchpoint

list_watchpoints

List all active watchpoints

Tracing

Tool

Description

enable_trace

Start recording executed instructions

disable_trace

Stop recording (log is preserved)

get_trace

Retrieve trace entries with disassembly and pagination

save_trace

Save the current trace log under a named label

diff_trace

Compare two saved traces instruction-by-instruction

Trace diff reports the common prefix length, the divergence point, and up to 50 differing entries with full disassembly.

Symbols

Tool

Description

add_symbol

Associate a name with an address

remove_symbol

Remove a symbol

list_symbols

List all symbols

Symbols are used to annotate stack entries, trace output, memory maps, and step results.

Loading

Tool

Description

load_binary

Load raw machine code at an address, auto-mapping memory

load_executable

Load an ELF, PE, or Mach-O binary with correct segment permissions, entry point, and symbols

assemble

Assemble instructions to machine code (standalone, no session)

disassemble

Disassemble machine code to instructions (standalone, no session)

load_executable uses LIEF for format detection. It maps each loadable segment with the correct permissions, sets PC to the entry point, and registers exported symbols automatically.

Example Workflow

A typical agent interaction:

  1. create_emulator(arch="x86_64") -- start a session

  2. assemble(arch="x86_64", code="mov rax, 60; syscall") -- assemble exit syscall

  3. load_binary(session_id=..., data=..., address=0x1000, entry_point=0x1000) -- load code

  4. hook_syscall(session_id=..., mode="stop") -- intercept syscalls

  5. enable_trace(session_id=...) -- start recording

  6. emulate(session_id=..., address=0x1000, count=100) -- run

  7. get_trace(session_id=...) -- inspect what executed

  8. get_syscall_log(session_id=...) -- see what syscalls were attempted

  9. export_session(session_id=...) -- save state for later

Architecture

src/mcp_emulate/
  architectures.py   Architecture configs, register maps, syscall conventions
  session.py         EmulationSession (Unicorn wrapper), SessionManager
  server.py          41 MCP tool handlers via FastMCP

tests/
  test_emulate.py              132 pytest unit tests
  test_server_integration.py   112 checks over JSON-RPC (23 phases)

Key Design Decisions

  • EmulationSession uses __slots__ for memory efficiency and to catch typos. Every new attribute must be declared.

  • Breakpoints are dict[int, str | None] (address to optional condition), not a set. This supports conditional breakpoints while keeping the same lookup semantics.

  • Syscall conventions are data, not code. A frozen dataclass per architecture describes the hook type, interrupt number filter, register names for nr/args/return. The hooking logic is generic.

  • ks_arch/ks_mode are Optional on ArchConfig so architectures without Keystone (RISC-V) can exist without a dummy value. The assemble tool checks this and returns a clear error.

  • load_executable writes via uc.mem_write() directly, bypassing the permission check on write_memory. This is intentional -- binary loaders need to populate read-only segments.

  • Session serialization is versioned ("version": 1) for forward compatibility.

Development

git clone https://github.com/LabGuy94/MCPEmulate.git
cd MCPEmulate
uv venv .venv
uv pip install -e ".[dev]"

Tests

# Unit tests (132 tests, ~1s)
uv run pytest tests/test_emulate.py -v

# Integration tests (112 checks over JSON-RPC subprocess, ~30s)
uv run python tests/test_server_integration.py

# Both
uv run pytest tests/ -v && uv run python tests/test_server_integration.py

Dependencies

Package

Purpose

mcp >= 1.18.0

MCP protocol / FastMCP server framework

unicorn >= 2.0.0

CPU emulation engine

capstone >= 5.0.0

Disassembly engine

keystone-engine >= 0.9.2

Assembly engine

lief >= 0.14.0

ELF/PE/Mach-O binary parsing

License

GPL-2.0-only

Available Tools

41 tools
add_breakpointA

Add a breakpoint at the given address.

Idempotent — adding the same address twice is a no-op.

Args: session_id: The session ID. address: The address to break at. condition: Optional condition expression (e.g. "eax == 42", "rax > 0x1000 and rcx != 0").

Inputs: session_id (required), address (required), condition.

add_symbolA

Associate a symbolic name with a memory address.

Overwrites if the name already exists.

Args: session_id: The session ID. name: Symbol name. address: Memory address.

Inputs: session_id (required), name (required), address (required).

add_watchpointA

Add a memory watchpoint.

Idempotent -- same address replaces the existing watchpoint.

Args: session_id: The session ID. address: Memory address to watch. size: Number of bytes to watch (default 1). access: Access type -- "r" (read), "w" (write), or "rw" (both). Default "w".

Inputs: session_id (required), address (required), size, access.

assembleB

Assemble instructions into machine code using Keystone.

Args: arch: Architecture name (x86_32, x86_64, arm, arm64). code: Assembly source code (e.g. "mov eax, 42; ret"). address: Base address for assembly (affects relative offsets). Default 0.

Inputs: arch (required), code (required), address.

create_emulatorA

Create a new CPU emulation session.

Args: arch: Architecture name. One of: x86_32, x86_64, arm, arm64.

Returns a dict with session_id and arch.

Inputs: arch (required).

destroy_emulatorB

Destroy an emulation session and free its resources.

Args: session_id: The session ID returned by create_emulator.

Inputs: session_id (required).

diff_memoryB

Compare two memory snapshots and return changed byte ranges.

Args: session_id: The session ID. label_a: First snapshot label. label_b: Second snapshot label.

Inputs: session_id (required), label_a (required), label_b (required).

diff_traceB

Compare two saved traces instruction-by-instruction.

Returns the common prefix length, divergence point, and up to 50 differing entries.

Args: session_id: The session ID. label_a: First trace label. label_b: Second trace label.

Inputs: session_id (required), label_a (required), label_b (required).

disable_traceB

Disable execution tracing.

The trace log is preserved for inspection via get_trace.

Args: session_id: The session ID.

Inputs: session_id (required).

disassembleA

Disassemble machine code into instructions using Capstone.

Args: arch: Architecture name (x86_32, x86_64, arm, arm64). data: Machine code as hex string or base64. address: Base address for disassembly. Default 0. encoding: "hex" (default) or "base64". count: Max instructions to disassemble. 0 = all.

Inputs: arch (required), data (required), address, encoding, +1 more.

emulateA

Run CPU emulation.

Must provide stop_address, count, or both to bound execution.

Args: session_id: The session ID. address: Address to begin execution. stop_address: Address to stop at (exclusive). count: Maximum instructions to execute (capped at 100,000). timeout_ms: Timeout in milliseconds (capped at 60,000).

Inputs: session_id (required), address (required), stop_address, count, +1 more.

enable_traceB

Enable execution tracing.

Clears any existing trace log and starts recording.

Args: session_id: The session ID. max_entries: Maximum trace entries to record (default 10000).

Inputs: session_id (required), max_entries.

export_sessionB

Export full session state (memory, registers, breakpoints, symbols) to JSON.

Args: session_id: The session ID.

Inputs: session_id (required).

get_registersB

Read one or more registers.

Args: session_id: The session ID. names: List of register names. Omit or pass null for all registers.

Inputs: session_id (required), names.

get_stackB

Read stack entries from the current stack pointer.

Resolves values against registered symbols.

Args: session_id: The session ID. count: Number of stack entries to read (default 16, max 256).

Inputs: session_id (required), count.

get_syscall_logB

Get recorded syscall invocations with pagination.

Args: session_id: The session ID. offset: Start index (default 0). limit: Max entries to return (default 100).

Inputs: session_id (required), offset, limit.

get_traceC

Get trace entries with pagination.

Each entry includes disassembled instruction details.

Args: session_id: The session ID. offset: Start index (default 0). limit: Max entries to return (default 100).

Inputs: session_id (required), offset, limit.

hexdumpA

Formatted hex dump of memory.

Standard format: ADDR | 16 hex bytes (8+8) | ASCII. Max 4096 bytes.

Args: session_id: The session ID. address: Start address. size: Number of bytes to dump (default 256, max 4096).

Inputs: session_id (required), address (required), size.

hook_syscallA

Install a syscall hook to intercept system calls.

Modes: skip: Log the syscall and return default_return (continue execution). stop: Log the syscall and stop emulation.

Idempotent — replaces existing hook.

Args: session_id: The session ID. mode: Hook mode — "skip" (default) or "stop". default_return: Return value for skip mode (default 0).

Inputs: session_id (required), mode, default_return.

import_sessionA

Import session state into a new session.

Creates a new session for the given architecture and restores state from export.

Args: arch: Architecture name (must match the exported state's arch). state: The state dict from export_session.

Inputs: arch (required), state (required).

list_breakpointsC

List all breakpoints in the session.

Args: session_id: The session ID.

Inputs: session_id (required).

list_regionsC

List all mapped memory regions.

Args: session_id: The session ID.

Inputs: session_id (required).

list_symbolsC

List all symbols.

Args: session_id: The session ID.

Inputs: session_id (required).

list_watchpointsC

List all memory watchpoints.

Args: session_id: The session ID.

Inputs: session_id (required).

load_binaryA

Load binary data into the emulator.

Auto-maps memory, writes data, and optionally sets the program counter.

Args: session_id: The session ID. data: Binary data as hex string or base64. address: Destination address. entry_point: Optional address to set the PC to. encoding: "hex" (default) or "base64".

Inputs: session_id (required), data (required), address (required), entry_point, +1 more.

load_executableA

Load an executable binary (ELF, PE, or Mach-O) into the emulator.

Auto-detects format. Maps segments with correct permissions, sets PC to entry point, registers symbols.

Args: session_id: The session ID. data: Binary data as hex string or base64. base_address: Optional base address offset. Default 0. encoding: "hex" (default) or "base64".

Inputs: session_id (required), data (required), base_address, encoding.

map_memoryB

Map a memory region in the emulator.

Size is rounded up to 4KB page alignment.

Args: session_id: The session ID. address: Start address (must be page-aligned, i.e. multiple of 0x1000). size: Region size in bytes. perms: Permission string combining 'r', 'w', 'x'. Default "rwx".

Inputs: session_id (required), address (required), size (required), perms.

memory_mapC

Produce a /proc/self/maps-style layout of the address space.

Shows regions with permissions, gaps, and symbol annotations.

Args: session_id: The session ID.

Inputs: session_id (required).

read_memoryC

Read data from emulator memory.

Args: session_id: The session ID. address: Source address. size: Number of bytes to read. encoding: "hex" (default) or "base64".

Inputs: session_id (required), address (required), size (required), encoding.

remove_breakpointC

Remove a breakpoint.

Args: session_id: The session ID. address: The breakpoint address to remove.

Inputs: session_id (required), address (required).

remove_symbolC

Remove a symbol.

Args: session_id: The session ID. name: The symbol name to remove.

Inputs: session_id (required), name (required).

remove_watchpointB

Remove a memory watchpoint.

Args: session_id: The session ID. address: The watchpoint address to remove.

Inputs: session_id (required), address (required).

restore_contextC

Restore registers from a previously saved snapshot.

Args: session_id: The session ID. label: The snapshot label to restore.

Inputs: session_id (required), label (required).

save_contextB

Save a register snapshot under a label.

Overwrites if the label already exists.

Args: session_id: The session ID. label: A name for this snapshot.

Inputs: session_id (required), label (required).

save_traceB

Save the current trace log under a label.

Overwrites if the label already exists.

Args: session_id: The session ID. label: A name for this saved trace.

Inputs: session_id (required), label (required).

search_memoryB

Search for a byte pattern in memory.

If address is None, searches all mapped regions.

Args: session_id: The session ID. pattern: Hex string of bytes to search for (e.g. "deadbeef"). address: Optional start address to limit search. size: Optional size of search range (required if address is set). max_results: Maximum matches to return (default 100).

Inputs: session_id (required), pattern (required), address, size, +1 more.

set_registersC

Write one or more registers.

Args: session_id: The session ID. values: Dict mapping register names to integer values.

Inputs: session_id (required), values (required).

snapshot_memoryB

Save a snapshot of all mapped memory under a label.

Overwrites if the label already exists.

Args: session_id: The session ID. label: A name for this memory snapshot.

Inputs: session_id (required), label (required).

stepC

Execute a single instruction.

If address is omitted, execution starts at the current program counter.

Args: session_id: The session ID. address: Optional start address. Defaults to current PC.

Inputs: session_id (required), address.

unhook_syscallC

Remove the syscall hook.

Args: session_id: The session ID.

Inputs: session_id (required).

write_memoryC

Write data to emulator memory.

Args: session_id: The session ID. address: Destination address. data: Data as hex string (e.g. "90c3") or base64. encoding: "hex" (default) or "base64".

Inputs: session_id (required), address (required), data (required), encoding.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 41 tools

    Disambiguation4/5

    Most tools have distinct purposes, but some overlap exists: 'hexdump' and 'read_memory' both retrieve memory data, and 'list_breakpoints'/'list_watchpoints'/'list_symbols' are similar listing operations. Descriptions help clarify differences, but an agent might occasionally misselect between closely related tools.

    Naming Consistency5/5

    Tool names follow a highly consistent verb_noun pattern throughout (e.g., 'add_breakpoint', 'create_emulator', 'get_registers'). All names use snake_case with clear, descriptive verbs, making the set predictable and easy to navigate.

    Tool Count2/5

    With 41 tools, the count is excessive for a CPU emulation server. While the domain is complex, many tools could be consolidated (e.g., multiple listing tools) or omitted without losing core functionality, leading to potential confusion and inefficiency for agents.

    Completeness5/5

    The toolset provides comprehensive coverage for CPU emulation, including session management, memory operations, debugging (breakpoints/watchpoints), tracing, syscall handling, and state import/export. All essential CRUD and lifecycle operations are present, with no obvious gaps in the domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that allows LLMs to autonomously reverse engineer applications by exposing Ghidra's functionality, including decompiling binaries, analyzing code, and renaming methods and data.
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      An Model Context Protocol server that enables LLMs to autonomously reverse engineer applications by exposing Ghidra's decompilation and analysis tools. It allows AI agents to list code structures, rename methods, and analyze binaries directly through MCP-compatible clients.
      Apache 2.0
    • 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
      B
      quality
      D
      maintenance
      A lightweight MCP server that enables LLM agents to interact with GDB for debugging native programs, supporting spawning sessions, executing commands, interrupting hangs, and closing sessions.
      4
      10 npm
      MIT