MCP Hub
Back to servers

Aragorn

A direct kernel debugger MCP server for Windows security research that connects to VM kernels via kdnet using DbgEng COM interfaces. It exposes over 60 tools for memory inspection, breakpoint management, and coordinated execution control between the host and target VM.

glama
Updated
Mar 19, 2026

Aragorn

Direct kernel debugger MCP server for Windows security research. Connects to Windows VM kernels via kdnet and exposes 63 tools over the Model Context Protocol.

This process is the debugger. It spawns kd.exe as a subprocess for kdnet transport, then connects via DebugConnect() for full DbgEng COM access. No WinDbg GUI required.

MCP Client ──stdio/http──► Aragorn ──DebugConnect(TCP)──► kd.exe ──kdnet──► VM kernel

Quick Start

# 1. Install dependencies
pip install -r requirements.txt

# 2. Copy DbgEng DLLs from WinDbg Preview into dbgeng_bin/
#    (dbgeng.dll, dbghelp.dll, dbgmodel.dll, dbgcore.dll, symsrv.dll, srcsrv.dll)

# 3. Configure
cp .env.example .env
# Edit .env: set KD_CONNECTION, KD_EXE_PATH, etc.

# 4. Run (stdio mode — for MCP clients like Claude Code)
python server.py

# Or HTTP mode (for remote/shared access)
python server.py --http

.mcp.json integration

{
  "aragorn": {
    "type": "stdio",
    "command": "python",
    "args": ["path/to/Aragorn/server.py"]
  }
}

Configuration

All settings are via environment variables (or .env file):

VariableDefaultDescription
KD_CONNECTIONnet:port=55555,key=...,target=...kdnet connection string
KD_EXE_PATHWinDbg Preview's kd.exePath to kd.exe
KD_SERVER_PORT14500Local TCP port for kd.exe debug server
DBGENG_PATH./dbgeng_bin/dbgeng.dllPath to DbgEng DLL
SYMBOL_PATHMicrosoft symbol serverSymbol search path
ARAGORN_HOST127.0.0.1HTTP mode bind address
ARAGORN_PORT14401HTTP mode port
VM_AGENT_URLhttp://YOUR_VM_IP:8080VM agent URL (for workflow tools)
VM_AGENT_API_KEY(empty)VM agent API key

DbgEng Binaries

The dbgeng_bin/ directory is gitignored. Copy these DLLs from your WinDbg Preview installation:

C:\Program Files\WindowsApps\Microsoft.WinDbg_*\amd64\
  ├── dbgeng.dll
  ├── dbghelp.dll
  ├── dbgmodel.dll
  ├── dbgcore.dll
  ├── symsrv.dll
  └── srcsrv.dll

VM Agent

The vm_agent/ directory contains a lightweight Flask server that runs inside the target VM. It exposes process execution, file I/O, and driver service management over HTTP. Aragorn's workflow tools (breakpoint_and_run, vm_exec, etc.) use it to coordinate kernel debugging with VM-side actions.

# On the VM:
cd vm_agent
pip install -r requirements.txt
cp .env.example .env
# Edit .env: set VM_AGENT_API_KEY
python server.py

The VM agent is optional — all pure debugger tools work without it. You only need it for the coordinated workflow tools.

Tools

Session & Connection (9)

ToolDescription
connectConnect to kernel debugger via kd.exe
disconnectCleanly disconnect
statusGet connection state and config
target_infoGet debug target info (class, processors, page size)
ensure_readyBreak in, verify context, reload symbols (retries 5x)
health_checkLightweight probe without breaking into target
reconnect_debuggerForce full reconnect
test_kd_connectionDiagnostic kd.exe connection test
get_debugger_stateFull tracked state for cross-agent coordination

Multi-Session (6)

ToolDescription
session_createCreate isolated debugger session for a VM
session_connectConnect a session's debugger
session_disconnectDisconnect without destroying
session_destroyDestroy and clean up a session
session_listList all sessions with status
session_set_activeSet active session for tool routing

Command Execution (3)

ToolDescription
executeExecute raw debugger command (e.g., lm, !process 0 0)
execute_batchExecute multiple commands sequentially
evaluateEvaluate expression, return numeric value

Memory (7)

ToolDescription
read_memoryRead virtual memory (hex/qwords/dwords/ascii)
write_memoryWrite bytes to virtual memory
search_memorySearch for byte pattern
read_physicalRead physical memory
write_physicalWrite to physical memory
virtual_to_physicalTranslate virtual to physical address
read_msrRead Model-Specific Register

