-
Notifications
You must be signed in to change notification settings - Fork 3.9k
feat(cli): add allowHeadless option for MCP servers in headless mode #9327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
1 similar comment
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 7 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="extensions/cli/src/stream/mcp-headless.test.ts">
<violation number="1" location="extensions/cli/src/stream/mcp-headless.test.ts:238">
P2: Test claims to test `allowHeadless=undefined` but actually tests `allowHeadless=false` due to `?? false` coercion in the helper. To properly test undefined behavior, preserve the undefined value instead of defaulting to false.</violation>
</file>
<file name="extensions/cli/src/stream/handleToolCalls.ts">
<violation number="1" location="extensions/cli/src/stream/handleToolCalls.ts:206">
P1: The `allowMcpInHeadless` check doesn't respect explicit `"exclude"` permissions. If a tool is explicitly excluded in permissions but has `allowHeadless: true`, it will bypass the exclusion and be allowed in headless mode. The `allowHeadless` flag should only upgrade `"ask"` permissions to automatic approval, not override explicit exclusions.</violation>
</file>
Reply to cubic to teach it or ask questions. Tag @cubic-dev-ai to re-run a review.
📚 Documentation Updates AvailableI've created documentation updates for this feature in a separate branch: Changes OverviewReference Documentation (
MCP Deep Dive (
CLI Overview (
Next StepsYou can:
The documentation changes are scoped to explain the feature without adding unnecessary detail, using Mintlify components for effective information display. View the commit: 8aff77c |
📚 Documentation PR CreatedI've created PR #9328 with documentation updates for the The PR adds comprehensive documentation covering:
The documentation PR is ready to merge once this PR is merged. Preview: #9328 |
Adds `allowHeadless: true` config option for MCP servers, enabling
specific MCP tools to work in headless mode without requiring --auto flag.
Changes:
- Add allowHeadless to MCP config schema
- Pass allowHeadless from connection config to Tool objects
- Check allowHeadless in tool enumeration (getRequestTools)
- Check allowHeadless in execution permission (checkToolPermissionApproval)
- Respect explicit "exclude" permissions (allowHeadless cannot override)
- Add 9 tests covering enumeration, execution, and security scenarios
Usage:
```yaml
mcpServers:
- name: Brave Search
command: npx
args: ["-y", "@modelcontextprotocol/server-brave-search"]
allowHeadless: true # Enable in headless mode
```
Authored by: Aaron Lippold<[email protected]>
f6cd721 to
a054c6d
Compare
Mock core/util/paths.js to read CONTINUE_GLOBAL_DIR dynamically instead of caching it at module load time. This fixes test isolation issues where tests running in parallel would share the same GlobalContext file path. Root cause: The CONTINUE_GLOBAL_DIR constant in core/util/paths.ts is computed via an IIFE at module load time. When tests set different temp directories in beforeEach, the module had already cached the original value. Solution: Mock getContinueGlobalPath, getIndexFolderPath, and getGlobalContextFilePath to read process.env.CONTINUE_GLOBAL_DIR on each call, allowing proper test isolation. Also adds interopDefault to vitest config for better CommonJS handling. Authored by: Aaron Lippold<[email protected]>
a054c6d to
4db8aa8
Compare
Review Comments AddressedBoth AI review comments have been resolved: P1 (Security) -
|

Description
Adds
allowHeadless: trueconfig option for MCP servers, enabling specific MCP tools to work in headless mode without requiring the--autoflag.Problem: MCP tools are unavailable in headless mode, limiting automation scenarios where users want specific trusted MCP servers to work while still requiring approval for other tools.
Solution: Per-server
allowHeadlessoption that allows enumeration and execution of tools from that server in headless mode.Usage:
Changes
Commit 1: Feature (
4062ff6)allowHeadlessto MCP config schema (packages/config-yaml)allowHeadlessfrom connection config to Tool objectsallowHeadlessin tool enumeration (getRequestTools)allowHeadlessin execution permission (checkToolPermissionApproval)allowHeadlessrespects explicit "exclude" permissions (won't override user denials)mcp-headless.test.tsCommit 2: Test Isolation Fix (
4db8aa8)core/util/paths.jsto readCONTINUE_GLOBAL_DIRdynamicallyGlobalContextsingleton would leak state between parallel test filesinteropDefault: trueto vitest config for better CommonJS handlingAI Code Review
@continue-reviewChecklist
Screen recording or screenshot
N/A - This is a CLI/config change with no UI impact.
Tests
Added 9 unit tests in
extensions/cli/src/stream/mcp-headless.test.ts:Tool enumeration tests (4):
allowHeadless=truein headless modeallowHeadlessallowHeadlesssettingsExecution permission tests (5):
allowHeadless=truein headless modeallowHeadlessin headless modeallowHeadless=undefinedin headless modeallowHeadlessallowHeadless=true(security test)All existing tests continue to pass (1715 unit tests, 66 e2e tests).