Feature: MCP 远程控制(remote_open/close/keyboard/mouse/clipboard) #4
Reference in New Issue
Block a user
Delete Branch "feature/mcp-remote-control"
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?
概述
实现 docs/Mcp_RemoteControl_Design.md 的 MCP 远程控制(里程碑 M1–M4)。M5 remote_focus_window 按设计「可后置 / 二选一即可跑通」条款推迟,聚焦用 remote_mouse click 替代。
新增 MCP 工具
安全模型(可控、可审、可关)
实现要点
测试
Add M1 of MCP remote control (docs/Mcp_RemoteControl_Design.md): the remote_open / remote_close tools plus the ScreenCtrlSession state machine. remote_open establishes a hidden screen sub-connection by reusing WebService::StartRemoteDesktop (COMMAND_SCREEN_SPY -> CScreenSpyDlg -> RegisterScreenContext), polls for the sub-connection plus its physical resolution (TOKEN_BITMAPINFO -> NotifyResolutionChange -> GetScreenSize), then records the session (single device, single session, reverse-mapped subCtx for OfflineProc cleanup) and returns {session_id, screen_w, screen_h}. remote_close validates session_id and tears down the sub-connection idempotently. A McpRemoteControl settings checkbox (default off, requires McpReadonly=0) gates the tools; every open/close is audited via WM_SHOWERRORMSG. Gating: multi-monitor hosts are rejected with -32008 (phase 1 supports only single monitor, where Observe=main screen and Act=virtual desktop coincide); the monitor count comes from the client heartbeat RES_RESOLUTION ("N:W*H"). Known limitations (deferred to the injection milestones): mutual exclusion with human remote-desktop viewing is one-directional in M1 (a human who joins during an MCP session can tear it down on disconnect), and subCtx is not yet dereferenced so no liveness re-check is needed until remote_mouse/remote_keyboard. Co-Authored-By: deepseek-v4-pro