Repository navigation
fork: MCP profile builtinTools "none" (assistant PR 1) - #927
scuttletoby wants to merge 3 commits into
Conversation
An MCP profile may say `builtinTools: "none"`: the thread gets only MCP tools, no shell, file or web tools. Claude applies it (tools: [], every built-in disallowed, a PreToolUse guard refuses any non-MCP call, and a changed set opens a fresh process). Every other driver cannot apply it, so its turns are refused (fail closed), also a turn Codex starts itself. A child keeps it from its parent; a delegated task carries it; an older T3 refuses a profile or carried task with the field. Off by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
lens: code · reviewer: lens agent (Opus 5.5) · read at: 1aa830b |
|
lens: state · reviewer: opus high (state lens agent) · read at: 1aa830b |
- claudeMcpProfile.ts: the PreToolUse guard denies a tool name that is not
a string and any error while it checks (a hook that throws counts as a
non-blocking error and would let the call through).
- New mcpProfileWiderParts (contracts resolver): what a wider profile keeps
that the narrower one does not ("MCP servers", "T3 tools", "built-in
tools"). The launch, fork and scheduled-task refusals use it instead of
always saying "MCP servers or T3 tools", so a refusal caused only by
builtinTools says "built-in tools".
- README: builtinTools removes only the provider's own tools (restrict
t3Tools and servers too for a really tool-less thread); a Codex goal turn
is stopped only soon after it starts; an older machine that takes
delegated tasks accepts the task, then refuses its turn (a thread that
does nothing, never one with more tools).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
lens: code r2 · reviewer: lens agent (Opus 5.5 high) · read at: 7a15bda |
Assistant PR 1 of 18.
What
An MCP profile may now say
"builtinTools": "none"(optional field). A thread with such a profile gets only MCP tools (T3's own, plus the outside servers itsserverskeeps): no shell, file, web or other built-in tool. It is the base the assistant runs on: it can read the owner's data through MCP tools without changing files.claudeMcpProfile.ts): the query opens withtools: [], every built-in the SDK names indisallowedTools, and a PreToolUse guard that refuses any tool whose name is notmcp__…, with the reason. The guard fails closed: a tool name that is not a string, or any error while it checks, is refused (a hook that throws would count as a non-blocking error and let the call through). The plan key includes the field, so a thread switched to it opens a fresh Claude process instead of reusing one that still has its tools. Withtools: []Claude turns tool search off and lists MCP tools directly, so T3's tools stay callable.mcpProfileTurnCheck.tsrefuses the turn (start, resume, compaction) on Codex and every other wrapped driver, andcodexMcpProfile.tsalso stops a turn Codex starts by itself for a goal (soon after that turn starts, so its first tool calls may already run; the README says so).packages/contracts): a child keepsnonefrom its parent (never wider),isEveryMcpToolandisWithinMcpProfilecount it, so launch, local and remote delegation and scheduled tasks treat it as narrower thanall. Their refusals name what the wider thread really keeps (newmcpProfileWiderParts: "MCP servers", "T3 tools" and/or "built-in tools"), instead of always "MCP servers or T3 tools". A delegated task carries it to the other machine. Any other value makes the profile broken, and a broken profile is refused.docs/fork/README.md, sectionserver.mcpProfiles. It says thatbuiltinToolsremoves only the provider's own tools: for a really tool-less thread, also restrictt3Tools(leave outorchestration,playtest,worktree,previewand other groups that act) andservers.Why
The assistant design (row 1 of its PR split): the assistant should run with MCP tools only, and a turn must be refused wherever that cannot be enforced, never run with more tools. Off by default: no profile uses it unless the owner sets it.
Tests (the new-behaviour tests fail without the change; the old-profile and bad-value tests pin behaviour that must not change)
claudeMcpProfile.adapter.test.ts: a thread switched to the profile opens a new Claude process withtools: []and the built-ins disallowed; the guard deniesBashand allowsmcp__…; the guard denies a tool name that isundefined, a number,nullor an object, and an input that throws when read (fails closed).launchMcpProfile.test.ts: a launcher withbuiltinTools: "none"launching into a project onallis refused with "keeps built-in tools", not "MCP servers"; adocslauncher's refusal says "keeps MCP servers".scheduleForkMcpProfile.test.ts: the schedule and fork refusals say "keeps built-in tools" when only that is wider; an existing expectation now reads "keeps MCP servers".scheduledTaskMcpProfile.test.ts: two existing expectations now read "keeps MCP servers" (the real reason there).mcpProfileTurnCheck.test.ts: Claude runs; Codex and OpenCode refuse start and resume, and no call reaches them.codexMcpProfile.test.ts: a direct turn is refused, and a turn Codex starts for a goal is interrupted with the reason.mcpProfile.test.ts(server): an old profile without the field resolves as before; a child keepsnone; the carried round trip; bad values are refused for both a profile and a carried task.packages/contracts/src/mcpProfile.test.ts: the settings patch takesnone/alland refuses others;mcpProfileWiderPartsnames each combination.mcpProfileSettings.logic.test.ts: an edit keeps the field and the server takes the save; other profiles save without it.State question
settings.jsonthat cannot be read refuses the turn (neverallon a guess); when only a provider secret cannot be read, the profiles come fromsettings.jsonalone, sobuiltinToolsstill applies. A badbuiltinToolsvalue marks the profile broken, so its threads are refused, never given the tools.Limits (in the docs): this is not a sandbox. A Claude setting that turns hooks off, or launch arguments that add tools, can weaken it on a machine set up that way.
Upstream fit
It builds only on the fork's existing MCP-profile code (merged parts 1–5): the same resolver, the same Claude plan seam (
mcpProfileOptionsspread after the adapter's own options), and the same turn check other drivers already pass through. No upstream file changes beyond the existing pinned seams (seam check passes);ClaudeAdapterV2.tsis untouched.General vs project
All general: a profile field any T3 user can set, no project facts. Nothing project-specific is in this PR.
Checks
packages/contracts,apps/serverandapps/webtypecheck: 0 errorslaunchMcpProfile.test.ts,scheduleForkMcpProfile.test.ts,scheduledTaskMcpProfile.test.ts). Run: server 7 files 230 passed, contractsmcpProfile.test.ts42 passed, webmcpProfileSettings.logic.test.ts11 passed. WithclaudeMcpProfile.ts,launchMcpProfile.tsandscheduledTaskMcpProfile.tsput back to the old head: 6 tests fail (the fail-closed guard test, the three built-in-tools / "MCP servers" message tests, and the scheduled-task message expectations). Server and contracts typecheck 0 errors;vp fmt --checkandvp linton the 11 touched files clean; pre-commit (fmt, lint, knip) pass; seam check exit 0.origin/mainand the new tests kept: 7 failed (each new builtinTools test except the ones that pin old behaviour: an old profile without the field, and bad values refused).node .github/scripts/fork-seam-check.cjs --config-ref origin/main origin/main HEAD: exit 0vp fmt --checkon touched files: clean;vp lintandknip(pre-commit): clean🤖 Generated with Claude Code