---
title: Use Ghidra or IDA with an AI Agent — REA
url: https://rea.tools/guides/ghidra-ida-ai-agent/
---

[Home](https://rea.tools/) / [Guides](https://rea.tools/guides/) / Ghidra and IDA
with AI

# Use Ghidra or IDA with an AI agent.

REA connects your coding agent to the disassembler you already use.
Ask about a function in plain words; the agent decompiles it and
follows the calls and references around it.

## What your agent can do

Through REA, an agent such as Claude Code, Codex or Cursor can use
Ghidra or IDA to:

- list functions and strings in an executable or library;
- decompile a function and read its assembly;
- follow the functions it calls and the cross-references to an
  address.

Ghidra can also find a function's callers and read the bytes
behind an address, such as a numeric constant. IDA can't list a
function's direct callers; ask for cross-references to the
function instead.

The same tools work with Ghidra, IDA and Hopper. Results keep the
target's identity and state what is still unknown, including
anything the chosen engine can't answer, which makes the agent's
explanation easier to check.

## What stays untouched

- **Ghidra:** REA imports the target into a temporary
  Ghidra project. The executable's bytes are never changed, and
  REA does not control the Ghidra window.
- **IDA:** analysis is read-only. When REA works with
  a database already open in IDA, it never saves or closes it.

REA works with your existing installations. It does not install,
upgrade or license Ghidra or IDA.

## Set up Ghidra

Ghidra is free. REA supports Ghidra 12.2 or newer with a 64-bit
JDK 25 or newer on Linux and macOS, with experimental support on
Windows x64. Point REA at your installation, then run setup:

Terminal · macOS or Linux

```
export GHIDRA_INSTALL_DIR=/absolute/path/to/ghidra_12.2_PUBLIC
export JAVA_HOME=/absolute/path/to/jdk-25
npx rea-agents@latest setup
```

Setup shows its planned changes before writing anything. The
[Ghidra setup reference](https://github.com/morluto/rea/blob/main/docs/getting-started/installation.md#ghidra)
covers Windows, native decompiler requirements and resource
limits.

## Set up IDA

REA works through an IDA MCP server you install yourself. Choose
one way to connect:

- **A database already open in IDA:** the
  [ida-free-mcp](https://github.com/0xshlomil/ida-free-mcp)
  plugin, for IDA Pro and IDA Free. Its 1.1.2 release accepts
  connections from other computers on your network. Before you
  start it, block those with your firewall or use a build that
  only listens on your own computer.
- **Headless IDA Pro:**
  [ida-pro-mcp](https://github.com/mrexodia/ida-pro-mcp)
  or the official
  [Hex-Rays IDA MCP](https://github.com/HexRaysSA/ida-mcp).

Describe that server in a small JSON file, then tell REA to use
it. The
[IDA provider guide](https://github.com/morluto/rea/blob/main/docs/providers/ida-provider.md)
shows the file for each option.

Terminal · select IDA

```
export REA_IDA_MCP_CONFIG=/absolute/path/to/ida-mcp.json
export REA_ANALYSIS_PROVIDER=ida
npx rea-agents@latest setup
```

## Ask a question

Restart your agent after setup, then give it the full path to the
program and one question about a feature:

> Use REA to find how this program reads its settings file. Show
> the functions involved and explain what each one does.

Ask for addresses and decompiled code with each answer, and follow
up on anything it marks as unknown. You can also query one
function from the terminal:

Terminal · one function

```
npx -y rea-agents@latest function /absolute/path/to/program main \
  --provider ghidra --json
```

If you set up IDA, replace `--provider ghidra` with
`--provider ida`.

- [Follow a full native investigation](https://rea.tools/guides/native/)Recover a sound calculation from a 1996 Windows game.
- [Solve a CTF flag checker](https://rea.tools/showcase/ctf/)Turn a binary's checks into equations.
- [Reverse engineering with AI](https://rea.tools/guides/reverse-engineering-with-ai/)How to check what an AI agent tells you.
