Add Option-C tool-isolation knobs: strict MCP config, mcp-config path, setting sources, DontAsk permission mode #46
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/claude-code-query#46
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Consumer:
iterative-works/procedures, issue PROC-401 (ADR 0001 Step 2 — split event processing into isolated Claude CLI sessions). We need to spawn event-processor subprocesses with a hard tool allow-list that cannot be widened by parent.mcp.jsonfiles, user-level settings, or permission prompts.Per the Claude Code CLI docs, the full "Option C" isolation requires four CLI flags that
claude-code-querydoes not currently expose throughQueryOptions/SessionOptions/PermissionMode/CLIArgumentBuilder:--strict-mcp-config.mcp.jsonother than the one we pass.--mcp-config <path>.mcp.json(don't rely on cwd lookup).--setting-sources <csv>project— excludes user/managed).--permission-mode dontAskallowedToolsas a hard allow-list (no prompts, no hangs).Without all four, an isolated subprocess can either (a) inherit the user's
.mcp.json/~/.claude/settings.json, or (b) hang on a permission prompt for a tool not inallowedTools. Neither is acceptable for the event-processor use case.Proposed additions
1.
QueryOptions(and symmetrically,SessionOptions)Add three fields with matching fluent
with*helpers:strictMcpConfig: Boolean = false+withStrictMcpConfig(flag: Boolean)mcpConfigPath: Option[String] = None+withMcpConfigPath(path: String)settingSources: List[String] = Nil+withSettingSources(sources: List[String])Defaults preserve current behaviour (no flag emitted).
2.
PermissionModeenumAdd one case alongside the existing
Default / AcceptEdits / BypassPermissions:3.
CLIArgumentBuilderBoth match sites (around lines 50 and 113 today — the
queryandsessionarg builders) need:PermissionMode.DontAskemittingList("--permission-mode", "dontAsk").strictMcpConfig == true→List("--strict-mcp-config").mcpConfigPath.foreach→List("--mcp-config", path).settingSourcesnon-empty →List("--setting-sources", sources.mkString(",")).Empty/false defaults must NOT emit any flag (preserves backwards compatibility).
Tests
CLIArgumentBuilderTest— one case per new field (emitted when set, absent when default) plus the newPermissionModebranch.SessionOptionsArgsTest/QueryOptionsArgsTest— symmetric coverage.QueryOptions().withStrictMcpConfig(true).withMcpConfigPath("./.mcp.json").withSettingSources(List("project")).withPermissionMode(PermissionMode.DontAsk)round-trips to argv containing all four flags in deterministic order.Non-goals
PermissionModealiasing or deprecation.Delivery
0.3.0-SNAPSHOTon a feature branch; consumer (PROC-401) bumps its Maven coord to the snapshot and validates.v0.3.0tag is cut later, after the additions are exercised in real PROC-401 use and any follow-up fixes settle.Upstream reference
dontAsk+--strict-mcp-config+--setting-sources projectis the minimum set for non-interactive isolation.