[PR #7449] fix(mcp): advertise absolute filesystem paths #7842

Open
opened 2026-11-05 01:48:04 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7449
Author: @Vaishnavi220506
Created: 10/27/2026
Status: 🔄 Open

Base: main ← Head: fix/mcp-absolute-path-schemas


📝 Commits (2)

  • 19f15f5 fix(mcp): advertise absolute filesystem paths
  • 02b5240 fix(mcp): retain absolute path constraints in compact schemas

📊 Changes

7 files changed (+244 additions, -12 deletions)

View changed files

📝 src/contracts/javascript/javascriptRecoveryToolContracts.ts (+20 -1)
📝 src/contracts/native/binaryDiagnosticsToolContracts.ts (+33 -4)
📝 src/contracts/webScriptToolContracts.ts (+11 -1)
📝 src/domain/localPath.test.ts (+7 -0)
📝 src/domain/localPath.ts (+12 -5)
📝 tests/acceptance/localPathAdmissionCli.test.ts (+16 -0)
📝 tests/boundary/mcp/absoluteLocalPathSchema.test.ts (+145 -1)

📄 Description

Summary

Fixes #7437. Make the MCP input schemas for five existing tools reject relative filesystem paths before their handlers are called, matching the absolute-path invariant already enforced by those handlers.

Problem and expected behavior

The advertised schemas accepted relative values for inspect_apple_ips, inspect_elf_notes, inspect_kernel_module, export_web_scripts, and recover_javascript_sources, but the same MCP requests were later rejected as invalid_request because the handlers require absolute paths. recover_javascript_sources.additional_paths had the same mismatch.

The schemas should reject relative values for these fields and continue accepting host-absolute paths.

Change and scope

  • Added MCP-only schema overlays that replace the affected localPathStringSchema fields with the existing absoluteLocalPathStringSchema.
  • Covered the three native diagnostic paths, both export paths, and all recovery input paths including additional_paths.
  • Kept shared domain and CLI schemas unchanged so documented CLI relative-path behavior is not altered.

Follow-up PR #7097 improves field attribution for export_web_scripts handler errors; this change is separate because it fixes the advertised MCP schema acceptance before handler execution.

Contribution scope fit: ordinary boundary fix within existing capabilities; no maintainer scope decision is applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: MCP tool-contract schemas at request admission; the existing application/native services remain the semantic owners of absolute-path validation.
  • Contribution scope fit and linked maintainer decision: ordinary fix within existing boundaries; not applicable.
  • CLI and MCP/tool-catalog contract: MCP now advertises and enforces absolute host-local paths for the five affected tools; CLI input schemas are unchanged.
  • Provider, bridge, target-format, or platform compatibility: no provider or bridge changes; uses the existing host-specific absolute-path schema.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): no target execution or authority changes.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: no authored generated or package changes; the catalog was regenerated and validated by the test workflow.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: tests/boundary/mcp/absoluteLocalPathSchema.test.ts now covers all five affected tools and every affected path field. Existing native MCP tests and catalog/schema validity tests were also run.
  • Base reproduction or other evidence: on origin/main at 14dd07e74, the new regression cases failed before the implementation: inspect_apple_ips.path accepted relative-input in the advertised Ajv schema, while the existing handler regression rejected the same relative request. After the overlays, all added schema cases pass.
  • User-visible CLI/MCP output: relative MCP values are rejected during request validation with the existing absolute-path validation message; absolute values remain schema-valid. CLI behavior is unchanged.
  • Remaining proof gaps: the repository's existing optional JavaScript recovery provider tests remained skipped; the schema boundary itself is covered. Local validation used Node v24.14.1 with npm_config_engine_strict=false because the checkout declares ^22.23.4 || ^24.22.1 || >=26.12.1.

Boundary regression covered: MCP schema-advertisement and in-memory handler validation in tests/boundary/mcp/absoluteLocalPathSchema.test.ts; existing native, web export, recovery, and catalog boundary tests were included in the focused run. No lifecycle regression applies.

Validation performed

  • npm run test:focused -- tests/boundary/mcp/absoluteLocalPathSchema.test.ts tests/boundary/mcp/appleIpsMcp.test.ts tests/boundary/mcp/elfNotesMcp.test.ts tests/boundary/mcp/kernelModuleMcp.test.ts tests/boundary/mcp/javascriptRecoveryMcp.test.ts tests/boundary/mcp/webScriptSelectionMcp.test.ts tests/boundary/mcp/toolSchemaValidity.test.ts — 6 test files passed, 1 skipped; 29 tests passed, 4 skipped.
  • npm run check:fast — passed; typecheck and lint completed successfully.

Follow-up: byte entropy and compact schemas

Also fixes #7537 and applies the same MCP-only absolute-path constraint to inspect_devicetree, whose service has the same requirement. Relative CLI inputs remain supported. The shared absolute-path schema now uses one host-specific, NUL-free pattern: multiple regexes converted to allOf, causing the compact schema profile to fall back to a type-only path. Full and compact schema controls cover byte entropy, devicetree, ELF notes, Apple IPS and kernel modules.

Validation on macOS with Node 24.22.1: the six-file focused batch passed 26 tests (including existing absolute MCP and relative CLI controls); the expanded path-schema suite passed five tests, including actual byte-entropy requests under both profiles. check:fast, docs:check, targeted lint and git diff --check passed. Windows absolute-pattern syntax was checked in JavaScript regex modes, but the public workflows were not run on Windows.

Compatibility, safety, and release

  • Breaking changes or migration steps: none for valid calls; callers already had to provide absolute paths to reach these handlers. The MCP contract now rejects invalid relative requests earlier.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable; this is request-schema validation. The focused run used the matching rea-agents@6.8.0 Windows native artifact for the repository's Windows test prerequisite.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no target or external process is launched by this change; invalid relative requests are rejected before provider work.

Author readiness

