feat(mcp): expose selected environment preferences#10560

merged2
agents/mcp-thin/preview
agents/mcp-thin/preferences
openedSep 7, 2026byJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 3d ago

Part 10/16 of the shared-core and MCP stack. Based on #10559. Next: #10561.

Expose server identity and selected preferences, and update that allowlist through ServerSettingsService so ordinary persistence and client notifications are reused.

Updates require a live full-access/default caller under the existing ThreadCommandExecutor. Provider configuration, secrets and admin controls are not exposed. No new settings store or lock service.

MCP-only rebuild of #8726, #8728, preserving attribution to Julius Marminge's original work. Original branches remain available for separate service follow-ups.

Validation: The composed stack passes 94 tests across 12 focused files, including shared core MCP and real MCP/V2 integration, attachment intake, project RPC/service contracts, and client model command selection. Server/contracts/shared/client-runtime typechecks and targeted format/lint/diff checks pass. New behavior coverage lives with the shared operation; no per-tool mock suite was added. Current-head CI is shown below.

Layer size: 7 files, +185/-1. No domain-service production implementation or documentation files change in this MCP layer.

Prepared with Codex in the OpenAI agent runtime.

Synced from GitHub

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for d971e17.

This comment will update automatically after the next completed run.

Synced from GitHub

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds and registers production MCP tools, including a write operation that persists environment-wide preferences and notifies connected clients, affecting subsequent server behavior. The capability is bounded and tested, but its new cross-component workflow and externally observable settings mutation warrant human review.

No code changes detected at d971e17. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

apps/server/src/mcp/toolkits/environment/handlers.tslines 43–78Outdated · fcfc8f3Open thread
……@@ -0,0 +1,79 @@
75+ );
76+ }),
77+ );
78+ }),
MmacroscopeappBoton lines 43–78Sep 7, 2026

This new handler layer introduces real backend behavior that no test exercises: the cross-environment capability_denied guard in access, the live full-access/default caller guard, and the 4,000-character customInstructions truncation plus truncated flag in preferences. core.test.ts and the adapter test only assert tool names/schemas.

Consider adding a focused environment/handlers.test.ts that builds EnvironmentHandlersLive over test layers for the external services only (ServerSettingsService.layerTest, a stub ServerEnvironment descriptor, and the MCP invocation context), asserting the denied paths and the truncation boundary rather than mocking the handler logic itself.

Posted via Macroscope — Effect Service Conventions

Added shared core projection coverage in fe7137d675f513720df0499b5ff566f4ef40c7d5: the actual preference mapper omits provider/private fields and truncates 4,001 emoji to 4,000 without breaking code points. Core tests pass 4/4 here, and the composed core/integration batch is 6/6. Caller scope remains in the shared helper; the writable check stays under the existing ThreadCommandExecutor through updateSettings. The maintainer requested shared MCP tests and existing service tests instead of a dedicated handler suite per tool, so persistence/notification tests remain with ServerSettingsService.

The shared projection test resolves the truncation/allowlisting portion. However, I still don’t see coverage for the cross-environment capability_denied path or the full-access/default caller guard, so the original concern is only partially addressed.

Synced from GitHub

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

Added 2 commits

  • feat(mcp): expose selected environment preferencesa36adcd
  • test(mcp): cover bounded preference output in core testsd971e17