Registers (2)

ToolDescription
read_registersRead all general-purpose registers
write_registerWrite a register value

Stack (1)

ToolDescription
get_stackGet structured stack trace with symbols

Breakpoints (4)

ToolDescription
set_breakpointSet code or data/hardware breakpoint
remove_breakpointRemove breakpoint by ID
list_breakpointsList all breakpoints with status
set_exception_filterConfigure exception handling (break/ignore/output)

Execution Control (4)

ToolDescription
continue_execResume execution (robust, retries to drain kdnet breaks)
step_intoSingle-step into calls
step_overSingle-step over calls
break_inInterrupt target execution

Inspection (4)

ToolDescription
list_modulesList loaded modules with base/size/name
list_threadsList threads with engine/system IDs
list_processesList processes with engine/system IDs
switch_processSwitch to process context (.process /i)

Symbols (4)

ToolDescription
resolve_symbolBidirectional symbol/address resolution
get_field_offsetGet struct field byte offset
get_type_sizeGet type size in bytes
disassembleDisassemble instructions at address

Events (3)

ToolDescription
wait_for_eventBlock until next debug event
poll_eventsReturn queued events without blocking
clear_eventsDiscard all queued events

Kernel Objects (8)

ToolDescription
read_structRead typed structure (dt equivalent)
get_pteGet page table entry info
pool_infoGet pool allocation metadata
get_driver_objectDisplay driver object + dispatch table
get_device_objectsDisplay device object info
get_object_infoDisplay kernel object from object directory
dump_ssdtDump System Service Descriptor Table
get_idtDump Interrupt Descriptor Table

Workflow (8)

ToolDescription
breakpoint_and_runAtomic: set BP, resume, run VM command, wait for hit, capture state
run_and_traceSet logging BPs at multiple addresses, run command, capture trace
inspect_at_breakpointBatch post-breakpoint inspection commands
vm_execExecute command on VM
vm_read_fileRead file from VM
vm_write_fileWrite file to VM
vm_upload_fileUpload file from host to VM
vm_statusCheck VM reachability

Architecture

Aragorn/
├── server.py          # FastMCP entry point, registers all tool modules
├── config.py          # Environment variable configuration
├── debugger.py        # High-level Debugger class (lifecycle, commands, reconnect)
├── dbgeng.py          # Pure ctypes COM interface definitions (6 interfaces)
├── callbacks.py       # IDebugOutputCallbacks + IDebugEventCallbacks
├── sessions.py        # Multi-session registry (parallel VM debugging)
├── vm_client.py       # Async HTTP client to VM agent
├── dbgeng_bin/        # DbgEng DLLs (gitignored, ~15MB)
├── vm_agent/          # REST server for target VM (Flask + psutil)
│   ├── server.py      # VM agent HTTP server
│   ├── requirements.txt
│   └── .env.example
└── tools/             # MCP tool modules (one per domain)
    ├── core.py        # execute, execute_batch, evaluate
    ├── session.py     # connect, disconnect, status, ensure_ready
    ├── multi_session.py  # session_create/connect/destroy/list
    ├── memory.py      # read/write virtual + physical memory, MSR
    ├── registers.py   # read/write registers
    ├── stack.py       # get_stack
    ├── breakpoints.py # set/remove/list breakpoints, exception filters
    ├── execution.py   # continue, step_into, step_over, break_in
    ├── inspection.py  # list modules/threads/processes, switch context
    ├── symbols.py     # resolve symbols, field offsets, disassemble
    ├── events.py      # wait/poll/clear debug events
    ├── kernel.py      # read_struct, PTE, pool, driver/device objects, SSDT, IDT
    └── workflow.py    # breakpoint_and_run, run_and_trace, VM proxy tools

COM Interface Stack

Aragorn wraps six DbgEng COM interfaces via ctypes (no C++ extension needed):

  • IDebugClient — Session lifecycle, callback registration
  • IDebugControl — Command execution, breakpoints, execution status
  • IDebugDataSpaces2 — Virtual/physical memory, address translation
  • IDebugRegisters — Register read/write
  • IDebugSymbols2 — Symbol resolution, type info, disassembly
  • IDebugSystemObjects — Process/thread/module enumeration

All blocking COM operations are wrapped in asyncio.to_thread() for MCP stdio compatibility. Each session gets a dedicated COM thread (DbgEng has thread affinity).

License

WTFPL

Reviews

No reviews yet

Sign in to write a review