Repository navigation
chore(cli): correct MCP server layering precedence in docs - #70
Closed
lukealvoeiro wants to merge 1 commit into
Closed
lukealvoeiro wants to merge 1 commit into
lukealvoeiro wants to merge 1 commit into
Conversation
The MCP configuration page said user config wins over folder and project config, and that folder-level mcp.json is read from ancestor directories of the project. The CLI resolves MCP servers through the general settings hierarchy (org > folder > project > user, reordered deliberately in factory-mono #10094), and folder levels are the .factory directories between the working directory and the git root. Update the EN page and the JP mirror to describe the actual behavior. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Contributor
|
Droid finished @lukealvoeiro's task —— View job LGTM. No actionable issues found in the MCP layering documentation changes. 0 inline comments posted |
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.
Gap
docs/cli/configuration/mcp.mdxand its JP mirrordocs/jp/cli/configuration/mcp.mdxdescribe MCP config layering incorrectly. They say a user-level server wins over folder-level and project-level servers with the same name, and that folder-levelmcp.jsonis read from any ancestor directory of the project. The CLI does neither of these things.Evidence
docs/cli/configuration/mcp.mdx:264: ".factory/mcp.jsonin any ancestor directory of the project".docs/cli/configuration/mcp.mdx:271: "When the same server is defined at multiple levels, user config takes priority, followed by folder-level config, then project config." The JP page has the same statements at lines 264 and 271.dev):packages/runtime/settings/src/SettingsManager.ts:3101-3189(buildSettingsHierarchyLevels) orders levels as org, runtime overlay, folder (nearest first), project, user.packages/runtime/settings/src/mergeMcp.ts:7-27: a server defined at a higher level replaces a lower-level server with the same name.packages/runtime/settings/src/McpSettingsManager.ts:212-223attributes each server to the first (highest) level that defines it.packages/runtime/shell/src/dot-folder-paths.ts:97-112: folder levels are only the.factorydirectories from the cwd up to the git root, not including the root. Directories above the project root are never read.packages/runtime/settings/src/SettingsManager.test.ts:667-708asserts that a project server shadows a user server with the same name ('shadowed-server': { source: SettingsLevel.Project }).ea212240f01, "swap order"). That PR added regression tests named "Precedence Order: Org > Folder > Project > User". The docs sentence came in with docs #1171 and matches the order the code used before #10094.droidbuilt from source (no network, scratch HOME). Fixture:folderlvl/.factory/mcp.json{foldersrv, dup};folderlvl/repo(git root)/.factory/mcp.json{projsrv, dup, dup2};repo/sub/.factory/mcp.json{subsrv, dup2}; user~/.factory-dev/mcp.json{dup2}.Why it matters
Users who follow the docs expect a server in
~/.factory/mcp.jsonto override a team server with the same name. In practice the project config wins silently. Users may also put a sharedmcp.jsonin a parent folder above several repos, and that file is never read.Fix
Docs only, in EN and JP:
.factory/mcp.jsonin a subdirectory between the working directory and the project root. Its purpose is now described as scoping servers to part of a repository, such as one package in a monorepo.I checked the other EN/JP pages that mention
mcp.json: settings, custom-droids, plugins, the video walkthrough and hierarchical-settings-and-org-control. None of them state an MCP-specific precedence, so they are unchanged.Not changed here: the existing bullet saying that enabling or disabling a project-defined server saves a user-level copy. The CLI does write that copy (
McpSettingsManager.updateMcpServer). However, because the project level now outranks the user level, the copy does not take effect. A user config of{"dup":{...,"disabled":true}}still leaves the project'sdupactive indroid mcp list. This is a code issue and should be fixed separately from this docs change.Validation
git diff --checkis clean.Found by the scheduled CLI arguments audit (gap EXT-T1).