Skip to content

Conversation

@continue
Copy link
Contributor

@continue continue bot commented Dec 26, 2025

Documentation Updates for PR #9327

This PR adds documentation for the new allowHeadless configuration option for MCP servers introduced in #9327.

⚠️ Note: This PR should be merged after #9327 is merged.

Changes

Reference Documentation (reference.mdx)

  • Added allowHeadless property to mcpServers configuration section
  • Added example showing usage with Brave Search MCP server
  • Linked to CLI headless mode documentation for context

MCP Deep Dive (customize/deep-dives/mcp.mdx)

  • Added comprehensive section "How to Use MCP Servers in CLI Headless Mode"
  • Explained security rationale for default behavior
  • Provided usage examples with code snippets
  • Added Mintlify CardGroup component showing good candidates vs. cautionary use cases
  • Included security warning about trusting MCP servers

CLI Overview (cli/overview.mdx)

  • Updated tool permissions Info box to mention MCP tools headless behavior
  • Added link to detailed MCP headless mode documentation

Documentation Approach

The documentation is scoped to explain the feature without changing the overall level of detail in the docs. It:

  • Explains the security model (MCP tools excluded by default in headless mode)
  • Shows how to opt-in specific trusted servers with allowHeadless: true
  • Provides clear guidance on when to use this feature
  • Uses Mintlify components (Note, Warning, CardGroup) for effective information display

Screenshots

Reference Documentation Example

Added allowHeadless property with clear description and usage example:

mcpServers:
  - name: Brave Search
    command: npx
    args:
      - "-y"
      - "@modelcontextprotocol/server-brave-search"
    allowHeadless: true  # Enable in CLI headless mode for automation
MCP Deep Dive Section

Added comprehensive section with:

  • Security explanation in Note component
  • Usage example with Warning about security considerations
  • CardGroup showing appropriate use cases

Related: #9327

This task was co-authored by nate and Continue.


Summary by cubic

Adds an allowHeadless option for MCP servers to safely enable trusted MCP tools in CLI headless mode, and updates docs with clear guidance and examples.

  • New Features
    • Config: allowHeadless boolean on MCP servers (default false).
    • Runtime: only include MCP tools in headless mode when allowHeadless is true; otherwise excluded.
    • Enforcement: upgrades "ask" to allow in headless for MCP tools when allowHeadless=true; never overrides explicit "exclude".
    • Tests: coverage for headless inclusion/exclusion and policy behavior.
    • Docs: updated reference, MCP deep dive, and CLI overview with examples and security considerations.

Written for commit 2cfb204. Summary will update automatically on new commits.

aaronlippold and others added 2 commits December 25, 2025 22:47
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)
- Add 8 tests covering enumeration and execution permission

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]>
… mode

- Add allowHeadless property to mcpServers reference documentation
- Add comprehensive section in MCP deep dive explaining headless mode behavior
- Update CLI overview to mention MCP tools headless mode exclusion
- Include examples and security considerations for allowHeadless usage

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <[email protected]>
Co-authored-by: nate <[email protected]>
@continue continue bot requested a review from a team as a code owner December 26, 2025 15:29
@continue continue bot requested review from sestinj and removed request for a team December 26, 2025 15:29
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 26, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 10 files

…ned in tests

Issue 1 (P1): allowMcpInHeadless now only upgrades 'ask' permissions, not 'exclude'
- Modified logic to check result.permission === 'ask' before applying allowHeadless
- This prevents allowHeadless from bypassing explicit tool exclusions
- Added test case to verify excluded tools remain excluded

Issue 2 (P2): Test helper now preserves undefined allowHeadless values
- Changed from 'allowHeadless ?? false' to conditional property spread
- This allows tests to properly verify undefined behavior vs explicit false

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <[email protected]>
Co-authored-by: nate <[email protected]>
@continue
Copy link
Contributor Author

continue bot commented Dec 26, 2025

✅ Code Review Issues Fixed

I've addressed both P1 and P2 issues identified by the review:

Issue 1 (P1): Security Fix - Respect Explicit Exclusions

Problem: allowHeadless could bypass explicit tool exclusions in permissions.

Fix: Modified the logic so allowHeadless only upgrades "ask" permissions to automatic approval, not override "exclude" permissions.

// Before: Could bypass exclusions
const allowMcpInHeadless =
  !tool.isBuiltIn && isHeadless && tool.allowHeadless;

// After: Only upgrades "ask" permissions
const allowMcpInHeadless =
  result.permission === "ask" &&
  !tool.isBuiltIn &&
  isHeadless &&
  tool.allowHeadless;

Added test case to verify excluded tools remain excluded even with allowHeadless: true.

Issue 2 (P2): Test Accuracy - Preserve Undefined Values

Problem: Test helper coerced undefined to false, so the test didn't properly verify undefined behavior.

Fix: Changed from ?? false coercion to conditional property spread to preserve actual undefined values.

// Before: Coerced undefined to false
allowHeadless: allowHeadless ?? false,

// After: Preserves undefined
...(allowHeadless !== undefined ? { allowHeadless } : {}),

Both fixes maintain the security-first design while ensuring proper test coverage.


Commit: 2cfb204

continue-development-app bot pushed a commit that referenced this pull request Dec 26, 2025
- Add edge case tests for disconnected servers, empty connections, and empty tools
- Add permission policy interaction tests with wildcards and argumentMatches
- Add integration tests for mixed built-in and MCP tools
- Add test for built-in tools behavior in headless mode
- Add tool ordering and mode transition tests

Improves test coverage for PR #9328 with 12 new test cases covering:
- Error handling and graceful degradation
- Complex permission policy scenarios
- Real-world integration scenarios
- Security boundary validation

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <[email protected]>
Co-authored-by: peter-parker <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants