使用说明
Descon MCP (Prototype)
Local-first MCP server for full Windows desktop automation.
Capabilities
- Window and process control (launch/focus/list/close)
- Deterministic targeting by
window_handle/window_pid/title_regex - Session window binding tools:
desktop_bind_window,desktop_unbind_window,desktop_window_binding_status - Foreground tools:
desktop_get_foreground_window,desktop_focus_guard
- Deterministic targeting by
- Mouse + keyboard automation (including
mouse_down,mouse_up,drag_to) - Fast screen capture
- Template matching + click targeting (OpenCV)
- High-level multi-step orchestration via
desktop_act- Failure hooks: auto rollback hint + clean transaction abort on step failure
- Typed step validation and structured error codes for planner-friendly recovery
- UIA-first element actions in
desktop_actwith fallback:click_element/element_click-> UIA -> template -> OCR texttype_element/element_type-> UIA typing -> fallback click + type- Bound-window aware targeting when step omits explicit window fields
- Foreground guard policy per mutating step (
require_foreground_match, mismatch mode, retries)
- Dedicated action primitives:
desktop_element_querydesktop_element_action(invoke/click/type/select/toggle/expand/collapse/set_value/scroll)desktop_wait_fordesktop_assert
- Intent compiler:
desktop_plan_compile(intent list -> deterministicdesktop_actplan, with profile policy)- Supports transaction wrapping and automatic checkpoint insertion
- Transaction and recovery tools:
desktop_transaction_start|status|checkpoint|rollback_hint|end|export
- Observation and diagnostics:
desktop_observe(windows + cursor + transaction + optional screenshot/OCR preview)desktop_diagnose_permissions(host/target privilege diagnostics + UIPI hints)
- Recorder and replay:
desktop_recording_start|stop|status|get|clear|save|load|replay
- Deterministic plan tooling:
desktop_recording_plandesktop_plan_normalizedesktop_plan_diffdesktop_plan_loaddesktop_plan_save
- Hybrid OCR text extraction:
local_model(RapidOCR ONNX local runtime)tesseract(fallback)auto(local_model -> tesseract)auto_with_host/host_model(explicit opt-in only)
- Safety controls (allowlist, kill switch, run limits)
Run
cd C:\Users\obeng\Project_Descon_MCP\prototype\descon_mcp
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e .[ocr,vision]
descon-mcp
Quality Gates
cd C:\Users\obeng\Project_Descon_MCP\prototype\descon_mcp
.\.venv\Scripts\python.exe -m pip install -e .[dev]
.\.venv\Scripts\python.exe -m pip install -r requirements-release.txt
.\.venv\Scripts\python.exe scripts\release_gate.py
The gate runs compileall, pytest, scripts/production_smoke.py, scripts/basic_reliable_benchmark.py, and scripts/package_release.py, then writes an audit report under artifacts/release_gate/.
Reliability Eval Harness
cd C:\Users\obeng\Project_Descon_MCP\prototype\descon_mcp
.\.venv\Scripts\python.exe scripts\reliability_eval.py --preset core --repeats 20
This writes scenario-level reliability metrics (pass rate, p95 latency, flakiness, MTTR attempts, error-code histogram) to artifacts/reliability_eval/.
Live desktop preset:
.\.venv\Scripts\python.exe scripts\reliability_eval.py --preset live_desktop --repeats 5
Optional baseline comparison:
.\.venv\Scripts\python.exe scripts\reliability_eval.py --baseline .\artifacts\reliability_eval\reliability_eval_latest.json
Optional strict release gate integration:
$env:DESCON_STRICT_RELIABILITY_GATE = '1'
$env:DESCON_RELIABILITY_PRESET = 'core' # or live_desktop
$env:DESCON_RELIABILITY_REPEATS = '10'
$env:DESCON_STRICT_SOAK_GATE = '1'
$env:DESCON_SOAK_DURATION_SECONDS = '120'
$env:DESCON_SOAK_WORKERS = '3'
$env:DESCON_SOAK_MIN_PASS_RATE = '0.99'
$env:DESCON_SOAK_MIN_RUNS_PER_WORKER = '1'
.\.venv\Scripts\python.exe scripts\release_gate.py
Standalone soak runner:
.\.venv\Scripts\python.exe scripts\soak_sessions.py --duration-seconds 120 --workers 3 --preset core --min-pass-rate 0.99 --min-runs-per-worker 1
This writes multi-session soak reports to artifacts/soak/.
Safety Env Vars
DESCON_ALLOWLISTcomma-separated executable names allowed for launch/closeDESCON_REQUIRE_ALLOWLISTenforce allowlist for process actions (defaultfalse)DESCON_ALLOWLIST_HARD_ENFORCEhard-block disallowed process launch/close when allowlist is enabled (defaultfalse)DESCON_MAX_ACTIONSmax actions per session (0disables limit; default0)DESCON_AUTO_START_SESSIONauto-start session on first tool call (defaulttrue)desktop_emergency_stopis a hard stop until manually cleared viadesktop_emergency_stop(enabled=false)DESCON_INPUT_FAILSAFEPyAutoGUI corner failsafe (defaultfalse)DESCON_ENABLE_HOST_OCRsettrueto allow host-model OCR pathsDESCON_WINDOW_RESOLVE_FALLBACK_FOREGROUNDfallback to current foreground when explicit window target is unresolved (defaulttrue)DESCON_STRICT_WINDOW_VISIBILITYfail when target remains invisible after revive attempts (defaultfalse)DESCON_STRICT_PRIVILEGE_CHECKfail on elevation mismatch (defaultfalse)DESCON_ALLOW_UNKNOWN_ACTIONSmap unknowndesktop_actactions to no-op warnings (defaulttrue)DESCON_BEST_EFFORT_VISIONreturn non-fatal template miss results where possible (defaulttrue)DESCON_BEST_EFFORT_OCRreturn non-fatal empty OCR results where possible (defaulttrue)DESCON_ARTIFACTS_DIRabsolute/relative directory for screenshots, recordings, plans, transactions, smoke reportsdesktop_actruntime loop controls:runtime_profile:basic_reliable|strict|balanced|unrestrictedruntime_options: override budgets/guards (max_steps,max_runtime_ms,default_retries,observe_before_risky,safe_mode,allow_unknown_actions)
See docs/execution_contract.md, docs/runtime_profiles.md, and docs/session_model.md for contract, profile, and session semantics.
DESCON_ENABLE_ACTIVITY_GLOWshow edge glow while session is active (trueby default)DESCON_ACTIVITY_GLOW_COLORhex color for edge glow (default#00ff88)DESCON_ACTIVITY_GLOW_THICKNESSedge thickness in pixels (default14)
Notes
- OCR requires Tesseract binary installed and available in PATH.
- Host-model OCR is disabled by default and requires both
DESCON_ENABLE_HOST_OCR=trueand MCP sampling support. - This prototype is local-only and does not require cloud services.
- Process close by name uses exact executable-name matching (no substring termination).
- App launch defaults to structured non-shell execution (
shell_mode=false).
Quick Replay Flow
desktop_session_startdesktop_recording_start- Run normal actions (
desktop_click,desktop_type,desktop_act, etc.) desktop_recording_stopdesktop_recording_replay
Compile Flow
- Build high-level
intents(e.g.focus_window,click_element,type_element,wait_for,assert) - Call
desktop_plan_compilewith profilefast|balanced|stubborn- Optional:
wrap_in_transaction=true,auto_checkpoints=major|all|none
- Optional:
- Execute returned
planusingdesktop_actdesktop_actsupportson_error_generate_rollback_hint,on_error_end_transaction,on_error_max_hints
Production Packaging
cd C:\Users\obeng\Project_Descon_MCP\prototype\descon_mcp
.\.venv\Scripts\python.exe scripts\package_release.py
This produces wheel/sdist in dist/ and checksum manifest files in artifacts/release/.
See docs/deployment.md for deployment runbook details.
Security Gate
scripts/security_gate.pyrunspip-auditand writesartifacts/security/security_gate_latest.json.- Set
DESCON_STRICT_SECURITY_GATE=1to make security findings blockscripts/release_gate.py. - Set
DESCON_STRICT_SOAK_GATE=1to require multi-session soak pass inscripts/release_gate.py.
Use security-ignore.txt to track explicit vulnerability exceptions (one ID per line) with documented rationale.