The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the WPFVisualTreeMcp listing page.
Let AI agents see, debug and drive running WPF apps. Snoop + Playwright for AI, exposed over the Model Context Protocol — visual tree, data bindings, screenshots, clicks, text input and keyboard, against any running WPF process, no source changes needed.

An AI agent queries controls by visible text, fills the form, selects a list item, clicks Submit — then explains why the Status box stayed empty by pulling the app's binding errors. Every step is one MCP tool call (or CLI command).
.mcp.json:
Prefer the terminal? The same exe is a full CLI: WpfVisualTreeMcp.Server.exe help.
WpfVisualTreeMcp is a Model Context Protocol (MCP) server that allows AI coding agents (Claude Code, Cursor, GitHub Copilot) to inspect and interact with running WPF applications. Think of it as giving your AI assistant the same capabilities as tools like Snoop WPF or Visual Studio's Live Visual Tree.
Debugging WPF UI issues traditionally requires manual inspection with specialized tools. This project bridges that gap by exposing WPF inspection capabilities through MCP, enabling AI agents to:
Invoke/Toggle/Select/ExpandCollapse) or a real OS mouse clickIValueProvider.SetValue, with a TextBox.Text / PasswordBox.Password / reflected-Text fallback, or physical=true to type via OS keyboard input (full Unicode BMP)Ctrl+S, Alt+F4, F5, Enter, Ctrl+Shift+F, ...) to an element or the focused window via OS keyboard inputWpfInjectorHelper.exeThe same WpfVisualTreeMcp.Server.exe runs as either an MCP stdio server
(no arguments, default) or as a one-shot CLI (any recognised subcommand).
Useful when the MCP server isn't connected, for scripting, and for verifying
the pipeline manually. Run WpfVisualTreeMcp.Server.exe help for the full
command list. Output is JSON on stdout; diagnostics go to stderr.
vs. the general tool categories:
| WpfVisualTreeMcp | Snoop | FlaUI / WinAppDriver | Generic computer-use (screenshot + mouse) | |
|---|---|---|---|---|
| Consumer | AI agents (MCP) + humans (CLI) | Humans (GUI) | Test code (C#) | AI agents |
| Visual tree, dependency properties | ✅ | ✅ | ❌ (UIA view only) | ❌ |
| Data bindings, binding errors, DataContext | ✅ | ✅ | ❌ | ❌ |
| Find controls by visible text / properties | ✅ | manual | partial (UIA) | pixel guessing |
| Click / type / select / shortcuts | ✅ | ❌ | ✅ | ✅ (blind) |
| Wait for UI conditions (no sleep loops) | ✅ | ❌ | ✅ | ❌ |
| Element screenshots + popup-aware screen capture | ✅ | ❌ | partial | full screen only |
| Works without target source changes | ✅ (auto-injection) | ✅ | ✅ | ✅ |
vs. other WPF MCP servers. Most WPF MCP servers are built on UI Automation (FlaUI): they read the accessibility tree, and can only reach WPF internals — bindings, DataContext, ViewModel state — if you install their in-process probe into the app you want to inspect. This server takes the Snoop route instead: it injects at runtime, so it reads the real visual tree and diagnoses binding errors and DataContext with zero changes to the target app — nothing to add to your build, nothing to ship into production.
| WpfVisualTreeMcp | UIA-based servers (FlaUI) | Other injection-based servers | |
|---|---|---|---|
| Sees the real visual tree (not just the UIA view) | ✅ injection | ❌ accessibility tree | ✅ |
| Binding errors + DataContext without a probe in the target | ✅ | ❌ (needs in-process probe) | partial |
| Interaction surface | click (UIA + physical, double/right), set-text w/ read-back, send-keys, select-item (virtualized) | click / type / select | usually invoke-only |
| Wait for element conditions | ✅ wpf_wait_for | ✅ | ❌ |
| Popup / dropdown / context-menu screenshots | ✅ screen mode | partial | screenshot only |
| Cross-architecture injection (x64 ⇄ x86) | ✅ | n/a | ❌ |
| Dual-mode: MCP server and one-shot CLI | ✅ | ❌ | ❌ |
| Distribution | NuGet (dnx/tool) + official MCP registry | varies | varies |
In short: UIA-based tools see what accessibility exposes, and computer-use agents see pixels. This project gives the agent the same insider view a WPF developer has in Snoop — with no probe to install in the target app — plus the widest set of hands to act on it, over a protocol every AI coding tool speaks.
The package is also published as an MCP server package (PackageType: McpServer),
so MCP clients that support NuGet-hosted servers can launch it directly:
Download the latest release from GitHub Releases:
WpfVisualTreeMcp-vX.X.X-win-x64.zipC:\Tools\WpfVisualTreeMcp)WpfVisualTreeMcp.Server.exeThe server uses the official Microsoft/Anthropic MCP SDK for .NET, providing guaranteed compatibility with Claude Code and other MCP clients.
Option 1: Command Line (Recommended)
Use the claude mcp add command to add the server directly:
You can verify the server was added:
Option 2: Project-level JSON Configuration
Create or edit .mcp.json in your project root:
Option 3: Global JSON Configuration
Add to ~/.claude/settings.json:
Important Notes:
.exe file/) in paths on Windowsdotnet build -c ReleaseAdd to your Cursor settings (.cursor/mcp.json):
For your WPF application to be inspectable, add a reference to the Inspector DLL and initialize it on startup:
Add a project reference to WpfVisualTreeMcp.Inspector
In your App.xaml.cs:
This enables the MCP server to connect to your application via named pipes for real-time inspection.
For detailed architecture documentation, see docs/ARCHITECTURE.md.
| Tool | Description |
|---|---|
wpf_list_processes | List all running WPF applications |
wpf_attach | Attach to a WPF application (supports auto_inject for DLL injection) |
wpf_get_visual_tree | Get the visual tree hierarchy (default depth: 25, max: 100) |
wpf_get_element_properties | Get all dependency properties of an element |
wpf_find_elements | Query elements by type, x:Name, visible text, property values and visibility; results include text, automation id, enabled/visible state and screen bounds |
wpf_find_elements_deep | Same query filters without result limit, across all windows including adorners/popups |
wpf_capture_screenshot | Capture a screenshot of the window or element (returns image); mode='screen' captures real on-screen pixels including open popups, dropdowns and context menus |
wpf_get_bindings | Get data bindings for an element (includes MultiBinding, converter, StringFormat) |
wpf_get_binding_errors | List all captured binding errors |
wpf_clear_binding_errors | Clear the captured binding errors list |
wpf_get_data_context | Get DataContext type, properties, INPC status, and inheritance chain |
wpf_get_resources | Enumerate resource dictionaries |
wpf_get_styles | Get applied styles and templates |
wpf_watch_property | Monitor a property for changes |
wpf_evaluate_binding | Explain why a property has its value — value source, and for bindings a hop-by-hop path resolution pinpointing where a broken binding fails |
wpf_explain_triggers | Evaluate Style and ControlTemplate triggers against the current state (condition, current value, active, setters) — 'why doesn't this trigger fire?'; and attribute a property's value to the style setter / active trigger that set it |
wpf_snapshot | Capture an element subtree's state (layout, visibility, brushes, text) under a label |
wpf_diff | Diff two snapshots — measure exactly what a change moved (property from→to, added/removed) |
wpf_set_property | Live-edit a dependency property at runtime (type-converted), to test a change without rebuilding. State-changing, reversible. |
wpf_revert_property | Undo wpf_set_property edits (one, filtered, or all) — restores the prior binding/value/default. |
wpf_highlight_element | Visually highlight an element |
wpf_click_element | Click a control — UI Automation invoke (Invoke/Toggle/Select/ExpandCollapse) by default, physical=true for a real OS mouse click (auto-scrolls into view), click_type='double'/'right' for double/right clicks. State-changing. |
wpf_select_item | Select an item in a ComboBox/ListBox/ListView/TabControl by visible text or index — works with virtualized items. State-changing. |
wpf_wait_for | Wait until an element is visible/exists/enabled/hidden, polling in the target app — no sleep-and-retry loops. |
wpf_set_text | Set text/value of a TextBox/ComboBox/PasswordBox — UI Automation IValueProvider.SetValue by default, physical=true to type via OS keyboard input. State-changing. |
wpf_send_keys | Send a keyboard shortcut (Ctrl+S, Alt+F4, F5, Enter, ...) to an element or the focused window. State-changing. |
wpf_get_layout_info | Get layout information |
wpf_export_tree | Export visual tree to XAML or JSON |
For complete tool documentation, see docs/TOOLS_REFERENCE.md.
ImageContentBlock)IValueProvider + fallbacks (v0.5.0)Ctrl+S, Alt+F4, F5, ...) via OS input (v0.5.0)WpfInjectorHelper.exe (32-bit .NET 8)wpf_select_item — select in ComboBox/ListBox/TabControl by text or indexdnx / dotnet tool install (MCP server package type)wpf_wait_for — wait for an element/condition, no sleep-and-retry loopsThe "change → measure → is it effective?" loop is complete: live-edit a property, then diff a before/after snapshot to see exactly what moved.
wpf_set_property / wpf_revert_property — live-edit a dependency property, then undo (v0.9.0)wpf_snapshot / wpf_diff — before/after snapshot to verify a change's effect (v0.10.0)wpf_evaluate_binding — explain why a property has its value; resolve a binding path hop-by-hop (v0.11.0)wpf_record → wpf_export_test — record a driven workflow, export an xUnit + driver testSee docs/ROADMAP.md for the full prioritized plan (rationale, design notes, effort, and suggested sequencing).
Contributions are welcome! Please feel free to submit a Pull Request.
Clone the repository:
Open in Visual Studio 2022 or VS Code:
Build and run tests:
Run the sample WPF app for testing:
[McpServerTool] attributes (22 read-only inspection incl. wpf_wait_for, wpf_snapshot, wpf_diff, wpf_evaluate_binding, wpf_explain_triggers + 6 state-changing: wpf_click_element, wpf_select_item, wpf_set_text, wpf_send_keys, wpf_set_property, wpf_revert_property)Program.cs routes via CliRunner.IsCliCommand)This project is licensed under the MIT License - see the LICENSE file for details.