Skip to content

feat: add mcp compact mode, per-call headed opt-in, and sandbox state root fallback - #746

Open
PXY000 wants to merge 7 commits into
vercel-labs:mainfrom
PXY000:feat/mcp-compact-mode-and-sandbox-fallback
Open

PXY000 wants to merge 7 commits into
vercel-labs:mainfrom
PXY000:feat/mcp-compact-mode-and-sandbox-fallback

Conversation

@PXY000

@PXY000 PXY000 commented Nov 26, 2026 •

Copy link
Copy Markdown

Summary

Standard MCP clients that enforce total tool limits, lazy-load tool schemas, or prompt for confirmation per tool name (such as Antigravity and Cursor) face high friction with the 75-tool default surface. In addition, coding agents running inside OS sandboxes (such as macOS Seatbelt or read-only $HOME containers) fail on state-root lock creation when AGENT_DESKTOP_HOME is unset.

This PR adds four platform-agnostic opt-in and fallback improvements across macOS, Windows, and Linux while leaving default CLI and agent-desktop mcp behavior unchanged:

  1. Compact 4-tool MCP surface (agent-desktop mcp --compact)

    • Groups the command tree into four logical tools derived dynamically from the existing CLI catalog, refusing unlisted direct leaf tools when --compact is enabled:
      • desktop_observe (readOnlyHint: true): Strictly read-only introspection (snapshot, find, get, is, screenshot, list-*, status, permissions, version, skills *), stripping and rejecting mutating options (output_path, request, guide, headed)
      • desktop_act: Interaction execution (element, keyboard, mouse, clipboard, and notification actions)
      • desktop_window: Environment lifecycle (app launch/close, window management, shell surfaces, wait, and session *)
      • desktop_batch: Sequential multi-command execution
    • Constrains nested args schemas (additionalProperties: false) and rejects duplicate keys passed at both top level and inside args.
  2. Per-call --headed and post-action wait opt-in (agent-desktop mcp --allow-headed)

    • Keeps calls headless by default so semantic actions do not steal focus or move the cursor, while allowing mutating action calls to pass "headed": true when physical delivery is needed as well as "wait_for", "wait_for_gone", and "wait_timeout" on commands that support post-action waits.
  3. Private operator-configured screenshot directory (agent-desktop mcp --screenshot-dir <DIR>)

    • Validates DIR at server startup as an absolute, private (0700), user-owned, non-symlink directory (with no implicit /tmp fallback) and writes omitted-path screenshots with randomized 64-bit nonce filenames (screenshot-<ms>-<nonce>.png).
  4. Sandbox-resilient private state root fallback (crates/core/src/storage/state_root.rs)

    • When AGENT_DESKTOP_HOME is unset and ~/.agent-desktop fails due to a kernel PermissionDenied or ReadOnlyFilesystem OS sandbox restriction (failing closed on existing unsafe paths, ancestor symlinks, or parent traversal), falls back only to an existing private (0700) user-owned runtime directory (XDG_RUNTIME_DIR / TMPDIR on Unix, LOCALAPPDATA validated via PrivateFileOps on Windows), never shared world-writable /tmp. Explicit AGENT_DESKTOP_HOME values never fall back.

Verification

  • bash scripts/check-rust-file-size.sh
  • bash scripts/check-no-phase-references.sh
  • bash scripts/check-architecture.sh
  • cargo fmt --all -- --check
  • cargo clippy --locked -p agent-desktop-core -p agent-desktop-macos -p agent-desktop -p agent-desktop-ffi --all-targets -- -D warnings
  • scripts/cargo-test-isolated-home.sh test --locked -p agent-desktop-core --lib storage::state_root
  • scripts/cargo-test-isolated-home.sh test --locked -p agent-desktop mcp

@vercel

vercel Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

@PXY000 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@vercel-internal-security-reviewer

Copy link
Copy Markdown

Security review details

Comment thread src/mcp/compact.rs Resolved
Comment thread src/mcp/mod.rs Resolved
@PXY000
PXY000 force-pushed the feat/mcp-compact-mode-and-sandbox-fallback branch 2 times, most recently from 4c945d0 to 7eb6f13 Compare November 28, 2026 02:21
Comment thread crates/core/src/storage/state_root.rs Resolved
Comment thread src/mcp/compact.rs Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant