Skip to content

fix(mcp): register fx and MCPorter where they read their configuration - #10698

Merged
morluto merged 4 commits into
mainfrom
fix/mcp-add-client-path-overrides
Nov 15, 2026
Merged

morluto merged 4 commits into
mainfrom
fix/mcp-add-client-path-overrides

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

rea mcp add registered fx and MCPorter at fixed home paths that those clients may not read. It now resolves each path with the client's own override rules.

Refs #7181. This bug was found while researching the mcp-add-only clients, and fixing it is a prerequisite for folding fx and MCPorter into the client table.

Problem and expected behavior

  • fx: when FX_HOME is set, fx reads $FX_HOME/mcp.json. It accepts only an absolute path other than / and the home folder, and ignores trailing slashes (useFxHome, profile_paths.zig). REA always wrote ~/.fx/mcp.json.
  • MCPorter: a non-empty MCPORTER_CONFIG (trimmed, ~ expanded, resolved against the cwd) is the only file loaded. Otherwise MCPorter loads the first existing of $XDG_CONFIG_HOME/mcporter/mcporter.json[c] (absolute only), then ~/.mcporter/mcporter.json[c]. A new home file goes to the XDG path when that is set (listConfigLayerPaths, mcporterConfigCandidates, expandHome in openclaw/mcporter; config.md). REA always used ~/.mcporter.

Either way, the result was configured while the client never loaded the registration.

Change and scope

  • McpRegistrationLocations.ts:
    • fxLocation honors FX_HOME and refuses a value fx refuses, with a ConfigurationError before any write.
    • mcporterLocation follows MCPorter's candidate order and MCPORTER_CONFIG.
  • Root cause: both resolvers ignored the client's own path override. Other location gaps of the same kind are listed in the audit report and left for their clients' own PRs:
    • Zed's FLATPAK_XDG_CONFIG_HOME;
    • Amp's settings.jsonc;
    • Cline in editors other than VS Code.
  • Not included: folding fx and MCPorter into the client table, so doctor, update and uninstall still do not see them. fx additionally needs setup to publish private profiles (0700/0600).

Contract and boundary impact

  • Semantic owner and earliest changed stage: the fx and MCPorter location resolvers.

  • Contribution scope fit and linked maintainer decision: maintainer-requested W8/D5 workstream; ordinary fix within existing boundaries.

  • CLI and MCP/tool-catalog contract: config_path in the report reflects the overrides. An invalid FX_HOME now fails that client with a ConfigurationError.

  • Provider, bridge, target-format, or platform compatibility: none.

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details: writes go only where the client reads. No new authority.

  • Generated metadata, package, or installation impact: none.

  • 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: src/application/McpRegistrationCatalog.test.ts.
    • fx: the default path, FX_HOME with a trailing slash, and refusal of a relative path, /, the home folder, and the home folder with a trailing slash.
    • MCPorter: the legacy default, the XDG default, an existing legacy .jsonc under XDG, an XDG file taking precedence over a legacy file, a relative XDG value being ignored, and MCPORTER_CONFIG with whitespace and ~.
  • Base reproduction: with the resolver change reverted, 8 of the new cases fail. The defaults and legacy cases pass on both.
  • Remaining proof gaps: no installed fx or MCPorter was run. The rules come from their source at current main.

Validation performed

  • npm run test:local -- src/application/McpRegistrationCatalog.test.ts — 31 passed. 8 failed with McpRegistrationLocations.ts stashed.
  • npm run test:local -- src/application/McpClientRegistration.test.ts src/application/McpClientRegistration.formats.test.ts — 47 passed, 1 skipped.
  • npm run check:fast — passed.
  • npm run docs:check — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. A caller with FX_HOME or MCPORTER_CONFIG/XDG set now gets a registration the client loads. Earlier stray files at the old default paths are left as they were.
  • Real Hopper/Ghidra, browser, or OS coverage: path logic tested with platform: "linux" on macOS.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: fx private-profile permissions are applied to the selected FX_HOME folder, as they were to ~/.fx.

Author readiness

Human owner:

  • 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T10:05:55.511862Z 72d05c9 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge with the checked stack, including PR #10712’s lifecycle-test isolation fix.

Summary

Makes fx and MCPorter registrations follow their selected configuration paths.

  • fx registrations follow the profile folder selected by FX_HOME.
  • MCPorter registrations use the configuration file MCPorter loads.
  • Maintenance continues for known clients when another client’s location is unknown.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Client configuration selection] --> B{Client}
  B -->|fx| C[Check FX_HOME or use default]
  C --> D[Resolve physical folder]
  D --> E[Reject home folder before chmod]
  B -->|MCPorter| F[Explicit override or first existing candidate]
  F --> G[Shared supported-client definition]
  G --> H[Setup / doctor / update / uninstall]
  H --> I{Location known?}
  I -->|No| J[Report unknown and recovery]
  I -->|Yes| K[Inspect or maintain selected registration]
Loading

Reviews (4) · Last reviewed commit: "feat(setup): let doctor, update and unin..." · Reviewed by Greptile