Human owner: @Vaishnavi220506

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/7449 **Author:** [@Vaishnavi220506](https://github.com/Vaishnavi220506) **Created:** 10/27/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/mcp-absolute-path-schemas` --- ### 📝 Commits (2) - [`19f15f5`](https://github.com/morluto/rea/commit/19f15f543c12bf09d1f6a234d372249a8f0ae8b4) fix(mcp): advertise absolute filesystem paths - [`02b5240`](https://github.com/morluto/rea/commit/02b524026e3323ccd8321273bd670d00582f5ae3) fix(mcp): retain absolute path constraints in compact schemas ### 📊 Changes **7 files changed** (+244 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `src/contracts/javascript/javascriptRecoveryToolContracts.ts` (+20 -1) 📝 `src/contracts/native/binaryDiagnosticsToolContracts.ts` (+33 -4) 📝 `src/contracts/webScriptToolContracts.ts` (+11 -1) 📝 `src/domain/localPath.test.ts` (+7 -0) 📝 `src/domain/localPath.ts` (+12 -5) 📝 `tests/acceptance/localPathAdmissionCli.test.ts` (+16 -0) 📝 `tests/boundary/mcp/absoluteLocalPathSchema.test.ts` (+145 -1) </details> ### 📄 Description ## Summary Fixes #7437. Make the MCP input schemas for five existing tools reject relative filesystem paths before their handlers are called, matching the absolute-path invariant already enforced by those handlers. ## Problem and expected behavior The advertised schemas accepted relative values for `inspect_apple_ips`, `inspect_elf_notes`, `inspect_kernel_module`, `export_web_scripts`, and `recover_javascript_sources`, but the same MCP requests were later rejected as `invalid_request` because the handlers require absolute paths. `recover_javascript_sources.additional_paths` had the same mismatch. The schemas should reject relative values for these fields and continue accepting host-absolute paths. ## Change and scope - Added MCP-only schema overlays that replace the affected `localPathStringSchema` fields with the existing `absoluteLocalPathStringSchema`. - Covered the three native diagnostic paths, both export paths, and all recovery input paths including `additional_paths`. - Kept shared domain and CLI schemas unchanged so documented CLI relative-path behavior is not altered. Follow-up PR #7097 improves field attribution for `export_web_scripts` handler errors; this change is separate because it fixes the advertised MCP schema acceptance before handler execution. Contribution scope fit: ordinary boundary fix within existing capabilities; no maintainer scope decision is applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: MCP tool-contract schemas at request admission; the existing application/native services remain the semantic owners of absolute-path validation. - Contribution scope fit and linked maintainer decision: ordinary fix within existing boundaries; not applicable. - CLI and MCP/tool-catalog contract: MCP now advertises and enforces absolute host-local paths for the five affected tools; CLI input schemas are unchanged. - Provider, bridge, target-format, or platform compatibility: no provider or bridge changes; uses the existing host-specific absolute-path schema. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details (if applicable): no target execution or authority changes. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: no authored generated or package changes; the catalog was regenerated and validated by the test workflow. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `tests/boundary/mcp/absoluteLocalPathSchema.test.ts` now covers all five affected tools and every affected path field. Existing native MCP tests and catalog/schema validity tests were also run. - Base reproduction or other evidence: on `origin/main` at `14dd07e74`, the new regression cases failed before the implementation: `inspect_apple_ips.path` accepted `relative-input` in the advertised Ajv schema, while the existing handler regression rejected the same relative request. After the overlays, all added schema cases pass. - User-visible CLI/MCP output: relative MCP values are rejected during request validation with the existing absolute-path validation message; absolute values remain schema-valid. CLI behavior is unchanged. - Remaining proof gaps: the repository's existing optional JavaScript recovery provider tests remained skipped; the schema boundary itself is covered. Local validation used Node `v24.14.1` with `npm_config_engine_strict=false` because the checkout declares `^22.23.4 || ^24.22.1 || >=26.12.1`. Boundary regression covered: MCP schema-advertisement and in-memory handler validation in `tests/boundary/mcp/absoluteLocalPathSchema.test.ts`; existing native, web export, recovery, and catalog boundary tests were included in the focused run. No lifecycle regression applies. ## Validation performed - `npm run test:focused -- tests/boundary/mcp/absoluteLocalPathSchema.test.ts tests/boundary/mcp/appleIpsMcp.test.ts tests/boundary/mcp/elfNotesMcp.test.ts tests/boundary/mcp/kernelModuleMcp.test.ts tests/boundary/mcp/javascriptRecoveryMcp.test.ts tests/boundary/mcp/webScriptSelectionMcp.test.ts tests/boundary/mcp/toolSchemaValidity.test.ts` — 6 test files passed, 1 skipped; 29 tests passed, 4 skipped. - `npm run check:fast` — passed; typecheck and lint completed successfully. ## Follow-up: byte entropy and compact schemas Also fixes #7537 and applies the same MCP-only absolute-path constraint to `inspect_devicetree`, whose service has the same requirement. Relative CLI inputs remain supported. The shared absolute-path schema now uses one host-specific, NUL-free pattern: multiple regexes converted to `allOf`, causing the compact schema profile to fall back to a type-only path. Full and compact schema controls cover byte entropy, devicetree, ELF notes, Apple IPS and kernel modules. Validation on macOS with Node 24.22.1: the six-file focused batch passed 26 tests (including existing absolute MCP and relative CLI controls); the expanded path-schema suite passed five tests, including actual byte-entropy requests under both profiles. `check:fast`, `docs:check`, targeted lint and `git diff --check` passed. Windows absolute-pattern syntax was checked in JavaScript regex modes, but the public workflows were not run on Windows. ## Compatibility, safety, and release - Breaking changes or migration steps: none for valid calls; callers already had to provide absolute paths to reach these handlers. The MCP contract now rejects invalid relative requests earlier. - Real Hopper/Ghidra, browser, or OS coverage: not applicable; this is request-schema validation. The focused run used the matching `rea-agents@6.8.0` Windows native artifact for the repository's Windows test prerequisite. - Package or release metadata impact: none. - Security, privacy, process, or containment review: no target or external process is launched by this change; invalid relative requests are rejected before provider work. ## Author readiness Human owner: @Vaishnavi220506 - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7842
No description provided.