Skip to content

feat(jeb): add JEB engine provider over its MCP interface - #1536

Merged
morluto merged 9 commits into
morluto:mainfrom
3QL:feat/jeb-provider
Oct 10, 2026
Merged

morluto merged 9 commits into
morluto:mainfrom
3QL:feat/jeb-provider

Conversation

@3QL

@3QL 3QL commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

feat(jeb): add JEB engine provider over its MCP interface

Summary

  • Add a bring-your-own JEB provider that serves project, unit, and decompilation inspection from a caller-started JEB client speaking MCP (streamable HTTP, selected with REA_JEB_MCP_URL, default http://127.0.0.1:8425/mcp). REA never installs or launches JEB.
  • Expose four provider-neutral operations through the shared CLI/MCP workflows, each returning Evidence with engine identity, endpoint, caller-selected parameters, and preserved refusal reasons: inspect_jeb_client, open_jeb_project, list_jeb_units, decompile_jeb_item (CLI: inspect-jeb-client, open-jeb-project, list-jeb-units, decompile-jeb-item).
  • Keep JEB's envelope semantics at the boundary: success fields parsed format-aware, message-only refusals mapped to unsupported-target errors carrying the engine's own reason, transport failures mapped to availability failures with recovery guidance, and unit pagination deriving coverage from the engine's real 100-item page cap. Explicit unknowns (implicitly selected unit, omitted filters) are reported instead of guessed.
  • Add scripts/verify-jeb.mjs (npm run verify:jeb), a docs/jeb-analysis.md guide, capability-inventory availability with recovery guidance, catalog registration, and translated README rows.

Verification

  • npm run build:cached
  • npm run test:focused -- src/contracts/jeb/jebToolContracts.test.ts src/application/jeb/JebAnalysisService.test.ts src/jeb/JebMcpConnection.test.ts src/jeb/JebProvider.test.ts tests/boundary/cli/jebCli.test.ts tests/boundary/mcp/jebMcp.test.ts tests/boundary/cli/productCatalog.test.ts (38 tests)
  • npm run check:fast
  • npm run docs:check

Real JEB verification was performed (no real Hopper/Ghidra claims in this change): a licensed JEB 5.48.0 build serving jeb-mcp-server 1.3.0 headless over streamable HTTP, driven through the public CLI, the MCP boundary over stdio with the pinned client SDK, and npm run verify:jeb, at four target scales:

  1. Compiled Java class fixture (unit identity, decompilation marker).
  2. Locally built signed probe APK — manifest, v1/v2/v3 certificates, dex, filtered/paginated/parent-restricted unit listing, activity method decompilation (dexdec inline constant folding observed).
  3. Published Signal 8.30.3 universal release APK (109 MB, R8 Kotlin/Compose, four signature schemes, native arm64 ELF units) — MainActivity.onCreate (7 KB pseudo-code) and R8 synthetic lambdas decompiled through both adapters. This target exposed and validated the refusal-preservation fix in decodeJebToolResult.
  4. Official Flutter Gallery 2.9.2 release APK (112 MB) — per-ABI libapp.so Dart AOT snapshot images analyzed as native code (75,205 methods on arm64), snapshot internals decompiled with explicit unit selection through both adapters, thin Java wrapper, decoded manifest.

Engine coverage notes

  • JEB 5.48.0 headless instances do not advertise open_project or run_script; the target is selected when the engine client starts (--infile on the documented programmatic launcher, or the GUI). REA preserves the engine's exact refusal instead of failing opaquely, and docs/jeb-analysis.md documents the boundary. The dedicated Dart snapshot processor (IDartAotUnit) is likewise GUI-only; native libapp.so analysis is what REA serves headless.
  • The IDA-style mutation surface the engine also offers (renames, comments, save_project/close_project) is intentionally not exposed in this slice.

Sanitized MCP example

> client.callTool({ name: "decompile_jeb_item", arguments: {
    item_address: "Lorg/thoughtcrime/securesms/MainActivity;->onCreate(Landroid/os/Bundle;)V",
    item_kind: "method",
    unit_path: "signal.apk/org.thoughtcrime.securesms/Bytecode"
  } })
< { "normalized_result": { "engine": { "name": "jeb", "version": "5.48.0.202610071539",
      "endpoint": "http://127.0.0.1:8425/mcp", "gui_client": false },
      "unit_path": "signal.apk/org.thoughtcrime.securesms/Bytecode",
      "item_address": "…onCreate(Landroid/os/Bundle;)V", "item_kind": "method",
      "text": "@Override  // org.thoughtcrime.securesms.PassphraseRequiredActivity\npublic void onCreate(…" },
    "confidence": "derived",
    "limitations": ["Artifact identity is unavailable for this observation."] }

REA Contributor added 5 commits October 10, 2026 12:28
Add a bring-your-own JEB provider that serves project, unit, and
decompilation inspection from a caller-started JEB client speaking MCP
(streamable HTTP, selected with REA_JEB_MCP_URL). Expose four provider-neutral
operations through shared CLI/MCP workflows: inspect_jeb_client,
open_jeb_project, list_jeb_units, and decompile_jeb_item, each returning
Evidence with engine identity, endpoint, and preserved refusal reasons.

The adapter keeps JEB's envelope semantics: success fields are parsed
format-aware at the boundary, message-only refusals become unsupported-target
errors with the engine's own reason, transport failures become availability
failures with recovery guidance, and unit pagination derives coverage from the
engine's 100-item page cap. Explicit unknowns (implicitly selected unit,
omitted filters) are reported instead of guessed.

