tauri-plugin-mcp-server

v0.3.1
tauri-plugin-mcp-server Checked 5 days ago Published 4 months ago

MCP 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.

ParameterTypeDescription
audiencestringHint for who should consume the image. 'user' = low priority for model, 'assistant' = high priority for model, 'both' = default behavior.
inlinebooleanIf true, return full-resolution base64 image inline instead of saving to disk. Default: false (saves to disk with small thumbnail).
max_size_mbnumberMaximum file size in MB. Image will be compressed to fit. Default: 1.0.
max_widthnumberMaximum image width in pixels. Images wider than this will be resized. Default: 1024.
output_dirstringDirectory to save screenshot file to. Defaults to system temp directory.
qualitynumberJPEG quality (1-100). Lower values produce smaller images. Default: 70.
window_labelstringWindow 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…

ParameterTypeDescription
mode *stringWhat 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.
deltaboolean(map) Return only changes since last call. Default: false.
find_scope_selectorstring(find_element) CSS selector limiting the search to one container.
include_contentboolean(map) Include page text content. Default: true.
include_metadataboolean(map) Include structured page metadata (JSON-LD, OpenGraph, description). Default: true.
interactive_onlyboolean(map) Only return interactive elements. Default: false.
matchstring(find_element, text selector) Text match mode. Default: exact first, then contains.
max_depthinteger(map) Max DOM tree depth to recurse.
max_wait_msinteger(map) Max wait for DOM stability in ms. Default: 3000.
nthinteger(find_element) Pick the nth match (0-based). Default: 0.
quiet_msinteger(map) Milliseconds of mutation silence for stability. Default: 300.
scope_selector(map) CSS selector(s) to limit scan scope.
selector_typestring(find_element) Selector type. 'ref' uses numbered reference from map mode. 'css' accepts any CSS selector.
selector_valuestring(find_element) Selector value. For 'ref', the ref number as string.
should_clickboolean(find_element) Click the element once found. Default: false.
timeout_secsinteger(map) Rust-side timeout in seconds. Default: 10. Max: 300 (5 minutes).
wait_for_stableboolean(map) Wait for DOM mutations to settle before scanning. Default: false.
window_labelstringThe 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…

ParameterTypeDescription
buttonstringMouse button. Default: 'left'.
click_typestringClick type. 'double' sends two rapid clicks. Default: 'single'.
matchstring(text selector) Text match mode. Default: exact first, then contains.
nthintegerPick the nth match (0-based) when the selector hits multiple elements. Default: 0.
scope_selectorstringCSS selector limiting the search to one container (e.g. '.sidebar'). Applies to css/class/tag/text selectors.
selector_typestringSelector type to find element. 'ref' uses numbered ref from query_page map mode. 'css' accepts any CSS selector.
selector_valuestringSelector value. For 'ref', provide the ref number as string.
window_labelstringTarget window. Defaults to 'main'.
xnumberX coordinate in CSS pixels. Required if no selector provided.
ynumberY 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.

ParameterTypeDescription
delay_msintegerDelay between keystrokes in ms. Default varies by mode.
fieldsarrayArray of form fields to fill. Each needs either a ref or selector_type+selector_value.
filesarrayAbsolute 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_msinteger(focused mode) Initial delay before typing begins in ms.
selector_typestringSelector type for targeting a specific element. 'ref' uses numbered reference from query_page map mode. 'css' accepts any CSS selector.
selector_valuestringSelector value. For 'ref', provide the ref number as string.
submit_refinteger(fields mode) Ref of submit button to click after filling all fields.
textstringText to type. Required unless using 'fields' mode.
window_labelstringTarget 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…

ParameterTypeDescription
key *stringKey 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', '/').
modifiersarrayModifier keys held during the press. 'cmd' maps to metaKey, 'ctrl' to ctrlKey.
repeatintegerNumber of times to press the key (e.g. ArrowDown x3). Default 1.
selector_typestringOptional: selector type to focus a target element before pressing. 'ref' uses numbered refs from query_page map mode.
selector_valuestringSelector value. For 'ref', provide the ref number as string.
window_labelstringTarget 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).

ParameterTypeDescription
action *stringThe 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.
directionstring(scroll) Scroll direction. Default: 'down'.
end_xnumber(drag) End X coordinate.
end_ynumber(drag) End Y coordinate.
relativeboolean(hover) If true, x/y are relative offsets from current position.
to_bottomboolean(scroll) Scroll to bottom of page.
to_refinteger(scroll) Scroll to bring this element ref into view.
to_topboolean(scroll) Scroll to top of page.
window_labelstringTarget window. Defaults to 'main'.
xnumber(hover/drag) Target X coordinate in CSS pixels.
ynumber(hover/drag) Target Y coordinate in CSS pixels.

navigate

Controls webview navigation. 'goto' navigates to a URL. 'back'/'forward' move through browser history (use delta for multi-step jumps). 'reload' reloads the current page. Use query_page(mode='state') afterward to confirm navigation completed.

ParameterTypeDescription
action *stringNavigation action to perform.
deltainteger(back/forward) History steps to jump via history.go(delta): negative=back, positive=forward. The sign alone decides direction — when delta is set, the action value is ignored (action='back' with del…
urlstring(goto) URL to navigate to. Required for 'goto'.
window_labelstringTarget window. Defaults to 'main'.

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.

ParameterTypeDescription
code *stringJavaScript 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_msintegerMax execution time in milliseconds. Default: 5000. Max: 300000 (5 minutes). Raise this for code that awaits slow promises.
window_labelstringTarget 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).

