
Netwright
io.github.ricfanin由 GitHub 账号 ricfanin 发布v2.1.0更新于 Oct 24, 2026
Playwright-style automation of .NET desktop apps (WPF, WinForms, WinUI) for AI agents.
概览
Netwright 让 AI 助手通过 UI Automation 启动、查看并操作 .NET 桌面应用(WPF、WinForms、WinUI),并把验证过的流程导出为 C# 测试。
- 可以做什么
- 启动、附加、关闭 .exe 或 .csproj 应用并查看状态,列出和管理窗口,截图并读取应用日志(stdout、stderr、trace)。
- 适用场景
- 当你希望助手探索、操作或回归测试 Windows .NET 桌面应用时使用:填写表单、走通流程、验证界面状态,并把验证过的会话转成 C# 测试。
- 运行要求
- 需要 Windows 10/11 和 .NET 10 SDK;被测应用可面向任意 .NET 或 .NET Framework 版本。通过 stdio 在本机运行,可用 dnx 或全局 dotnet 工具安装。未声明认证或 API 密钥。
安装
在 SourceWeft 中
- 打开 控制台中的 Netwright,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Netwright
Playwright-style automation for .NET desktop apps. Netwright is an MCP server that lets AI agents see and operate WPF, WinForms and WinUI apps: they launch your project, read the UI as compact text, act without stealing your mouse, verify the result, and turn the verified flow into a regression test.
Formerly WPF-MCP. Version 2.0 is a rewrite; see Migrating from WPF-MCP 1.x.
Why Netwright
- Made for .NET apps. Works with WPF, WinForms (.NET and .NET Framework 4.x) and WinUI/MAUI through UI Automation. It launches straight from a
.csproj, captures stdout/stderr andTraceoutput, and reports crashes with the exception and stack trace. - Cheap in tokens.
- Snapshots are filtered to what an agent needs: unnamed layout panes are collapsed, and grids are summarized row by row.
- Actions answer with a Change Report of what appeared, disappeared or changed, so the agent rarely needs another snapshot.
- Refs (
e12) stay valid across snapshots.
- Stays out of your way. Actions run in the background: in apps Netwright launches, a small companion performs them inside the app, so it never takes the foreground and bound fields commit like a real edit. You keep working while the agent tests. Key presses and right-clicks are explicit, briefly take focus, and give it back.
- Reliable by default.
- Every action waits until its target is enabled and on screen.
- It then waits for the UI to settle, so async screens don't need sleeps.
- Failures come back as error codes with a hint about what to do next.
- From exploration to regression tests.
desktop_expectverifies state, anddesktop_export_testturns the session into a C# test on Netwright.Testing (xUnit, NUnit or MSTest).
Benchmark
Same scenarios, same Fixture App, same token encoding for every server (full methodology and all numbers in benchmarks/results):
¹ Windows-MCP summarizes the whole desktop instead of the app's UI tree; its grid snapshot does not include the rows. ² Its actions work at screen coordinates with the real mouse, so scripted flows were not run.
Tokens are counted with o200k_base as a proxy for Claude's tokenizer. Netwright's actions are slower per call: the form flow takes ~1.8 s against ~0.6 s, because each action waits for the UI to settle. In exchange the response already contains the result, so the agent needs fewer calls and far fewer tokens.
Install
Requires Windows 10/11 and the .NET 10 SDK. Your apps can target any .NET or .NET Framework version.
Claude Code
Any MCP client (Claude Desktop, Cursor, VS Code, Copilot…)
Prefer a global tool? Run dotnet tool install -g Netwright and use "command": "netwright". To restrict which apps an agent may touch, add "--", "--allow", "MyApp*" to the args. See the Integration Guide for all options.
Tools
Full reference: docs/TOOLS_REFERENCE.md.
Supported UI technologies
Other Windows apps (Win32, Qt, Electron…) often work because Netwright speaks plain UI Automation, but they are not supported.
Automation works best when your app sets AutomationProperties.AutomationId (WPF/WinUI) or Name (WinForms) on the controls you care about. See Making your app automation-friendly.
Regression tests without an agent
dotnet add package Netwright.Testing. This is the code desktop_export_test writes for you.
How it works
Netwright captures each window with one cached UI Automation query. Windows are found with Win32, only about 20 properties are requested, and offscreen elements are filtered inside the provider. From that capture it renders filtered text, resolves Selectors in memory, and diffs trees by RuntimeId to build Change Reports. Details and measurements: docs/ARCHITECTURE.md. Vocabulary: CONTEXT.md. Decisions: docs/adr.
Migrating from WPF-MCP 1.x
The package is now Netwright (command netwright), replacing WpfMcp.Server (wpf-mcp).
Contributing
Issues and PRs are welcome. See CONTRIBUTING.md. Build and test with .\scripts\build.ps1 -Integration, and measure with .\scripts\benchmark.ps1.
License
MIT
来源:README.md,提交 16f0987
工具
0版本历史
2- v2.1.0最新Oct 9, 2026
- v2.0.0Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分