Skip to main content
Glama

re-code-mode

A layered reverse-engineering toolbox for AI agents, served through UTCP Code Mode so that big outputs are filtered inside a sandbox instead of flooding your model's context window.

Disassembling a binary, listing imports or dumping strings can easily produce tens of thousands of lines. Classic MCP tool-calling pushes all of that into the model. With Code Mode the agent writes a few lines of TypeScript, the filtering happens locally, and only the answer comes back.

// one round-trip: triage + capability filter + selective strings
const t = await re.re_triage_binary({ path: "/samples/app" });
const imps = await re.re_imports_exports({ path: "/samples/app", filter: "socket|ssl|crypt", kind: "imports" });
const urls = await re.re_extract_strings({ path: "/samples/app", preset: "urls", limit: 10 });
return { arch: t.binary_info.arch, hardening: t.binary_info.security,
         net_imports: imps.imports.map(i => i.name), urls: urls.strings.map(s => s.string) };

Responsible use. This project is for analysing software you own or are authorised to analyse: security research, malware triage, interoperability, CTFs, education. See DISCLAIMER and SECURITY.md.

Architecture

flowchart LR
  A[AI agent] -->|TypeScript| B[UTCP Code Mode sandbox]
  B -->|MCP stdio| C[re-code-mode server]
  C --> L1[Layer 1: local engines<br/>radare2 · rabin2 · binwalk · upx · unzip]
  C --> L2[Layer 2: catalog<br/>300+ community tools, clone on demand]
  C --> L3[Layer 3: playbooks and agent skills]
  C -.optional.-> R[REA engine<br/>200+ tools]

Layer

What it gives you

1 – Engines

triage_binary, imports_exports, extract_strings, list_functions, disassemble_function, apk_inspect, firmware_scan — all filtering happens server-side/in the sandbox.

2 – Catalog

catalog_search, catalog_categories, fetch_tool: a searchable index built from two public awesome lists, plus shallow clone of any entry on demand.

3 – Playbooks & skills

get_playbook (per target type), skill_list / skill_read over community agent skills you clone locally.

Inside Code Mode every tool is prefixed with the manual name, so triage_binary is called as re.re_triage_binary(...).

Related MCP server: Antardrishti

Requirements

  • Node.js ≥ 18, Python 3, git

  • radare2 (provides r2/rabin2), binwalk, upx, unzip, file

  • Optional: jadx, apktool, gdb, frida

Quick start

git clone https://github.com/sosiman/re-code-mode.git
cd re-code-mode
bash scripts/setup.sh --install-system-deps   # Debian/Ubuntu; on macOS: brew install radare2 binwalk upx
# optional extras
bash scripts/setup.sh --with-skills           # clone third-party agent skills into ./skills-repos
bash scripts/setup.sh --with-rea              # install the optional REA engine
npm test                                      # smoke + security regression tests

bin/re-run.sh list
bin/re-run.sh triage ./some-binary

setup.sh writes machine-local .utcp_config.json (git-ignored). If your npm blocks install scripts, approve isolated-vm (the V8 sandbox used by Code Mode) with npm install-scripts approve.

CLI cheat-sheet (bin/re-run.sh)

bin/re-run.sh catalog "ghidra" 5          # search the tool catalog
bin/re-run.sh playbook android_apk        # methodology for a target type
bin/re-run.sh triage   ./bin              # arch, hardening, libs, SHA-256 (<1s)
bin/re-run.sh imports  ./bin "socket|ssl" # filtered imports/exports
bin/re-run.sh strings  ./bin "https?://"  # filtered strings
bin/re-run.sh funcs    ./bin "main|auth"  # functions (radare2 analysis)
bin/re-run.sh decompile ./bin main        # pdf + pdc for one function
bin/re-run.sh apk      ./app.apk apis     # framework fingerprint + endpoints from DEX
bin/re-run.sh firmware ./fw.bin           # embedded files + UPX check
bin/re-run.sh fetch    radareorg/radare2-mcp   # shallow clone into ./tools-cache
bin/re-run.sh skills android; bin/re-run.sh skill-read leanrea
bin/re-run.sh run 'return await re.re_catalog_categories({});'

All arguments are JSON-encoded before being placed in the generated TypeScript, so file names and patterns cannot inject code.

Use it from an agent

Copy skills/re-code-mode into your agent's skills directory (Claude Code, Gemini CLI, Codex, Hermes, … — anything that reads SKILL.md) and set RE_CODE_MODE_HOME to this checkout. The skill teaches the agent the workflow and the Code Mode idioms.

Configuration (environment variables)

Variable

Effect

RE_CODE_MODE_HOME

Override the project root (default: auto-detected).

RE_ALLOWED_DIRS

:-separated allow-list; analysed files must live under these directories.

RE_ENABLE_REA_EXEC=1

Expose the free-form rea_exec tool (off by default — REA can drive debuggers and devices).

RE_KEEP_ALL_SKILLS=1

Keep the offensive-security modules when cloning reverse-skill.

Security notes (short version)

  • Run it locally for a user you trust; it is not a multi-tenant service.

  • Analysing hostile samples with any disassembler is risky — use a VM/container.

  • radare2 command injection, option injection in git clone, code injection through shell arguments and ReDoS are covered by tests in test/smoke.mjs.

Full details and reporting instructions: SECURITY.md.

Third-party material

Nothing from the projects below is redistributed here. They are fetched on your machine, under their licences:

Contributing

See CONTRIBUTING.md. New engines, playbooks and fixes are welcome.

Disclaimer

This software is provided for lawful, authorised security research, education and interoperability work. You are solely responsible for complying with applicable laws, licences and terms of service. The authors accept no liability for misuse. Do not use it to analyse systems or software you are not permitted to analyse.

License

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A headless Ghidra server that enables AI agents to perform deep reverse-engineering tasks such as disassembly, decompilation, and patching via the Model Context Protocol. It supports extensive automation of analysis workflows in sandboxed environments through a catalog of over 200 specialized tools.
      196
      GPL 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to locally analyze and reverse engineer binaries through a compact 12-tool MCP interface for triage, function discovery, disassembly/decompilation, cross-references, strings/imports, call graphs, memory reads, annotations, and binary diffs.
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to run read-only static reverse-engineering tasks — binary triage, symbol and import inventory, per-function decompilation, and Android native-lib analysis — with untrusted samples confined to a no-network bubblewrap chamber that never executes the target.
      7
      MIT
    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables AI agents to inspect and reverse engineer local software targets, including binaries, JavaScript/Electron apps, .NET assemblies, and websites, returning evidence-backed findings for understanding and building similar features.
      388,706 npm
      MIT