AI Agent Client 快速開始
請先依照 5 分鐘快速開始 安裝 WPF DevTools,再把 installed executable 註冊到偏好的 MCP client。本頁只比較 client registration path。
Installed executable
請以 generated client-registration artifact 作為真源。Executable 通常是:
<InstallRoot>\<arch>\current\bin\wpf-devtools-<arch>.exe
支援 client
| Client | Registration style | Guide |
|---|---|---|
| Claude Code | Installer 產生的 CLI command | Claude Code |
| OpenAI Codex / Codex CLI | Installer 產生的 CLI command | OpenAI Codex 與 Codex CLI |
| Grok Build CLI | Installer 產生的 CLI command | 使用 <InstallRoot>\<arch>\client-registration\grok.txt |
| Claude Desktop | Installer 產生的 JSON config | Claude Desktop |
| Cursor | Installer 產生的 mcpServers JSON |
Cursor、VS Code 與 Visual Studio |
| VS Code | Installer 產生的 servers JSON |
Cursor、VS Code 與 Visual Studio |
| Visual Studio | Installer 產生的 servers JSON |
Cursor、VS Code 與 Visual Studio |
| Other | Artifact-only JSON | 使用 <InstallRoot>\<arch>\client-registration\other.mcpServers.json |
使用 -Client other -OutputJson 時,install result 也會包含 composerPolicyProfile。其中的 requiredEnvironment map 會列出 apply_ui_blueprint 所需的最小 project-write 與 destructive gates;freshServerProcessRequired=true 則提醒自動化流程在設定完成後啟動新的 scoped server。
每次成功安裝搭配 -OutputJson 都會回傳 compact serverCommand object。請使用其中的 exact executable 與空的 arguments array,以 transport="stdio" 啟動所選 installed server;client、architecture 與 installRoot 會識別 resolved installation。policyTemplate 提供 first-run fields:WPFDEVTOOLS_MCP_ALLOWED_TARGETS、WPFDEVTOOLS_INJECTION_ALLOWED_TARGETS 與 WPFDEVTOOLS_MCP_ALLOW_SENSITIVE_READS。請把 target placeholders 換成 reviewed app path、不需要 raw injection 時省略該 opt-in,並在 freshServerProcessRequired=true 時啟動 fresh process。此 object 不包含 secrets,也刻意不提供 auth 或 certificate configuration。
第一次 verification flow
第一次連線前,請把 reviewed target path 同時用於 connection 與 raw-injection fallback,並為第一次 scene summary 啟用 sensitive reads:
$target = 'C:\Path\To\YourApp.exe'
$env:WPFDEVTOOLS_MCP_ALLOWED_TARGETS = $target
$env:WPFDEVTOOLS_INJECTION_ALLOWED_TARGETS = $target
$env:WPFDEVTOOLS_MCP_ALLOW_SENSITIVE_READS = 'true'
connectget_active_processget_ui_summary(depthMode: "semantic")navigation.recommended建議的 focused diagnostic tool
請優先使用 scene-level summary,再考慮 visual-tree dump 或 screenshot。
需要更深工具時的 gates
第一次 session 先保持範圍小;後續只啟用下一個已核准 tool 需要的 gate:
WPFDEVTOOLS_MCP_ALLOW_SCREENSHOTS=true用於element_screenshot。WPFDEVTOOLS_MCP_ALLOW_VIEWMODEL_INSPECTION=true用於get_viewmodel、command metadata,以及 snapshot 或batch_mutate內的 ViewModel scopes。WPFDEVTOOLS_MCP_ALLOW_DESTRUCTIVE_TOOLS=true用於capture_state_snapshot、batch_mutate、interaction、event drain 與 restore workflows。
在 mutation 或有順序的 batch_mutate 前,先呼叫 capture_state_snapshot,再檢查 get_state_diff,並在 workflow 需要 rollback 時 restore。