fix(generate): preserve explicit definitions when config is supplied - #350
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 4:18 PM ET / 20:18 UTC. ClawSweeper reviewWhat this changesThe PR makes CLI generation discover tools from the resolved server definition when a config is also supplied, with regression cases for empty and conflicting configs. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: both current main and v0.13.9 retain the faulty discovery behavior. No introduced correctness defect was found, and the supplied maintainer validation supports the intended result. Priority: P2 Review scores
Verification
How this fits togetherMCPorter generates standalone CLIs from MCP server definitions and discovered tool schemas. Discovery must contact the same server whose definition is embedded in the generated artifact. flowchart LR
A[CLI target and config] --> B[Resolve server definition]
B --> C[Discovery runtime]
C --> D[MCP server]
D --> E[Tool schemas and metadata]
B --> F[Generated CLI]
E --> F
Before mergeNone. Agent review detailsSecurityNone. Review metricsNone. Technical reviewBest possible solution: Keep discovery and generated execution tied to one resolved definition while preserving configured-name resolution and existing lifecycle handling. Do we have a high-confidence way to reproduce the issue? Yes, from source: generate-cli with an explicit command and an empty or same-name conflicting config reaches discovery that replaces the resolved definition on main. Maintainer-reported before/after failures corroborate this; this review did not execute tests. Is this the best way to solve the issue? Yes. Using the existing explicit-server runtime option is the narrowest repair and aligns discovery with the definition already embedded in generated CLIs. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7a2d4dc563c9. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Maintainer validation on Both new regression cases failed before the fix: an empty config produced “Unknown MCP server 'fixture'”, and a conflicting same-name config launched the wrong process and closed the connection. After the fix, Real CLI proof: Exact-head Linux, macOS, and Windows CI passed: https://github.com/openclaw/mcporter/actions/runs/33988606910 The CLI generator documentation and 0.13.10 Unreleased entry now describe the preserved definition precedence. Ready for squash landing. |
60eb49d to
38af8a2
Compare
|
Restacked onto
Exact-head Linux, macOS, and Windows CI passed: https://github.com/openclaw/mcporter/actions/runs/33989501417 |
mcporter --config config.json generate-cli --command <url>discarded the explicit server definition during tool discovery. An empty config failed with “Unknown MCP server”; a conflicting same-name entry could connect to a different server from the one embedded in the generated CLI.Always construct discovery from the already resolved definition, preserving its tool filters and metadata. The regression cases cover empty and conflicting configs using a real MCP fixture.
Restacked onto main after #348, #344, and #347 landed. This PR now contains only the code fix and regression tests. The complete 0.13.10 Unreleased section is carried by #349.