Repository navigation
fix(settings): say that user-scope MCP servers load, and pin the scope contract - #170
Merged
Merged
Conversation
…e contract The app never refused a user's own MCP servers - it only claimed to. With the runtime's conventional autoload, the servers registered with `gjc mcp add` (`<agentDir>/mcp.json`) connect before an app session exists and their tools are always-on, past the explicit `toolNames` and with discovery off. The Settings row added in #165 said the opposite, in ten languages, and #161 repeated it. Owner decision (2026-09-18): keep exactly that split. User scope loads as in the CLI; a project's own `.gjc/mcp.json` never does. The runtime reads an unset `mcp.enableProjectConfig` as true, so the app's override is the load-bearing half and is now described as such. - `gjc-mcp-autoload.bun.test.ts` pins both scopes against the real SDK with a real stdio server: the runtime alone loads both; under the app policy the user-scope tool is active and executable while the project one is absent; opting out of the autoload is what would remove it. - The identity fixture in the contract suite asserts a top-level session keeps the autoload and a delegated child opts out. - Settings > Automation > Withheld: the row is now "Project MCP servers" and says what loads and what does not (all ten locales). - `GJC-LIVE-SPEC.md` gains an "MCP servers" section. Closes #161.
devswha
force-pushed
the
fix/mcp-user-scope-contract
branch
from
September 17, 2026 17:21
d4131ef to
5ba11ee
Compare
The engine manifest is the list `npm test` enforces for `server/gjc-*`; a file missing from it fails the suite on purpose. The new scope test belongs with the adapter it pins.
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
#161 said the app hard-disables MCP for every session. Half of that was wrong, and the app's own Settings row (#165) repeated the wrong half in ten languages.
Verified against the bundled SDK (0.16.4) with a real stdio MCP server: the runtime's conventional autoload connects the servers a user registered with
gjc mcp add(<agentDir>/mcp.json, i.e.~/.gjc/agent/mcp.jsonfor the worker) before the session exists, and surfaces their tools as always-on — past the app's explicittoolNames, withtools.discoveryModeoff andmcp.discoveryModefalse. The adapter never passesenableMcpAutoload: falsefor a top-level session. So user-scope servers have always loaded in the app exactly as in the CLI.What the app does refuse is a project's own
.gjc/mcp.json: the runtime reads an unsetmcp.enableProjectConfigastrue, so the app'sfalseoverride is the load-bearing half.Decision
Owner decision 2026-09-18 (#161 option B): keep exactly that split. User scope loads as in the CLI; project scope never does; discovery stays off. No behaviour changes in this PR — it makes the existing behaviour deliberate, documented and pinned.
Changes
server/gjc-mcp-autoload.bun.test.ts(new): a throwaway stdio MCP server registered in both scopes of a temp agent dir/project. Three pins: the runtime alone loads both scopes (so the project half is the app's decision); underapplyGjcToolSettingsPolicythe user-scope tool is active and executable (getToolByName) while the project-scope tool is absent;enableMcpAutoload: falseis what would remove the user-scope tool, and the app does not send it.server/gjc-sdk-contract.bun.test.ts: the identity fixture's factory asserts a top-level session request has noenableMcpAutoloadand a delegated child (agentIdset) hasfalse.server/gjc-bun-sdk-adapter.ts: theapplyGjcToolSettingsPolicycomment states the scope contract (code unchanged)..gjc/mcp.jsondoes not. All ten locales; the parity test is unchanged and passes.server/GJC-LIVE-SPEC.md: new MCP servers section between Tool permissions and Browser backend.Verification
dist-native/bun test server/gjc-mcp-autoload.bun.test.ts— 3 pass (1.8 s).dist-native/bun test server/gjc-sdk-contract.bun.test.ts— 126 pass (the first cut of the pin failed the two delegation tests because children legitimately opt out; scoped byagentId).dist-native/bun test src/components/settings/view/tabs/AutomationSettingsTab.dom.bun.test.tsx— 14 pass.dist-native/bun test server/gjc-agent-tools.bun.test.ts— 13 pass.npm run typecheckand eslint on the touched files: clean.Closes #161.