Netwright — Claude Code MCP server: automate WPF and WinForms apps
An MCP server that lets an AI agent start a .NET desktop app, read its UI as text and walk through a scenario without taking your mouse.
Open on GitHubWhat Netwright does
Netwright drives WPF and WinForms, .NET Framework 4.x included, plus WinUI 3 and .NET MAUI on Windows, through UI Automation. The agent launches a .csproj directly and picks up stdout, stderr and Trace output; a crash comes back with the exception and stack trace. UI snapshots arrive as tight text: unnamed layout panes collapse and grids are summarised row by row.
Actions run in the background. In an app Netwright started, a companion inside the app carries them out, so the window never jumps to the foreground. Key presses and right-clicks are separate tools that briefly borrow focus and hand it back. Each action first waits for its target to be enabled and visible, then waits for the UI to settle, which removes sleep calls from async flows. Failures return an error code with a hint on the next step.
You need Windows 10 or 11 and the .NET 10 SDK; your own apps can target any .NET version. desktop_expect handles retrying assertions, and desktop_export_test writes the session out as a C# test on Netwright.Testing for xUnit, NUnit or MSTest. It is slower per call than coordinate-based tools — a form flow takes about 1.8 s against 0.6 s — but the response already carries the result, so fewer calls are needed.
What it helps with
- launch a WPF app from its
.csprojand capture console output - read a window's UI as compact text instead of a screenshot
- fill in a form and submit it while you keep working
- wait out an async screen without sleeps in the script
- turn a walked-through flow into a C# regression test
Example prompts for the agent
- Launch
src/Orders/Orders.csproj, open the order screen and show me the UI snapshot - Check
#chkTerms, click#btnSaveand confirm the modal window appears - Export this session as a regression test on xUnit
How to install Netwright
Install
The MCP registry has no launch command for it: see the repository README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Netwright
How do I install Netwright in Claude Code?
Run claude mcp add netwright -- dnx Netwright --yes. Windows 10 or 11 and the .NET 10 SDK are required.
What does Netwright do?
It gives an agent tools for .NET desktop apps: launching the project, snapshotting the UI, clicking, typing, asserting state, and exporting the session as a test.
How do I limit which apps the agent may touch?
Add "--", "--allow", "MyApp*" to the args. The agent then only reaches apps whose name matches.