ParameterTypeDescription
action *stringAction 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 *stringWhich storage to manage.
keystring(local_storage) Key name. Required for get/set/remove.
urlstring(cookies) URL to get cookies for. Required for 'get_for_url'.
valuestring(local_storage) Value to store. Required for 'set'.
window_labelstringTarget 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.

ParameterTypeDescription
action *stringThe window management action to perform.
ainteger(set_background_color) Alpha component (0-255). 255=opaque.
binteger(set_background_color) Blue component (0-255).
enabledboolean(set_auto_resize) Whether to enable auto-resize.
ginteger(set_background_color) Green component (0-255).
heightinteger(set_size) Height in pixels.
rinteger(set_background_color) Red component (0-255).
scalenumber(set_zoom) Zoom scale factor. 1.0 = 100%.
widthinteger(set_size) Width in pixels.
window_labelstringTarget window. Defaults to 'main'.
xinteger(set_position) X coordinate in screen pixels.
yinteger(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.

ParameterTypeDescription
refintegerRef number (from query_page map mode) of the element to wait for.
selectorstringCSS selector for the element to wait for.
statestringCondition 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.
textstringWait for this text to appear (or disappear if state='hidden') in the page body.
timeout_msintegerMaximum time to wait in milliseconds. Default: 10000 (10 seconds). Max: 300000 (5 minutes).
window_labelstringThe 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.

ParameterTypeDescription
delay_msintegerDelay 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.

ParameterTypeDescription
betweenstringMarker 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…
containsstringCase-insensitive substring filter on the message.
formatstring'compact' = one line per entry (smaller). 'json' = full JSON for entries.
headbooleanIf true, return oldest matching entries; default returns most recent (tail).
include_markersbooleanIf true, include the marker sentinel entries themselves in the result. Default false.
include_pluginbooleanIf 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.
levelstringMinimum severity to include. 'warn' returns warn+error only.
limitintegerMax entries to return (1-1000). Default 100.
modestring'summary' returns counts + last 10 warn/error entries (small payload). 'tail' returns matching entries.
since_idintegerPagination cursor — only return entries with id > this. Pair with nextCursor from prior call.
since_msintegerOnly 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.
sourcestringFilter 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'.

ParameterTypeDescription
id *stringMarker tag. Reuse the same id for the matching begin/end pair. Examples: 'click-submit', 'navigate-settings', 'type-search'.
notestringOptional 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 —…

ParameterTypeDescription
action *stringIPC operation to perform.
argsobject(invoke) Arguments object passed to the command. Keys should match the command's parameter names (camelCase as the frontend would send them).
commandstring(invoke) Command name, e.g. 'get_user' or 'plugin:dialog|open'.
eventstring(emit/wait_event/arm_event) Event name.
kindstring(captured) Filter by entry kind.
limitinteger(captured) Max entries to return (newest kept). Default 50.
name_containsstring(captured) Case-insensitive substring filter on command/event name.
payload(emit) JSON payload for the emitted event.
since_idinteger(captured) Only entries with id greater than this — use the last seen id as a cursor.
statusstring(captured) Filter by outcome. Tip: status='error' shows only failed invokes.
timeout_msinteger(invoke/wait_event) Timeout in ms, default 10000. (arm_event) How long the listener stays armed, default 60000, max 300000.
window_labelstringTarget 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').

ParameterTypeDescription
selector *stringCSS selector for the elements to read.
allbooleanRead all matches (up to limit). false = first match only. Default: true.
attrsarrayAttribute names to include per element (e.g. ['aria-label','href','data-testid']).
limitintegerMaximum elements to return when all=true. Default: 20.
max_charsintegerTotal character budget across all returned texts. Default: 4000.
scope_selectorstringCSS selector to limit the search scope to one container.
window_labelstringTarget 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).

ParameterTypeDescription
selector *stringCSS selector for the element(s) to inspect.
allbooleanInspect all matches (up to limit). Default: false (first match only).
limitintegerMaximum elements when all=true. Default: 10.
style_propsarrayComputed style properties to return (e.g. ['padding-left','background-color']). Default: a standard layout/color set.
window_labelstringTarget 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.

ParameterTypeDescription
gesture *stringGesture to dispatch.
selector_value *stringCSS selector, or the ref number (as string) from query_page map mode.
buttoninteger0=left, 1=middle, 2=right. Default: 0.
modifiersarrayModifier keys held during the gesture.
offsetobjectOrigin in px from the element's top-left corner. Default: element center. Essential for canvas hit-testing.
selector_typestringHow to find the element. Default: 'css'.
stepsintegerInterpolated move events for drag. Default: 8.
toobjectDrag destination: absolute viewport {x,y} OR relative {dx,dy} from the origin.
window_labelstringTarget 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.

ParameterTypeDescription
action *string'list' enumerates registered helpers with descriptions. 'call' invokes one.
argsarray(call) Positional arguments passed to the helper.
max_charsinteger(call) Result size cap. Default: 20000.
namestring(call) Helper name from the list.
timeout_msinteger(call) Max time for the helper to resolve. Default: 10000.
window_labelstringTarget window (each window has its own registry). Defaults to 'main'.