Wpf Buddy MCP
MCP server that lets AI agents drive, test, and inspect WPF desktop applications through UI Automation. Attach to any running WPF app, explore screens autonomously, explain UI state, and generate regression tests β all via natural language through the Model Context Protocol.
Ask AI about Wpf Buddy MCP
Powered by Claude Β· Grounded in docs
I know everything about Wpf Buddy MCP. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
WpfBuddy MCP Server
The MCP server that understands WPF applications β not just pixels.
Attach to any WPF app. Inspect its UI tree semantically. Automate workflows without coordinates. Generate tests. Diagnose binding errors. All through natural language via MCP.
Why This Exists
Generic Windows automation tools can click and type. This server understands WPF.
| Generic Automation MCP | WpfBuddy MCP |
|---|---|
| "Click at position (340, 220)" | "Click the Save button" |
| "Read pixels from screen" | "Get the UI tree with AutomationIds" |
| "Something failed" | "The Save button is disabled because SaveCommand.CanExecute returns false β the Name property is empty" |
| "Here's a screenshot" | "Here's the element tree, its bindings, validation state, and DataContext" |
Core Differentiator
Given any WPF screen, inspect it semantically, automate a workflow without raw coordinates, explain WPF-specific failures, record the workflow, replay it deterministically, and export a maintainable automated test.
Quick Start
Prerequisites
- .NET 8 SDK
- Windows 10/11 (UI Automation is Windows-only)
Build & Run
dotnet build WpfBuddyMcp.sln
dotnet run --project src/WpfBuddy.Mcp.Server
Connect Your MCP Client
VS Code (GitHub Copilot)
Add to .vscode/mcp.json:
{
"mcpServers": {
"wpfbuddy-mcp": {
"command": "dotnet",
"args": ["run", "--project", "src/WpfBuddy.Mcp.Server/WpfBuddy.Mcp.Server.csproj"]
}
}
}
Claude Code
Add to claude_code_config.json:
{
"mcpServers": {
"wpfbuddy-mcp": {
"command": "dotnet",
"args": ["run", "--project", "C:/path/to/src/WpfBuddy.Mcp.Server/WpfBuddy.Mcp.Server.csproj"]
}
}
}
What Can It Do?
Attach & Inspect
"Attach to WPFapp and show me the main window structure"
The server attaches to any running WPF process, captures the full automation tree, and returns a semantic representation β control types, AutomationIds, names, patterns, states.
Automate Without Coordinates
"Click 'New Project', fill in Name as 'Test Project', then click Save"
All actions use semantic selectors (AutomationId β Name β ControlType), never raw screen coordinates. Selectors self-heal when the UI changes.
Record & Generate Tests
"Record what I'm doing, then export it as an xUnit test"
Records UI interactions as a workflow, validates selector stability, and exports production-ready xUnit + FlaUI test code with Page Object classes.
Diagnose WPF Issues
"Why is the Submit button disabled?"
With the optional in-process probe, inspects ViewModel command state, binding errors, DataContext properties, and validation β answering the "why" that generic tools cannot.
Accessibility Audit
"Run an accessibility check on this window"
Checks for missing names, keyboard accessibility, tab order, control patterns, and generates a report with recommendations.
Tool Categories
| Category | Tools | Description |
|---|---|---|
| Session | 15 | Attach, launch, detach, window management |
| Snapshot | 15 | UI tree capture, element queries, diff |
| Action | 27 | Click, type, select, drag, context menu, slider |
| Wait | 15 | Wait for state, visibility, value, dialog, navigation |
| Assertion | 16 | Assert state, text, grid, accessibility, snapshot |
| Selector | 11 | Build, validate, rank, heal, detect brittle |
| DataGrid & Tree | 16 | Grid rows/columns/cells, tree expand/select |
| Recording | 16 | Record, replay, pause, optimize, explain failures |
| Test Generation | 8 | Page objects, smoke tests, accessibility tests |
| Screenshot | 8 | Capture, annotate, compare, highlight |
| Accessibility | 9 | Audit names, tab order, keyboard, patterns |
| Policy & Safety | 10 | Capabilities, dry-run, redaction, audit |
| Reporting | 6 | Testability scores, diagnostics, export |
| Clipboard & Env | 7 | Clipboard, culture, theme, screen info |
| Probe (MVVM) | 7 | Connect/status/health for in-process probe |
| MVVM Diagnostics | 11 | ViewModel, bindings, commands, validation |
| Diagnostics | 5 | Environment, runtime, and system diagnostics |
| 202 | Total tools |
Full tool reference: docs/tools-reference.md
Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Client (VS Code Copilot, Claude Code, etc.) β
βββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β stdio (JSON-RPC)
βββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ
β WpfBuddy.Mcp.Server (.NET 8) β
β β
β βββββββββββββββββ ββββββββββββββ βββββββββββββββββββ β
β β SessionManagerβ β UiaAdapter β β SelectorBuilder β |
β β(attach/detach)β β(FlaUI UIA3)β β(heal/rank/build)β |
β βββββββββββββββββ ββββββββββββββ βββββββββββββββββββ β
β βββββββββββββββ ββββββββββββββ βββββββββββββββββββ β
β β Recording β β Screenshot β β AuditLog β β
β β Service β β Service β β β β
β βββββββββββββββ ββββββββββββββ βββββββββββββββββββ β
β βββββββββββββββββββββββββββββββββββββββ β
β β ProbeClient (IPC) β β
β βββββββββββββββββ¬ββββββββββββββββββββββ β
ββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ
β Named Pipe
ββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ
β Target WPF Application β
β βββββββββββββββββββββββββββββββββββββββ β
β β WpfBuddy.Mcp.Probe (NuGet) β β
β β β’ ViewModel inspection β β
β β β’ Binding error capture β β
β β β’ Command state β β
β β β’ Validation errors β β
β β β’ Dispatcher status β β
β βββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Project Structure
wpf-buddy-mcp/
βββ WpfBuddyMcp.sln
βββ src/
β βββ WpfBuddy.Mcp.Server/ # MCP server (main project)
β β βββ Program.cs # Entry point, DI registration
β β βββ Services/ # Core services
β β β βββ SessionManager.cs # Process attach/detach
β β β βββ UiaAdapter.cs # FlaUI wrapper
β β β βββ SelectorBuilder.cs # Selector generation & healing
β β β βββ RecordingService.cs # Workflow recording
β β β βββ ScreenshotService.cs # Screen capture
β β β βββ ProbeClient.cs # Named pipe IPC client
β β β βββ AuditLog.cs # Action audit trail
β β βββ Tools/ # MCP tool implementations
β β β βββ SessionTools.cs
β β β βββ SnapshotTools.cs
β β β βββ ActionTools.cs
β β β βββ WaitTools.cs
β β β βββ AssertionTools.cs
β β β βββ SelectorTools.cs
β β β βββ DataGridTools.cs
β β β βββ RecordingTools.cs
β β β βββ TestGenerationTools.cs
β β β βββ ScreenshotTools.cs
β β β βββ AccessibilityTools.cs
β β β βββ PolicyTools.cs
β β β βββ ReportingTools.cs
β β β βββ ClipboardTools.cs
β β β βββ DiagnosticsTools.cs
β β β βββ ProbeTools.cs
β β β βββ MvvmTools.cs
β β βββ Models/ # Data models
β βββ WpfBuddy.Mcp.Probe/ # In-process probe (NuGet package)
β βββ ProbeHost.cs # Named pipe server + WPF inspection
β βββ WpfBuddy.Mcp.Probe.csproj
βββ docs/ # Documentation
Safety & Security
| Principle | Implementation |
|---|---|
| Scoped execution | Only operates on the attached application β no OS-wide access |
| Audit trail | Every mutating action is logged with timestamp, tool name, and parameters |
| Dry-run mode | wpf_preview_action shows what would happen without executing |
| Redaction | Configurable rules to mask sensitive field values in snapshots |
| Policy engine | Control destructive actions, coordinate fallback, timeouts, retries |
| No shell access | No file system, registry, or process management tools |
Optional: In-Process Probe
For deep WPF diagnostics (bindings, ViewModel, commands), install the probe NuGet in your target app:
dotnet add package WpfBuddy.Mcp.Probe
// In App.xaml.cs
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
ProbeHost.Start(); // Listens on named pipe automatically
}
Then from MCP: wpf_probe_connect β full MVVM diagnostics available.
Probe setup guide: docs/probe-setup.md
Tech Stack
| Component | Technology |
|---|---|
| Runtime | .NET 8 (net8.0-windows) |
| MCP SDK | ModelContextProtocol 0.2.0-preview.1 |
| UI Automation | FlaUI.UIA3 4.0.0 |
| Transport | stdio (JSON-RPC) |
| DI/Hosting | Microsoft.Extensions.Hosting 8.0.1 |
| Serialization | System.Text.Json 8.0.5 |
| IPC | Named Pipes (System.IO.Pipes) |
Documentation
| Document | Description |
|---|---|
| docs/tools-reference.md | Complete tool reference with parameters and examples |
| docs/probe-setup.md | In-process probe installation and usage guide |
| docs/architecture.md | Detailed architecture and design decisions |
| docs/examples.md | Real-world usage examples and workflows |
Contributing
- Fork & clone
dotnet build WpfBuddyMcp.sln- Make changes
- Ensure build passes:
dotnet build - Submit PR
License
MIT
