# tawaraashish/rea-revers architecture

> Architecture diagram of the GitHub repository tawaraashish/rea-revers, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tawaraashish/rea-revers
- Repository: https://github.com/tawaraashish/rea-revers

## Overview

REA is a local reverse-engineering MCP server and CLI. The principal workflow is an agent or terminal user requests an investigation; REA dispatches analysis, returns evidence and limitations, and supports follow-up questions. The sampled code confirms the CLI-to-service path and the service’s process-management and evidence/error boundaries. README capabilities include native, JavaScript/Electron, .NET, and website analysis; provider and browser subsystems are shown where supported by the tree, but their internal wiring was not sampled.

Main entry points: [`src/application/reverse/ReverseEngineeringService.ts`](https://github.com/tawaraashish/rea-revers/blob/main/src/application/reverse/ReverseEngineeringService.ts) (Reverse analysis), [`src/main.ts`](https://github.com/tawaraashish/rea-revers/blob/main/src/main.ts) (MCP server), [`src/server/registerReverseEngineeringTools.ts`](https://github.com/tawaraashish/rea-revers/blob/main/src/server/registerReverseEngineeringTools.ts) (MCP analysis tools), [`src/cli/reverseEngineeringCommands.ts`](https://github.com/tawaraashish/rea-revers/blob/main/src/cli/reverseEngineeringCommands.ts) (CLI commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_mcp["MCP server<br/>[main.ts]"]
  node_mcp_tools["MCP analysis tools"]
  node_cli["CLI commands"]
  node_setup["Agent setup<br/>[Setup.ts]"]
end

subgraph group_workflow["Analysis workflow"]
  node_reverse_service["Reverse analysis"]
  node_provider_process["Provider processes<br/>[ProviderProcess.ts]"]
  node_contracts["Tool contracts"]
end

subgraph group_providers["Analysis engines"]
  node_ghidra["Ghidra<br/>[GhidraClient.ts]"]
  node_hopper["Hopper<br/>[HopperClient.ts]"]
  node_ida["IDA"]
  node_debuggers["Debug sessions"]
  node_rizin["Rizin sessions"]
  node_javascript["JavaScript analysis"]
  node_browser["Browser observations"]
end

subgraph group_results["Evidence and results"]
  node_evidence["Evidence records<br/>[evidence.ts]"]
  node_result["Result type<br/>[result.ts]"]
  node_errors["Analysis errors"]
  node_error_projection["Error projection"]
end

node_agent(("Agent"))
node_terminal(("Terminal user"))

node_agent -->|"asks through MCP"| node_mcp
node_terminal -->|"runs commands"| node_cli
node_cli -->|"calls"| node_reverse_service
node_mcp_tools -->|"calls"| node_reverse_service
node_reverse_service -->|"manages processes"| node_provider_process
node_reverse_service -.->|"returns evidence"| node_evidence
node_reverse_service -->|"uses results"| node_result
node_reverse_service -->|"reports failures"| node_errors
node_mcp_tools -.->|"uses contracts"| node_contracts
node_errors -->|"projects errors"| node_error_projection
node_setup -->|"registers REA"| node_agent
node_agent -->|"receives findings"| node_evidence
node_reverse_service -.->|"dispatches analysis"| node_ghidra
node_reverse_service -.->|"dispatches analysis"| node_hopper
node_reverse_service -.->|"dispatches analysis"| node_ida
node_reverse_service -.->|"dispatches sessions"| node_debuggers
node_reverse_service -.->|"dispatches sessions"| node_rizin
node_mcp -.->|"offers analysis"| node_javascript
node_mcp -.->|"offers observations"| node_browser

click node_mcp "https://github.com/tawaraashish/rea-revers/blob/main/src/main.ts"
click node_mcp_tools "https://github.com/tawaraashish/rea-revers/blob/main/src/server/registerReverseEngineeringTools.ts"
click node_cli "https://github.com/tawaraashish/rea-revers/blob/main/src/cli/reverseEngineeringCommands.ts"
click node_reverse_service "https://github.com/tawaraashish/rea-revers/blob/main/src/application/reverse/ReverseEngineeringService.ts"
click node_provider_process "https://github.com/tawaraashish/rea-revers/blob/main/src/process/ProviderProcess.ts"
click node_contracts "https://github.com/tawaraashish/rea-revers/blob/main/src/contracts/reverseEngineeringToolContracts.ts"
click node_ghidra "https://github.com/tawaraashish/rea-revers/blob/main/src/ghidra/GhidraClient.ts"
click node_hopper "https://github.com/tawaraashish/rea-revers/blob/main/src/hopper/HopperClient.ts"
click node_ida "https://github.com/tawaraashish/rea-revers/blob/main/src/ida/IdaSessionClient.ts"
click node_debuggers "https://github.com/tawaraashish/rea-revers/blob/main/src/gdb/GdbSessionManager.ts"
click node_rizin "https://github.com/tawaraashish/rea-revers/blob/main/src/rizin/RizinDebugSessionManager.ts"
click node_javascript "https://github.com/tawaraashish/rea-revers/blob/main/src/javascript/analysis/JavaScriptAnalysisWorker.ts"
click node_browser "https://github.com/tawaraashish/rea-revers/blob/main/src/application/BrowserObservationService.ts"
click node_evidence "https://github.com/tawaraashish/rea-revers/blob/main/src/domain/evidence.ts"
click node_result "https://github.com/tawaraashish/rea-revers/blob/main/src/domain/result.ts"
click node_errors "https://github.com/tawaraashish/rea-revers/blob/main/src/domain/analysisErrorCore.ts"
click node_error_projection "https://github.com/tawaraashish/rea-revers/blob/main/src/domain/analysisErrorProjection.ts"
click node_setup "https://github.com/tawaraashish/rea-revers/blob/main/src/application/Setup.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mcp,node_mcp_tools,node_cli,node_setup,node_terminal toneBlue
class node_reverse_service,node_provider_process,node_contracts toneAmber
class node_ghidra,node_hopper,node_ida,node_debuggers,node_rizin,node_javascript,node_browser toneMint
class node_evidence,node_result,node_errors,node_error_projection toneRose
class node_agent toneIndigo
```

## Components

### User entry points

- [MCP server](https://github.com/tawaraashish/rea-revers/blob/main/src/main.ts): `src/main.ts`
- [MCP analysis tools](https://github.com/tawaraashish/rea-revers/blob/main/src/server/registerReverseEngineeringTools.ts): `src/server/registerReverseEngineeringTools.ts`
- [CLI commands](https://github.com/tawaraashish/rea-revers/blob/main/src/cli/reverseEngineeringCommands.ts): `src/cli/reverseEngineeringCommands.ts`
- [Agent setup](https://github.com/tawaraashish/rea-revers/blob/main/src/application/Setup.ts): `src/application/Setup.ts`

### Analysis workflow

- [Reverse analysis](https://github.com/tawaraashish/rea-revers/blob/main/src/application/reverse/ReverseEngineeringService.ts): `src/application/reverse/ReverseEngineeringService.ts`
- [Provider processes](https://github.com/tawaraashish/rea-revers/blob/main/src/process/ProviderProcess.ts): `src/process/ProviderProcess.ts`
- [Tool contracts](https://github.com/tawaraashish/rea-revers/blob/main/src/contracts/reverseEngineeringToolContracts.ts): `src/contracts/reverseEngineeringToolContracts.ts`

### Analysis engines

- [Ghidra](https://github.com/tawaraashish/rea-revers/blob/main/src/ghidra/GhidraClient.ts): `src/ghidra/GhidraClient.ts`
- [Hopper](https://github.com/tawaraashish/rea-revers/blob/main/src/hopper/HopperClient.ts): `src/hopper/HopperClient.ts`
- [IDA](https://github.com/tawaraashish/rea-revers/blob/main/src/ida/IdaSessionClient.ts): `src/ida/IdaSessionClient.ts`
- [Debug sessions](https://github.com/tawaraashish/rea-revers/blob/main/src/gdb/GdbSessionManager.ts): `src/gdb/GdbSessionManager.ts`
- [Rizin sessions](https://github.com/tawaraashish/rea-revers/blob/main/src/rizin/RizinDebugSessionManager.ts): `src/rizin/RizinDebugSessionManager.ts`
- [JavaScript analysis](https://github.com/tawaraashish/rea-revers/blob/main/src/javascript/analysis/JavaScriptAnalysisWorker.ts): `src/javascript/analysis/JavaScriptAnalysisWorker.ts`
- [Browser observations](https://github.com/tawaraashish/rea-revers/blob/main/src/application/BrowserObservationService.ts): `src/application/BrowserObservationService.ts`

### Evidence and results

- [Evidence records](https://github.com/tawaraashish/rea-revers/blob/main/src/domain/evidence.ts): `src/domain/evidence.ts`
- [Result type](https://github.com/tawaraashish/rea-revers/blob/main/src/domain/result.ts): `src/domain/result.ts`
- [Analysis errors](https://github.com/tawaraashish/rea-revers/blob/main/src/domain/analysisErrorCore.ts): `src/domain/analysisErrorCore.ts`
- [Error projection](https://github.com/tawaraashish/rea-revers/blob/main/src/domain/analysisErrorProjection.ts): `src/domain/analysisErrorProjection.ts`

### Other components

- **Agent**
- **Terminal user**

## Connections

- Agent → MCP server: asks through MCP (evidence: `README.md`)
- Terminal user → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Reverse analysis: calls (evidence: `src/cli/reverseEngineeringCommands.ts`)
- MCP analysis tools → Reverse analysis: calls (evidence: `src/server/registerReverseEngineeringTools.ts`)
- Reverse analysis → Provider processes: manages processes (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- Reverse analysis → Evidence records: returns evidence (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- Reverse analysis → Result type: uses results (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- Reverse analysis → Analysis errors: reports failures (evidence: `src/application/reverse/ReverseEngineeringService.ts`)
- MCP analysis tools → Tool contracts: uses contracts
- Analysis errors → Error projection: projects errors (evidence: `src/domain/analysisErrorProjection.ts`)
- Agent setup → Agent: registers REA (evidence: `README.md`)
- Agent → Evidence records: receives findings (evidence: `README.md`)
- Reverse analysis → Ghidra: dispatches analysis
- Reverse analysis → Hopper: dispatches analysis
- Reverse analysis → IDA: dispatches analysis
- Reverse analysis → Debug sessions: dispatches sessions
- Reverse analysis → Rizin sessions: dispatches sessions
- MCP server → JavaScript analysis: offers analysis
- MCP server → Browser observations: offers observations
