tauri-plugin-mcp-server
v0.3.1MCP server that lets AI agents interact with and debug Tauri applications via the tauri-plugin-mcp socket (screenshots, DOM access, input simulation, log…
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
take_screenshot
Captures a screenshot of an application window. By default saves the full image to disk and returns a small thumbnail inline (optimized for token efficiency). Set inline=true to get the full image as base64 instead. Read-only, does not modify application state. WARNING: Screenshot pixel coordinates do NOT match the CSS pixel coordinates used by click/hover/type_text tools. Do NOT visually estimate click targets from screenshots. Instead, use query_page with mode='find_element' to get accurate coordinates for clicking.
| Parameter | Type | Description |
|---|---|---|
audience | string | Hint for who should consume the image. 'user' = low priority for model, 'assistant' = high priority for model, 'both' = default behavior. |
inline | boolean | If true, return full-resolution base64 image inline instead of saving to disk. Default: false (saves to disk with small thumbnail). |
max_size_mb | number | Maximum file size in MB. Image will be compressed to fit. Default: 1.0. |
max_width | number | Maximum image width in pixels. Images wider than this will be resized. Default: 1024. |
output_dir | string | Directory to save screenshot file to. Defaults to system temp directory. |
quality | number | JPEG quality (1-100). Lower values produce smaller images. Default: 70. |
window_label | string | Window to capture. Defaults to 'main'. |
query_page
Inspects the current page. Modes: 'map' returns a structured JSON map of elements with numbered refs (preferred; pass interactive_only=true and/or scope_selector to keep output small — content-heavy pages emit hundreds of text-node refs otherwise). Refs are renumbered on EVERY map call and go stale when the page changes — re-map before reusing them. 'html' returns raw DOM HTML (large — use only when map is insufficient). 'state' returns lightweight metadata (URL, title, scroll, viewport). 'find_element' locates an element by ref/selector and returns its exact CSS pixel coordinates — th…
| Parameter | Type | Description |
|---|---|---|
mode * | string | What to query. 'map' for structured element map with refs. 'html' for raw DOM. 'state' for URL/title/scroll. 'find_element' for element coordinates. 'app_info' for app environment. |
delta | boolean | (map) Return only changes since last call. Default: false. |
find_scope_selector | string | (find_element) CSS selector limiting the search to one container. |
include_content | boolean | (map) Include page text content. Default: true. |
include_metadata | boolean | (map) Include structured page metadata (JSON-LD, OpenGraph, description). Default: true. |
interactive_only | boolean | (map) Only return interactive elements. Default: false. |
match | string | (find_element, text selector) Text match mode. Default: exact first, then contains. |
max_depth | integer | (map) Max DOM tree depth to recurse. |
max_wait_ms | integer | (map) Max wait for DOM stability in ms. Default: 3000. |
nth | integer | (find_element) Pick the nth match (0-based). Default: 0. |
quiet_ms | integer | (map) Milliseconds of mutation silence for stability. Default: 300. |
scope_selector | (map) CSS selector(s) to limit scan scope. | |
selector_type | string | (find_element) Selector type. 'ref' uses numbered reference from map mode. 'css' accepts any CSS selector. |
selector_value | string | (find_element) Selector value. For 'ref', the ref number as string. |
should_click | boolean | (find_element) Click the element once found. Default: false. |
timeout_secs | integer | (map) Rust-side timeout in seconds. Default: 10. Max: 300 (5 minutes). |
wait_for_stable | boolean | (map) Wait for DOM mutations to settle before scanning. Default: false. |
window_label | string | The window to query. Defaults to 'main'. |
click
Clicks in the webview. Preferred: provide a selector (ref from query_page map mode, or id/class/css/tag/text) — left single clicks then dispatch synthetic pointer events (pointerdown→mousedown→pointerup→mouseup→click) directly at the element. This works regardless of window focus/display scaling, may retarget to the nearest interactive ancestor, and produces events with isTrusted=false — handlers that require trusted events won't fire. Right/middle/double clicks and raw x/y clicks use native OS clicking instead, which on macOS requires Accessibility permission. IMPORTANT: Do not gu…
| Parameter | Type | Description |
|---|---|---|
button | string | Mouse button. Default: 'left'. |
click_type | string | Click type. 'double' sends two rapid clicks. Default: 'single'. |
match | string | (text selector) Text match mode. Default: exact first, then contains. |
nth | integer | Pick the nth match (0-based) when the selector hits multiple elements. Default: 0. |
scope_selector | string | CSS selector limiting the search to one container (e.g. '.sidebar'). Applies to css/class/tag/text selectors. |
selector_type | string | Selector type to find element. 'ref' uses numbered ref from query_page map mode. 'css' accepts any CSS selector. |
selector_value | string | Selector value. For 'ref', provide the ref number as string. |
window_label | string | Target window. Defaults to 'main'. |
x | number | X coordinate in CSS pixels. Required if no selector provided. |
y | number | Y coordinate in CSS pixels. Required if no selector provided. |
type_text
Types text into the page. Four modes: (1) Provide 'fields' array to fill multiple form fields at once (each by ref or selector). (2) Provide 'selector_type'+'selector_value' to target a specific element. (3) Provide only 'text' to type into the currently focused element. (4) Provide 'files' (absolute paths) + selector to attach files to an <input type="file">. Supports inputs, textareas, <select> dropdowns (text selects the matching option by value or label), contentEditable, React controlled components, Lexical, and Slate editors.
| Parameter | Type | Description |
|---|---|---|
delay_ms | integer | Delay between keystrokes in ms. Default varies by mode. |
fields | array | Array of form fields to fill. Each needs either a ref or selector_type+selector_value. |
files | array | Absolute paths of files to attach to an <input type="file">. Requires selector_type/selector_value targeting the input (or a container holding it). Max 10MB per file, 25MB total. CAUTION: reads any fi… |
initial_delay_ms | integer | (focused mode) Initial delay before typing begins in ms. |
selector_type | string | Selector type for targeting a specific element. 'ref' uses numbered reference from query_page map mode. 'css' accepts any CSS selector. |
selector_value | string | Selector value. For 'ref', provide the ref number as string. |
submit_ref | integer | (fields mode) Ref of submit button to click after filling all fields. |
text | string | Text to type. Required unless using 'fields' mode. |
window_label | string | Target window. Defaults to 'main'. |
press_key
Presses a keyboard key (with optional modifiers) in the webview. Use for keys type_text cannot express: Escape, Enter, Tab, arrow keys, Backspace, Delete, Home/End, PageUp/PageDown, F1-F12, or modifier chords like cmd+a. Targets the focused element by default, or provide a selector to focus an element first. Dispatches synthetic keydown/keyup events and emulates the default action (text insertion, Enter submits forms/activates buttons, Tab moves focus, Backspace/Delete edit text) unless the app calls preventDefault. Note: OS-level shortcuts (app menus, global shortcuts) are not triggered — t…
| Parameter | Type | Description |
|---|---|---|
key * | string | Key to press: a DOM key name ('Escape', 'Enter', 'Tab', 'ArrowDown', 'Backspace', 'Delete', 'Home', 'End', 'PageUp', 'PageDown', 'Space', 'F1'-'F12') or a single character ('a', '1', '/'). |
modifiers | array | Modifier keys held during the press. 'cmd' maps to metaKey, 'ctrl' to ctrlKey. |
repeat | integer | Number of times to press the key (e.g. ArrowDown x3). Default 1. |
selector_type | string | Optional: selector type to focus a target element before pressing. 'ref' uses numbered refs from query_page map mode. |
selector_value | string | Selector value. For 'ref', provide the ref number as string. |
window_label | string | Target window. Defaults to 'main'. |
mouse_action
Performs non-click mouse actions. 'hover' moves the cursor to coordinates (native; if macOS Accessibility is not granted, falls back to synthetic pointer events — JS hover handlers fire but CSS :hover styles do not). 'scroll' scrolls the page by direction/amount, to an element ref (response reports whether the element landed in the viewport), or to top/bottom. 'drag' moves from start to end coordinates (best-effort, two sequential moves; requires Accessibility).
| Parameter | Type | Description |
|---|---|---|
action * | string | The mouse action: 'hover' to move cursor, 'scroll' to scroll page, 'drag' for drag gesture. |
amount | (scroll) Pixel count, 'page', or 'half'. Default: one full page. | |
direction | string | (scroll) Scroll direction. Default: 'down'. |
end_x | number | (drag) End X coordinate. |
end_y | number | (drag) End Y coordinate. |
relative | boolean | (hover) If true, x/y are relative offsets from current position. |
to_bottom | boolean | (scroll) Scroll to bottom of page. |
to_ref | integer | (scroll) Scroll to bring this element ref into view. |
to_top | boolean | (scroll) Scroll to top of page. |
window_label | string | Target window. Defaults to 'main'. |
x | number | (hover/drag) Target X coordinate in CSS pixels. |
y | number | (hover/drag) Target Y coordinate in CSS pixels. |
execute_js
Executes arbitrary JavaScript in a webview. Returns the completion value of the code (the last expression's value); promises are awaited and their resolved value returned. This is the universal escape hatch — use it for anything not covered by other tools. Note: `window.__TAURI__` only exists if the app enables `app.withGlobalTauri` — for Tauri events/commands prefer the manage_ipc tool, which works regardless. Caution: can modify page state.
| Parameter | Type | Description |
|---|---|---|
code * | string | JavaScript to execute in the webview. The last expression's value is returned (promises are awaited); the value must be JSON-serializable to round-trip — DOM nodes and functions come back as strings… |
timeout_ms | integer | Max execution time in milliseconds. Default: 5000. Max: 300000 (5 minutes). Raise this for code that awaits slow promises. |
window_label | string | Target window. Defaults to 'main'. |
manage_storage
Manages browser storage. For localStorage: get/set/remove items, clear all, or list keys. For cookies: get all cookies, get cookies for a URL, or clear all browsing data (nuclear — clears cookies, cache, and localStorage).
| Parameter | Type | Description |
|---|---|---|
action * | string | Action to perform. Valid for store='local_storage': 'get', 'set', 'remove', 'clear', 'keys'. Valid for store='cookies': 'get_all', 'get_for_url', 'clear_all'. Note: 'clear_all' clears ALL browsing dat… |
store * | string | Which storage to manage. |
key | string | (local_storage) Key name. Required for get/set/remove. |
url | string | (cookies) URL to get cookies for. Required for 'get_for_url'. |
value | string | (local_storage) Value to store. Required for 'set'. |
window_label | string | Target window. Defaults to 'main'. |
manage_window
Manages windows, zoom, devtools, and webview state. Window actions: list, focus, minimize, maximize, unmaximize, close, show, hide, set_position, set_size, center, toggle_fullscreen. Zoom: set_zoom, get_zoom. DevTools: open_devtools, close_devtools, is_devtools_open. Webview state: clear_browsing_data, set_background_color, get_bounds, set_auto_resize.
| Parameter | Type | Description |
|---|---|---|
action * | string | The window management action to perform. |
a | integer | (set_background_color) Alpha component (0-255). 255=opaque. |
b | integer | (set_background_color) Blue component (0-255). |
enabled | boolean | (set_auto_resize) Whether to enable auto-resize. |
g | integer | (set_background_color) Green component (0-255). |
height | integer | (set_size) Height in pixels. |
r | integer | (set_background_color) Red component (0-255). |
scale | number | (set_zoom) Zoom scale factor. 1.0 = 100%. |
width | integer | (set_size) Width in pixels. |
window_label | string | Target window. Defaults to 'main'. |
x | integer | (set_position) X coordinate in screen pixels. |
y | integer | (set_position) Y coordinate in screen pixels. |
wait_for
Waits for a condition to be met before returning: text appearing/disappearing on the page, an element becoming visible/hidden, or an element being attached/detached from the DOM. Useful after actions that trigger async content loading (navigation, form submission, AJAX). Provide exactly one of: text, selector, or ref.
| Parameter | Type | Description |
|---|---|---|
ref | integer | Ref number (from query_page map mode) of the element to wait for. |
selector | string | CSS selector for the element to wait for. |
state | string | Condition to wait for. 'visible': element exists and is visible. 'hidden': element is hidden or text is absent. 'attached': element exists in DOM. 'detached': element removed from DOM. |
text | string | Wait for this text to appear (or disappear if state='hidden') in the page body. |
timeout_ms | integer | Maximum time to wait in milliseconds. Default: 10000 (10 seconds). Max: 300000 (5 minutes). |
window_label | string | The window to observe. Defaults to 'main'. |
restart_app
Restarts the Tauri application and waits for it to come back online. Use when the app is in a broken state, unresponsive, or needs a fresh start. If the app is completely frozen, it will be force-killed. This is a destructive operation — all in-memory state will be lost. NOT available in dev mode (`tauri dev`): the app will refuse and suggest asking the user to restart the dev command; use navigate(action='reload') to reload the frontend instead.
| Parameter | Type | Description |
|---|---|---|
delay_ms | integer | Delay in milliseconds before the app restarts (default 500). Allows in-flight operations to complete. |
query_logs
Query buffered logs from the Tauri app (both Rust-side log!() output and webview console.* calls). Use mode='summary' first to see counts and recent warnings/errors without flooding context. Then use mode='tail' with filters (level, source, contains) to drill into specific logs. Use since_id with the nextCursor from a previous call to follow new logs incrementally. Buffer is bounded — droppedTotal tells you if older logs were evicted.
| Parameter | Type | Description |
|---|---|---|
between | string | Marker tag — return only entries between the two most recent log_mark calls with this id. If only one marker exists, the upper bound is 'now'. Use this to capture exactly the logs produced by an act… |
contains | string | Case-insensitive substring filter on the message. |
format | string | 'compact' = one line per entry (smaller). 'json' = full JSON for entries. |
head | boolean | If true, return oldest matching entries; default returns most recent (tail). |
include_markers | boolean | If true, include the marker sentinel entries themselves in the result. Default false. |
include_plugin | boolean | If true, include the MCP plugin's own instrumentation logs (socket command tracing, JS bridge chatter). Hidden by default so app logs aren't buried. Default false. |
level | string | Minimum severity to include. 'warn' returns warn+error only. |
limit | integer | Max entries to return (1-1000). Default 100. |
mode | string | 'summary' returns counts + last 10 warn/error entries (small payload). 'tail' returns matching entries. |
since_id | integer | Pagination cursor — only return entries with id > this. Pair with nextCursor from prior call. |
since_ms | integer | Only return entries with timestamp (unix epoch ms) >= this. Prefer since_id or between (log_mark) for 'what just happened' queries — they don't require knowing the current time. |
source | string | Filter to logs from Rust backend ('rust') or webview console ('js'). |
log_mark
Insert a marker into the log buffer. Use to bracket an action: call once before the action, perform the action with other tools, then call again with the SAME id. Afterward, query_logs({ between: <id> }) returns exactly the logs produced between the two markers. If you only call it once, query_logs treats 'now' as the end — useful for 'show me everything since I started X'.
| Parameter | Type | Description |
|---|---|---|
id * | string | Marker tag. Reuse the same id for the matching begin/end pair. Examples: 'click-submit', 'navigate-settings', 'type-search'. |
note | string | Optional free-form description attached to the marker entry (e.g. 'about to click Save'). |
manage_ipc
Tauri IPC layer access — invoke backend commands and drive/observe events. Actions: 'invoke' calls a #[tauri::command] with JSON args through the app's real IPC path and returns the result (great for bisecting bugs into frontend vs Rust). 'emit' fires a Tauri event into the app. 'arm_event' registers a background listener BEFORE you act — tool calls run sequentially, so to assert 'clicking Save emits user-updated': arm_event → click → captured (kind=event) shows whether it fired; the listener auto-disarms after timeout_ms (default 60s). 'wait_event' blocks until a named event fires —…
| Parameter | Type | Description |
|---|---|---|
action * | string | IPC operation to perform. |
args | object | (invoke) Arguments object passed to the command. Keys should match the command's parameter names (camelCase as the frontend would send them). |
command | string | (invoke) Command name, e.g. 'get_user' or 'plugin:dialog|open'. |
event | string | (emit/wait_event/arm_event) Event name. |
kind | string | (captured) Filter by entry kind. |
limit | integer | (captured) Max entries to return (newest kept). Default 50. |
name_contains | string | (captured) Case-insensitive substring filter on command/event name. |
payload | (emit) JSON payload for the emitted event. | |
since_id | integer | (captured) Only entries with id greater than this — use the last seen id as a cursor. |
status | string | (captured) Filter by outcome. Tip: status='error' shows only failed invokes. |
timeout_ms | integer | (invoke/wait_event) Timeout in ms, default 10000. (arm_event) How long the listener stays armed, default 60000, max 300000. |
window_label | string | Target window for invoke (and emit, when set). Defaults to 'main'. |
read_text
Reads the visible text of elements matching a CSS selector — use this instead of execute_js querySelectorAll/innerText scraping. Returns per-element {tag, text, visible} plus requested attributes, with whitespace collapsed and output hard-capped (truncated flag set when clipped). Scope with scope_selector to keep results small. For element geometry/styles use inspect_element; for the full page structure use query_page(mode='map').
| Parameter | Type | Description |
|---|---|---|
selector * | string | CSS selector for the elements to read. |
all | boolean | Read all matches (up to limit). false = first match only. Default: true. |
attrs | array | Attribute names to include per element (e.g. ['aria-label','href','data-testid']). |
limit | integer | Maximum elements to return when all=true. Default: 20. |
max_chars | integer | Total character budget across all returned texts. Default: 4000. |
scope_selector | string | CSS selector to limit the search scope to one container. |
window_label | string | Target window. Defaults to 'main'. |
inspect_element
Returns bounding rect, computed styles, classList and attributes for elements matching a CSS selector — use this for visual/layout QA instead of execute_js getComputedStyle/getBoundingClientRect snippets. Default style set covers layout + color basics; pass style_props for specific properties (any CSS property name).
| Parameter | Type | Description |
|---|---|---|
selector * | string | CSS selector for the element(s) to inspect. |
all | boolean | Inspect all matches (up to limit). Default: false (first match only). |
limit | integer | Maximum elements when all=true. Default: 10. |
style_props | array | Computed style properties to return (e.g. ['padding-left','background-color']). Default: a standard layout/color set. |
window_label | string | Target window. Defaults to 'main'. |
dispatch_pointer
Dispatches a synthetic pointer/mouse gesture (full pointerdown→mousedown→pointerup→mouseup→click chains) on the EXACT element matched — no retargeting to interactive ancestors. Built for targets the click tool can't drive: canvas sub-regions (pass offset), modal backdrops, drag-and-drop, and hover states. Drag interpolates moves and also dispatches them on document (works with d3-drag; synthetic events bypass setPointerCapture). Events have isTrusted=false — handlers requiring trusted events won't fire; use mouse_action for native OS input.
| Parameter | Type | Description |
|---|---|---|
gesture * | string | Gesture to dispatch. |
selector_value * | string | CSS selector, or the ref number (as string) from query_page map mode. |
button | integer | 0=left, 1=middle, 2=right. Default: 0. |
modifiers | array | Modifier keys held during the gesture. |
offset | object | Origin in px from the element's top-left corner. Default: element center. Essential for canvas hit-testing. |
selector_type | string | How to find the element. Default: 'css'. |
steps | integer | Interpolated move events for drag. Default: 8. |
to | object | Drag destination: absolute viewport {x,y} OR relative {dx,dy} from the origin. |
window_label | string | Target window. Defaults to 'main'. |
app_bridge
Calls helpers the host app registered via window.__MCP_BRIDGE__.register(name, fn, description) — the sanctioned way to read app state (store snapshots) or trigger app-level actions, instead of execute_js against app internals. ALWAYS run action='list' first to discover what the app exposes. Helpers may be async; results are JSON-serialized and truncated at max_chars.
| Parameter | Type | Description |
|---|---|---|
action * | string | 'list' enumerates registered helpers with descriptions. 'call' invokes one. |
args | array | (call) Positional arguments passed to the helper. |
max_chars | integer | (call) Result size cap. Default: 20000. |
name | string | (call) Helper name from the list. |
timeout_ms | integer | (call) Max time for the helper to resolve. Default: 10000. |
window_label | string | Target window (each window has its own registry). Defaults to 'main'. |