Skip to content

fix(settings): say that user-scope MCP servers load, and pin the scope contract - #170

Merged
devswha merged 2 commits into
mainfrom
fix/mcp-user-scope-contract
Sep 17, 2026
Merged

devswha merged 2 commits into
mainfrom
fix/mcp-user-scope-contract

Conversation

@devswha

@devswha devswha commented Sep 17, 2026 •

Copy link
Copy Markdown
Owner

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.json for the worker) before the session exists, and surfaces their tools as always-on — past the app's explicit toolNames, with tools.discoveryMode off and mcp.discoveryMode false. The adapter never passes enableMcpAutoload: false for 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 unset mcp.enableProjectConfig as true, so the app's false override 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); under applyGjcToolSettingsPolicy the user-scope tool is active and executable (getToolByName) while the project-scope tool is absent; enableMcpAutoload: false is 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 no enableMcpAutoload and a delegated child (agentId set) has false.
  • server/gjc-bun-sdk-adapter.ts: the applyGjcToolSettingsPolicy comment states the scope contract (code unchanged).
  • Settings > Automation > Withheld runtime features: row renamed to Project MCP servers; the reason now says user-registered servers load as in the CLI and a project's .gjc/mcp.json does 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 by agentId).
  • 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 typecheck and eslint on the touched files: clean.

Closes #161.

…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.
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.
@devswha
devswha merged commit 0fb36f6 into main Sep 17, 2026
6 checks passed
@devswha
devswha deleted the fix/mcp-user-scope-contract branch September 17, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(ux): MCP, tool discovery and ast_edit are hard-disabled in the app with no surfacing

1 participant