refactor(agent): unify external MCP config loading - #774
Closed
beruro wants to merge 1 commit into
Closed
Conversation
Collaborator
Author
|
Superseded by #780, which preserves this change as an independent commit and has passed the consolidated CI suite. The source branch is retained for recovery. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
External MCP discovery and import each carried an identical JSON loader that inferred missing transport types and translated legacy
httpentries. Keeping those copies separate made it possible for detection to accept a config that import later interpreted differently.Solution
Move external MCP normalization into one private
external_import::mcp_configmodule used by both detection and import. The shared boundary preserves the existing behavior and error messages: missingtypebecomesstdioorstreamableHttpbased onurl, legacyhttpbecomesstreamableHttp, explicit supported types remain unchanged, and files without an object-valuedmcpServersmap are treated as empty. Focused tests now pin those compatibility rules.Potential risks
The risk is changing compatibility with third-party MCP JSON formats or error reporting. The implementation is a direct extraction of the two byte-for-byte-equivalent paths, and regression tests cover every normalization branch plus the empty-map fallback. It changes no persisted ORGII format, public API, or write path. Rollback is a single-commit revert.
Architecture audit
Verification
cargo fmt --manifest-path src-tauri/Cargo.toml --all -- --check— passed.cargo test -p agent_core external_import --lib— 25 passed, including the two new loader regressions.agent_coreCargo clippy passed.cargo clippy -p agent_core --all-targets -- -D warnings— the full dependency-inclusive command was blocked by the pre-existing unchangedcrates/orgtrack-core/src/sources/imported_history/window.rs:189collapsible_else_ifwarning; no warning originated in this diff.git diff --check— passed.