# Netwright [Health: Active]

**Category:** 🖥️ OS Automation  
**Repository:** https://github.com/ricfanin/netwright  
**GitHub Stars:** 25  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/netwright

## Description
Playwright-style automation of .NET desktop apps (WPF, WinForms, WinUI) for AI agents.

## Tools
Capabilities this server exposes over MCP:

- **desktop_app** — Launch an `.exe` or build and launch a project, attach, close, status
- **desktop_snapshot** — The UI as compact text with Refs
- **desktop_find** — Elements matching a Selector (`#id`, `role "name"`, `a >> b`)
- **desktop_inspect** — Properties, patterns and a stable Selector of one element
- **desktop_click** — Click (background; right/double click with `foreground`)
- **desktop_type** — Set text (background) or type real keys
- **desktop_set_state** — Check, select, expand, set a value, or pick an item by name
- **desktop_press_key** — Key presses and shortcuts (foreground)
- **desktop_scroll** — Scroll by direction, to an edge, or into view
- **desktop_window** — List, activate, minimize, maximize, restore, close windows
- **desktop_screenshot** — Image of a window or element, even when covered
- **desktop_wait** — Wait for an element state or for text; reports what changed
- **desktop_expect** — Retrying assertions: text, value, enabled, checked, count…
- **desktop_logs** — App output: stdout, stderr, debug/trace
- **desktop_export_test** — Turn the session into a C# regression test

## Claude Desktop Quick Installation
No generated config for this server: it installs through its own setup steps.

The project's own setup steps (from https://github.com/ricfanin/netwright), copied verbatim. Follow them in order; they are not an mcpServers config.

1. Add to Claude Code:

```sh
claude mcp add netwright -- dnx Netwright --yes
```

2. Install:

```sh
dotnet tool install -g Netwright
```

## Documentation

## What the Netwright MCP server does

Netwright provides MCP tools for interacting with Windows desktop applications built with WPF, WinForms, WinUI, and .NET MAUI on Windows. Its primary supported tiers are WPF and WinForms, including .NET Framework 4.x applications, followed by WinUI 3 and .NET MAUI. Avalonia and Uno Platform are handled on a best-effort basis through UI Automation; other Windows applications may work but are not supported targets.

An agent can launch an executable, build and launch a project, attach to an existing process, check application status, and close the app. It can then inspect the visible interface, locate controls, perform actions, wait for asynchronous changes, and check expected state. A completed session can be exported as a C# regression test for xUnit, NUnit, or MSTest through Netwright.Testing.

## How it works

The Netwright MCP server captures each window from Windows UI Automation and keeps a cached representation for subsequent operations. It renders that data as compact text, omitting or collapsing layout details that are usually less useful to an agent and summarizing grids by row. Elements receive references such as `e12`, and selectors can also target controls using identifiers, roles, names, or chained relationships.

Actions return a change report describing elements that appeared, disappeared, or changed. This lets an agent continue from the action result instead of requesting a full snapshot after every operation. The server waits for a target to be enabled and visible, then waits for the interface to settle. Failures are returned with error codes and guidance.

Most operations use UI Automation patterns and do not take control of the mouse. Keyboard input, along with right-click and double-click operations requested with foreground behavior, can briefly use focus and then return it.

## Setup and configuration

Run the server on Windows 10 or Windows 11 with the .NET 10 SDK installed. The application under test may target any .NET version or .NET Framework version. A typical MCP configuration invokes `dnx Netwright --yes`; alternatively, install the `Netwright` global .NET tool and use `netwright` as the command.

Claude Code can register the server with `claude mcp add netwright -- dnx Netwright --yes`. Other MCP clients can use a configuration containing `command: "dnx"` and arguments for `Netwright` and `--yes`. An optional `--allow` argument restricts which applications the agent may access. Controls are easier to automate when WPF or WinUI applications set `AutomationProperties.AutomationId`, or when WinForms controls have a suitable `Name`.

## Tools and capabilities

The available tools cover the full interaction loop:

- `desktop_app` manages launch, project build-and-launch, attach, status, and close operations.
- `desktop_snapshot`, `desktop_find`, and `desktop_inspect` expose the UI tree, matching elements, properties, patterns, and stable selectors.
- `desktop_click`, `desktop_type`, `desktop_set_state`, `desktop_press_key`, and `desktop_scroll` operate controls and navigation.
- `desktop_window` manages application windows, while `desktop_screenshot` captures a window or element, including covered content.
- `desktop_wait` waits for an element state or text, and `desktop_expect` performs retrying checks for text, values, enabled state, checked state, and counts.
- `desktop_logs` returns stdout, stderr, and debug or trace output.
- `desktop_export_test` converts the interaction session into a C# test.

## Limitations and notes

The server requires Windows and the .NET 10 SDK. UI Automation support depends on the application exposing useful control properties. WPF and WinForms are the most thoroughly supported technologies; WinUI 3 and .NET MAUI have a lower support tier, while Avalonia and Uno Platform are best effort. Applications such as Win32, Qt, and Electron may work through plain UI Automation but are not supported by the project.

Operations may take longer because the server waits for the interface to settle after actions. In return, the resulting response can include the relevant UI changes and reduce follow-up calls. The server is intended for desktop UI automation and does not provide a browser automation interface.

_Full upstream README: https://allmcps.com/mcp/netwright/readme_