@morluto
morluto force-pushed the fix/mcp-add-client-path-overrides branch from 9f96c73 to 6b7d00c Compare November 15, 2026 00:44
@morluto
morluto changed the base branch from main to refactor/fold-mcp-add-clients November 15, 2026 00:45

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f96c73508

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 17d3f3507b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Fixed in 441e26c (carried into #10709's shared ClientPrivateProfile.ts). Root cause: the root and home checks compared FX_HOME text, but a linked parent can make the folder fx opens be the home folder, and the private writer would then chmod it 0700. Structural fix: the private-profile owner compares the opened folder's device and inode with the caller's home folder (passed with the client as privateProfile.home, not read from the process) and refuses before changing modes or publishing. Validation: new test refuses to make the home folder private through a linked profile path fails without the check and passes with it; client registration tests pass.

@morluto
morluto force-pushed the fix/mcp-add-client-path-overrides branch from 441e26c to a646960 Compare November 15, 2026 03:44
@morluto
morluto force-pushed the refactor/fold-mcp-add-clients branch from e00a1c5 to 02f9936 Compare November 15, 2026 03:44
@morluto
morluto force-pushed the fix/mcp-add-client-path-overrides branch 3 times, most recently from 015b60d to d0ed155 Compare November 15, 2026 07:29
@morluto
morluto changed the base branch from refactor/fold-mcp-add-clients to main November 15, 2026 09:04
fx reads $FX_HOME/mcp.json when FX_HOME is set, and MCPorter reads
MCPORTER_CONFIG exclusively or prefers an absolute XDG_CONFIG_HOME file.
rea mcp add always wrote ~/.fx/mcp.json and ~/.mcporter/mcporter.json,
which those clients then ignored. Resolve both from the clients' own
rules, and refuse an FX_HOME fx itself refuses.
…ases

Address review findings: MCPORTER_CONFIG now also names the detection
marker, so default registration includes MCPorter when only that file
exists, and is resolved with path.resolve as MCPorter does. FX_HOME with
. or .. segments is refused, so the private profile mode cannot reach
the home folder through an alias. Override tests use the host's path
rules for real temporary paths.
A linked parent in FX_HOME can name the caller's home folder after the textual root and home checks pass. The private profile writer now compares the opened folder's identity with the caller's home folder and refuses before changing modes or publishing.
…ons (#10702)

* feat(setup): let doctor, update and uninstall see MCPorter registrations

MCPorter becomes a client-table row, so a registration rea mcp add or
rea setup --client mcporter wrote is inspected, refreshed and removed like
other clients. MCPorter already imports setup-managed clients'
registrations, so the row is applicable only through REA's own
registration: setup never selects it from detection and doctor reports
it only when its file holds a rea row or the caller selects it. A
relative MCPORTER_CONFIG is refused because MCPorter resolves it per
command directory.

* fix(setup): detect MCPorter by the folder of the file it loads

With an absolute XDG_CONFIG_HOME and only a legacy ~/.mcporter file, the row returned the legacy file but the absent XDG folder as its detection evidence, so default registration and setup skipped MCPorter.

* fix(setup): keep an unresolved client unknown without blocking others' maintenance

A client whose configuration location cannot be resolved (for example a relative MCPORTER_CONFIG) is reported as unknown, never missing or absent. Update maintenance leaves each unresolved client out of its scope and names it with its own recovery, while still maintaining the other clients; uninstall still stops, because it cannot tell whether that client's file holds REA's row.

* docs(setup): restore MCPorter's release note and client-table row after rebase

* fix(update): keep unknown clients in every failed maintenance plan
@morluto
morluto force-pushed the fix/mcp-add-client-path-overrides branch from d0ed155 to 72d05c9 Compare November 15, 2026 10:04
@morluto
morluto merged commit da8f366 into main Nov 15, 2026
12 of 13 checks passed
@morluto
morluto deleted the fix/mcp-add-client-path-overrides branch November 15, 2026 10:25
Iyanuoluwa007 added a commit to Iyanuoluwa007/rea that referenced this pull request Nov 16, 2026
When a client's configuration location cannot be resolved, such as
Claude Desktop with migrated Claude-Data storage, setup refuses to write
it and the user has to register REA by hand. The client picker still
said "Existing configuration needs repair before setup" (6.9.0, where
the state is invalid) or "Detected · choose to configure" (main, where
morluto#10698 records it as unknown), and neither is true.

Show "Configuration location unresolved · register REA manually" for
any client with a location error, and keep the repair hint for
configurations that are actually malformed.

Fixes morluto#11697
morluto added a commit that referenced this pull request Nov 18, 2026
* fix(setup): name an unresolved client location in the picker

When a client's configuration location cannot be resolved, such as
Claude Desktop with migrated Claude-Data storage, setup refuses to write
it and the user has to register REA by hand. The client picker still
said "Existing configuration needs repair before setup" (6.9.0, where
the state is invalid) or "Detected · choose to configure" (main, where
#10698 records it as unknown), and neither is true.

Show "Configuration location unresolved · register REA manually" for
any client with a location error, and keep the repair hint for
configurations that are actually malformed.

Fixes #11697

* test(setup): type picker fixtures as SetupClientState

The journey fixtures used array paths and a marker field that setup
never sends, and omitted registrationProfile. They now satisfy the
production contract so the type checker rejects drift.

---------

Co-authored-by: morluto <[email protected]>
@morluto morluto added area: mcp MCP server, transport, and tool registration bug Something isn't working labels Nov 22, 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 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant