Back to Browse

Tauri Hasgard MCP Server

Developer ToolsLow Risk9.7MCP RegistryLocal
Free

Server data from the Official MCP Registry

Inspect and drive a running Tauri app's native webviews: snapshot, click, type, screenshot.

About

Inspect and drive a running Tauri app's native webviews: snapshot, click, type, screenshot.

Security Report

9.7
Low Risk9.7Low Risk

Valid MCP server (1 strong, 1 medium validity signals). No known CVEs in dependencies. ⚠️ Package registry links to a different repository than scanned source. Imported from the Official MCP Registry. 1 finding(s) downgraded by scanner intelligence.

13 files analyzed · 1 issue found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

file_system

Check that this permission is expected for this type of plugin.

HTTP Network Access

Connects to external APIs or services over the internet.

clipboard

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

Endpoint of the application to drive. Unset, the running application is discovered.Optional

Environment variable: TAURI_HASGARD_SOCKET

Window label used by tool calls that name none.Optional

Environment variable: TAURI_HASGARD_WINDOW

Set to true to expose the eval, ipc and drop tools, which run code or commands in the app.Optional

Environment variable: TAURI_HASGARD_MCP_ENABLE_DANGEROUS_TOOLS

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "tauri-hasgard": {
      "command": "npx",
      "args": [
        "-y",
        "tauri-hasgard"
      ],
      "env": {
        "TAURI_HASGARD_SOCKET": "your-tauri-hasgard-socket-here",
        "TAURI_HASGARD_WINDOW": "your-tauri-hasgard-window-here",
        "TAURI_HASGARD_MCP_ENABLE_DANGEROUS_TOOLS": "your-tauri-hasgard-mcp-enable-dangerous-tools-here"
      }
    }
  }
}

Some servers take additional arguments. See the repository for details.

Documentation

View on GitHub

From the project's GitHub README.

Tauri Hasgard

crates.io npm CI

Hasgard is the automation bridge for Tauri 3. It connects to one running Tauri application and drives its real native webviews through a shared JSON-RPC protocol.

Use the same running app from:

  • CLI — inspect windows, take accessibility snapshots, click, fill, press keys, capture screenshots and call IPC.
  • MCP — give Claude Code, Codex or another MCP client the same tools.
  • Playwright — write E2E tests with Playwright's test runner and assertions.

Hasgard does not launch a browser, emulate a Tauri webview or provide a fake Page. The app must be running and the plugin must be registered in it.

Quick start

1. Register the plugin

From your Tauri project's src-tauri directory:

cargo add tauri-plugin-hasgard tauri-runtime-wry@3.0.0-alpha.6

Register the plugin and the Wry runtime in your builder:

tauri::Builder::default()
    .runtime(tauri_runtime_wry::Wry::default())
    .plugin(tauri_plugin_hasgard::init())
    .run(tauri::generate_context!())
    .expect("failed to run Tauri application");

Grant the permission to every window you intend to automate. In src-tauri/capabilities/default.json:

{
  "windows": ["*"],
  "permissions": ["hasgard:default"]
}

Registering the plugin enables automation in every build, including release builds. If production builds must not expose it, conditionally add the .plugin(...) call in your application.

Start the app and leave it running. Hasgard attaches to an existing process:

bun run tauri dev

2. Check the connection

Install the CLI with any one of these methods:

npm install -g tauri-hasgard
# or: brew install nyssance/tap/tauri-hasgard
# or: scoop bucket add nyssance https://github.com/nyssance/scoop-bucket
#     scoop install nyssance/tauri-hasgard
# or: cargo install tauri-hasgard-cli

Then inspect the running app:

$ tauri-hasgard ping
✓ Connected. Plugin and CLI both 0.8.4.
$ tauri-hasgard windows
main       tauri://localhost                 My application
$ tauri-hasgard --window main snapshot -i
- textbox "Display name" [ref=e1]
- button "Save" [ref=e2]

The windows command gives you the label for --window. Snapshot refs are short-lived: take a new snapshot after the UI changes.

3. Drive the UI

tauri-hasgard --window main click '@e2'
tauri-hasgard --window main fill 'input[name=email]' 'me@example.com'
tauri-hasgard --window main press Enter
tauri-hasgard --window main wait '#saved'
tauri-hasgard --window main screenshot screen.png

Targets can be a ref from the latest snapshot or a CSS selector. Add --json for machine-readable output; run tauri-hasgard --help for the complete command list.

Connect an AI client

With the app running, register the MCP server in one command:

claude mcp add tauri-hasgard -- npx -y tauri-hasgard mcp
codex mcp add tauri-hasgard -- npx -y tauri-hasgard mcp

Check the connection with claude mcp list or codex mcp list, then ask the client to list the application's windows. The MCP server and CLI use the same plugin endpoint and the same tool semantics.

For an app that hosts its own agent, Hasgard also exposes an in-process MCP server. See the MCP guide.

Write Playwright tests

Requires Node.js 24 or newer.

Install the test fixture:

bun add --dev @nyssance/tauri-hasgard @playwright/test

The fixture launches or attaches to your app, then exposes HasgardApplication and HasgardWindow objects:

test("opens settings", async ({ hasgard, window }) => {
  await window.getByRole("button", { name: "Settings", exact: true }).click()
  const settings = await hasgard.waitForWindow("settings", 5_000)
  await expect(settings.getByRole("heading", { name: "Settings" })).toBeVisible()
})

See the Playwright guide for fixture setup, lifecycle cleanup, locators and keyboard behavior. Tests run against real native windows; there is no mocked browser mode and no page fixture.

Supported platforms

ComponentSupport
Tauri3.0.0-alpha.6
WebviewWry; CEF is opt-in
CLI binariesmacOS Apple Silicon, Windows x64, Linux x64

The CEF setup and its operation limits are documented in docs/cef.md.

Documentation

License

Apache-2.0. Upstream MIT notices are preserved in LICENSE and NOTICE.md.

Reviews

No reviews yet

Be the first to review this server!