Verified against a real JEB 5.48.0 licensed build serving jeb-mcp-server 1.3.0
headless: client inspection, unit listing, and method decompilation were
exercised through the CLI, MCP boundary, and scripts/verify-jeb.mjs.
JEB 5.48.0 headless instances do not advertise open_project; the refusal is
preserved and documented.
Verify the provider against a locally built, v1/v2/v3-signed probe APK
(binary manifest, classes.dex with a launcher activity) on JEB 5.48.0: the
full unit tree (apk, manifest, three certificate units, dex bytecode,
decompiler), wildcard-filtered and paginated unit listing with derived
coverage, parent-restricted listing, and launcher-activity method
decompilation through both CLI and MCP, including dexdec's inline
constant folding of the probe's obfuscated tag.

Move list-jeb-units filter/pagination and decompile-jeb-item unit selection
from positional arguments to options; the MCP schemas are unchanged.
Testing against the published Signal 8.30.3 universal APK exposed a boundary
bug the scripted provider tests missed: decodeJebToolResult raised a protocol
error for isError results before the provider could map JEB's
{success:false, message} envelope, so real engine refusals surfaced as
unreadable output instead of the engine's own reason. Decode refusal
envelopes like any structured result and let the provider preserve the
reason; cover the decoder directly, including contentless and unparseable
results.

Signal verification: full 109 MB R8/Kotlin/Compose APK with four signature
schemes and native arm64 ELF units parsed; MainActivity.onCreate and R8
synthetic lambdas decompiled through CLI and MCP; paginated, filtered, and
parent-restricted unit listing; refusal path confirmed on the live engine.
Verify the provider against the official Flutter Gallery 2.9.2 release APK
(112 MB): per-ABI libapp.so Dart AOT snapshot images analyzed as native code
with 75k methods on arm64, snapshot internals and wrapper methods decompiled
through both CLI and MCP with explicit unit selection, decoded manifest, and
filtered native-library unit discovery. Note that JEB 5.48.0 headless does
not expose the dedicated Dart snapshot processor or run_script; both remain
GUI-only engine surfaces.
The JEB row was inserted in English across all translated READMEs; each now
carries its own label, capability summary, requirements, and guide link
following that language's Android-row conventions.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

# Conflicts:
#	README_ar.md
#	README_de.md
#	README_es.md
#	README_fa.md
#	README_fr.md
#	README_ja.md
#	README_ko.md
#	README_pl.md
#	README_pt-BR.md
#	README_ru.md
#	README_th.md
#	README_tr.md
#	README_uk.md
#	README_vi.md
#	README_zh-TW.md
#	README_zh.md
# Conflicts:
#	README.md
#	README_ar.md
#	README_de.md
#	README_es.md
#	README_fa.md
#	README_fr.md
#	README_id.md
#	README_ja.md
#	README_ko.md
#	README_pl.md
#	README_pt-BR.md
#	README_ru.md
#	README_th.md
#	README_tr.md
#	README_uk.md
#	README_vi.md
#	README_zh-TW.md
#	README_zh.md
#	scripts/lib/catalog-builders.mjs
#	scripts/lib/catalog-core.mjs
#	src/cli.ts
#	src/contracts/toolContractTypes.ts
#	src/contracts/toolContracts.ts
#	src/contracts/toolEffects.ts
#	src/server/createServer.ts
#	vitest.config.ts
@morluto
morluto merged commit 749e587 into morluto:main Oct 10, 2026
8 of 9 checks passed
@morluto

morluto commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Thanks @3QL for bringing JEB's MCP interface into REA! Squash merged with the review fixes. Welcome to REA, and thank you for your first PR and your additional ADB and Apktool contributions in #1552 and #1556.

Comment thread README.md
@@ -159,6 +159,7 @@ Additional tools and host support depend on the target:
| .NET assemblies | Metadata, CIL instructions, declared native dependencies and build comparisons | None (static only); [managed-code guide](docs/managed-code-analysis.md) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi

@morluto morluto added enhancement New feature or request area: mcp MCP server, transport, and tool registration labels Oct 14, 2026
@morluto morluto added the provider: jeb Analysis provider / engine: jeb label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcp MCP server, transport, and tool registration enhancement New feature or request provider: jeb Analysis provider / engine: jeb

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants