Repository avatar
Developer Tools
v1.2.0
active

fxpilot

io.github.dbuedenbender/fxpilot

Drive a running JavaFX app from Claude: inspect, click, type and test.

Documentation

FxPilot

build Maven Central Javadoc

FxPilot demo: an AI agent adds a customer to a running JavaFX app after a plain-language request

Demo: the agent turns "Add the customer Acme Tools from Austria, wholesale, credit limit 20,000" into fx_* calls, fills the form, saves it and verifies the result. Looping 30-second preview — full demo with setup, deny list and replay (1:15).

Drive a running JavaFX app with plain-language requests. No test code — and with the Java agent, no changes to the app at all.

FxPilot lets Claude Code read the scene graph, click, enter text, select items and take screenshots. It has two parts:

Claude Code ──stdio/MCP──> fxpilot.jar (MCP server) ──HTTP 127.0.0.1:<port>──> fxpilot.jar (inside the app)
  • fxpilot.jar contains both sides: java -jar fxpilot.jar starts the MCP server, and -javaagent:fxpilot.jar (or a Maven dependency) starts the HTTP endpoint inside the app.

Requirements: JDK 11 or newer, JavaFX 11 or newer. The jar is compiled for Java 11 (--release 11); CI builds it on JDK 17, runs the tests on JDK 21 and starts the MCP server from the built jar on JDK 11; the endpoint inside a JavaFX app is not tested on a JDK 11 runtime. The app only needs javafx-controls; javafx-web and javafx-swing are optional. If JavaFX is missing or older than 11, the endpoint does not start and logs the reason to stderr. With -javaagent, the toolkit is usually not running yet when the agent starts, so only the presence of JavaFX is checked there.

Modular apps: fxpilot.jar is the JPMS module io.github.dbuedenbender.fxpilot, which exports io.github.dbuedenbender.fxpilot (FxPilotServer, FxPilotAgent) and io.github.dbuedenbender.fxpilot.mcp (FxPilotMcpServer). A modular app puts the jar on the module path and adds requires io.github.dbuedenbender.fxpilot;; the module brings jdk.httpserver along. If a modular app keeps FxPilot on the class path instead, start it with --add-modules jdk.httpserver. The package io.github.dbuedenbender.fxpilot.internal is shared code between endpoint and MCP server; it is not exported and not part of the API, even though its classes are public on the class path. FxPilot needs no opens from the app; only fx_property on the app's own classes needs their package exported to io.github.dbuedenbender.fxpilot (otherwise 403 PROPERTY_NOT_ACCESSIBLE). examples/modular-demo shows the setup.

Use with Claude

SurfaceInstall
Claude Code pluginclaude plugin marketplace add dbuedenbender/fxpilot then claude plugin install fxpilot@fxpilot
Claude DesktopOpen fxpilot-1.2.0.mcpb from the latest release
Manual MCPclaude mcp add --scope user fxpilot -e FXPILOT_URL=http://127.0.0.1:8765 -- java -jar C:\path\to\fxpilot.jar

The plugin downloads the pinned jar from Maven Central on first start; the Desktop bundle ships it. Both include an install guide for Claude. The app still needs the endpoint: -javaagent:fxpilot.jar=port=8765 or the Maven dependency with FxPilotServer.startIfEnabled() and -Dfxpilot.port=8765. Then ask Claude to call fx_health and fx_get_view.

The plugin is discoverable as io.github.dbuedenbender/fxpilot in the official MCP Registry. Details, safety settings and troubleshooting: docs/use-with-claude.md and the Claude setup page.

Quick start

  1. Start a JavaFX app with the agent:

    java -javaagent:C:\path\to\fxpilot.jar=port=8765,token=auto -jar YourApp.jar
    

    token=auto generates a random token and writes it to a per-user token file, where the MCP server picks it up. This is also the default when the token is omitted, so the endpoint is protected without further configuration; use token=none to turn authentication off on a single-user machine.

  2. Register the MCP server for Claude Code:

    claude mcp add --scope user fxpilot -e FXPILOT_URL=http://127.0.0.1:8765 ^
      -- java -jar C:\path\to\fxpilot.jar
    
  3. Ask the MCP client to call fx_health and then fx_get_view.

Ready-to-copy examples are in examples/: a small JavaFX demo app, MCP configurations and a replay plan.

On Windows, these installers automate the local setup and cache the jar under %LOCALAPPDATA%\FxPilot:

scripts\install-claude-desktop.cmd
scripts\install-claude-code.cmd

If you do not want to keep the jar locally, use the launcher scripts in scripts/. They download the published jar from Maven Central into a local cache and then start the MCP server. Claude.ai web connectors need a remote MCP endpoint; the local launcher is for Claude Code and Claude Desktop.

One-time setup

  1. Build the module and install it into the local Maven repository:

    cd C:\path\to\fxpilot
    mvnw.cmd -DskipTests clean install
    

    On Linux and macOS use ./mvnw instead of mvnw.cmd. The wrapper pins Maven 3.10.2 and downloads it on the first run, so no Maven installation is needed.

    The jar is then in target\fxpilot.jar and in the local Maven repository under io\github\dbuedenbender\fxpilot\. This installs without running the tests. The test suite needs JDK 21 (see Development); set JAVA_HOME to a JDK 21 and run mvnw.cmd verify to execute it.

  2. Register the MCP server globally for Claude Code (applies to all projects):

    claude mcp add --scope user fxpilot -e FXPILOT_URL=http://127.0.0.1:8765 -- java -jar C:\path\to\fxpilot\target\fxpilot.jar
    

    If java is not on the PATH, give the full path to a java.exe. A JRE 11 or newer is enough.

Adding it to an app

Option A: Maven dependency (your own projects)

pom.xml:

<dependency>
    <groupId>io.github.dbuedenbender</groupId>
    <artifactId>fxpilot</artifactId>
    <version>1.2.0</version>
</dependency>

In the Application class:

import io.github.dbuedenbender.fxpilot.FxPilotServer;

@Override
public void start(Stage stage) throws Exception {
    // ...
    stage.show();
    FxPilotServer.setNotes("Button #deleteAll deletes data in the database, do not click.");
    FxPilotServer.startIfEnabled();
}

@Override
public void stop() throws Exception {
    FxPilotServer.stop();
    super.stop();
}

The endpoint is only active with the VM option -Dfxpilot.port=8765. All settings (port, token, deny, read-only, dangerous) are read from system properties or environment variables when the endpoint starts and apply to the whole process; to set them in code, call System.setProperty("fxpilot.deny", "#deleteAll") and so on before startIfEnabled().

With javafx-maven-plugin, a separate execution works well:

<execution>
    <!-- Usage: mvn clean javafx:run@fxpilot -->
    <id>fxpilot</id>
    <configuration>
        <options>
            <option>-Dfxpilot.port=8765</option>
        </options>
    </configuration>
</execution>

Option B: Java agent (no code changes)

For third-party or older apps, one VM option is enough:

-javaagent:C:\path\to\fxpilot\target\fxpilot.jar=port=8765

A token is generated by default (token=auto, see Security); pass token=secret for a static token or token=none to turn authentication off. Pass hints for the agent with -Dfxpilot.notes="...".

Configuration

Endpoint (inside the app):

SettingSystem propertyEnvironment variableAgent argument
Port (enables the endpoint)fxpilot.portFXPILOT_PORTport=
Token (header X-FxPilot-Token); unset/auto = generated, none = offfxpilot.tokenFXPILOT_TOKENtoken=
Directory of the token filesfxpilot.tokenDirFXPILOT_TOKEN_DIR
Hints for the agentfxpilot.notes or FxPilotServer.setNotes()
Strict selectors (ambiguous = error)fxpilot.strictSelectorsFXPILOT_STRICT
Read-only (all POSTs rejected)fxpilot.readonlyFXPILOT_READONLY
Denied selectors (comma list)fxpilot.denyFXPILOT_DENY
Dangerous operations (default true)fxpilot.dangerousFXPILOT_DANGEROUS
Audit log (JSONL file, metadata only)fxpilot.auditFileFXPILOT_AUDIT_FILE
Wait for an action before pending (ms, default 2000)fxpilot.actionTimeoutMsFXPILOT_ACTION_TIMEOUT_MS

The audit log records one line per request (time, method, path, operation, selector, window, action) and the error code of failed requests. It never contains typed text, values or messages, and rotates to <file>.1 at 8 MiB.

GET /health reports the version, the HTTP API version (apiVersion), uptime, request count, the last error code, the security posture (readonly, dangerous, token, audit) and any open modal dialogs; GET /operations lists the operations behind /exec, grouped into read, write and dangerous.

MCP server (java -jar fxpilot.jar):

Environment variableMeaning
FXPILOT_URLDefault endpoint, http://127.0.0.1:8765
FXPILOT_TOKENStatic token for the endpoint in FXPILOT_URL (token=<secret>). Endpoints started with the default token=auto need no variable: the MCP server reads their token file. The token is never sent to a service the client merely named on another port.
FXPILOT_TOKEN_DIRDirectory of the token files, same default as the endpoint
FXPILOT_TOOLSTool profile: core, standard or all (default standard), see Tool profiles
FXPILOT_DANGEROUSfalse hides fx_web, fx_property and fx_image, rejects closing windows and tabs, reading the clipboard and dangerous fx_exec operations, and lets the MCP server write plans, baselines and reports and read plans and baselines only below its working directory (symbolic links resolved)
FXPILOT_EXECfalse hides fx_exec, so only the tools of the active profile are reachable (on by default in 1.x)
FXPILOT_JAVALauncher scripts only: the Java 11+ executable that runs the MCP server, when java on PATH is older

To drive an application on another machine, run the MCP server there and carry its stdio over SSH; see docs/remote-access.md.

Several apps at once

Each app gets its own port. By default, the global MCP server talks to the port from FXPILOT_URL, but every tool has an optional port parameter. So you can tell the agent, for example: "Use the app on port 8766." Each app generates its own token by default, and the MCP server reads the token file that belongs to the port.

Tools

ToolPurpose
fx_healthChecks whether the app is reachable; returns window titles and app hints (notes)
fx_list_windowsAll open windows (main window, dialogs, popups)
fx_get_viewCompact snapshot of visible, actionable nodes with ref paths (valid while the scene structure stays the same); start here
fx_get_treeScene graph as JSON (fx:id, text, values, items, rows, state, position)
fx_get_nodeState of a single node
fx_findAll nodes matching a selector, with count (for disambiguation and assertions)
fx_clickFires a button or simulates a mouse click
fx_hoverFires mouse-enter/move events to trigger hover handlers and :hover CSS
fx_set_text / fx_typeSets text, or types it character by character (fires onKeyReleased); commit=enter|tab|focus commits the value afterwards
fx_press_keySends a key, e.g. ENTER, TAB, ESCAPE, A, DIGIT1; without selector to the focused node. Letters, digits and SPACE also type their character; use fx_type for text
fx_selectSelects an entry in a ComboBox, ChoiceBox, ListView, TableView, TreeView, TreeTableView or TabPane
fx_set_expandedExpands or collapses an item in a TreeView/TreeTableView
fx_set_valueSets a Slider, Spinner, DatePicker (2026-11-18) or ColorPicker (#ff0000)
fx_scrollScrolls a ScrollPane, ListView, TableView or TreeView; each step moves 10 % of the scroll range
fx_set_checkedSets a CheckBox or toggle
fx_click_menuFires a menu entry by menu and item text, without opening the popup
fx_screenshotPNG of a window or node
fx_wait_forWaits until a node matches text/value/count/visible/enabled checks
fx_assertChecks node state (text, value, visible, enabled, checked, existence, count)
fx_batchRuns several tool calls in one request
fx_screenshot_diffPixel diff against a baseline PNG (visual regression, with tolerance)
fx_record_startStarts recording a replayable plan
fx_record_stopReturns or writes the JSON plan
fx_replayReplays a plan against the app, reports passed/failed steps
fx_robot_clickReal mouse click at coordinates, only needed for WebView or Canvas
fx_robot_dragReal mouse drag between two coordinates (drag and drop, canvas)

Selectors: fx:id (textField), CSS (#button, .check-box, ComboBox), id=customer.name for a literal fx:id (also IDs containing dots; id=customer.name@2 picks the third match), accessible=Save for accessible text/help, label=Name for a Label linked with labelFor, ref=VBox[0]/Button[2] for a path returned by fx_find/fx_get_tree, uid=n17 for the handle that fx_get_view, fx_get_node and fx_find report (it stays valid while the node lives, also when the layout around it changes; a node that is gone gives STALE_UID), tooltip=Move up (or tooltip*=) for icon-only buttons, text=Save for an exact label match (visible nodes are preferred over hidden duplicates), text*=Sav for a substring, or role=button for a JavaFX type (button, textbox, checkbox, combobox, list, table, tree, tab, menu, slider, spinner, datepicker, label, image). within=<selector> limits the search to a subtree, nth=<index> (or nth=last) picks a specific match. Windows can be addressed by index or title:<text>. Unique fx:ids in the FXML files make FxPilot much more reliable; fx_get_view returns a compact list of visible actionable nodes with stable ref paths for foreign UIs.

Tool profiles

Every tool definition is sent with each request, and the all profile's 57 tools cost context and make the choice harder for the model. FXPILOT_TOOLS limits what tools/list offers; the default is standard, which covers reading, driving, waiting, asserting, screenshots and record/replay:

ProfileTools
corefx_health, fx_list_windows, fx_get_view, fx_get_node, fx_find, fx_click, fx_set_text, fx_type, fx_press_key, fx_select, fx_set_value, fx_set_checked, fx_wait_for, fx_assert, fx_screenshot, fx_batch, fx_exec
standard (default)core plus fx_get_tree, fx_hover, fx_set_expanded, fx_scroll, fx_scroll_to, fx_click_menu, fx_menu, fx_context_menu, fx_hotkey, fx_focus, fx_popup, fx_text, fx_selection, fx_table, fx_tree, fx_tab, fx_window, fx_wait_for_window, fx_screenshot_diff, fx_record_start, fx_record_stop, fx_replay, fx_retry, fx_idle
allevery tool: the robot, clipboard, canvas, WebView, chart, media, image and property tools on top of standard

Set FXPILOT_TOOLS=all when a session needs those extended tools. Call fx_health first either way: it reports the app, and a tool that the profile hides is rejected with a hint that names the setting.

fx_exec is part of every profile, so no operation becomes unreachable. A hidden tool called by name fails with a hint instead of running. Recorded plans replay regardless of the profile, but not past FXPILOT_DANGEROUS=false.

Each tool carries MCP annotations: read-only tools have readOnlyHint: true, tools that drive the UI destructiveHint: true (the app may have real side effects), and all of them openWorldHint: false. MCP clients can use this to allow read-only tools without asking.

Extended tools

The extended tools are experimental in 1.x: their names and arguments may still change in a minor release. Everything they do is also reachable through fx_exec.

ToolPurpose
fx_hotkeyKey combinations such as CTRL+S or CTRL+SHIFT+T
fx_clipboardRead or write the system clipboard (reading counts as dangerous, it may hold other apps' data)
fx_wheelReal ScrollEvent (also for custom scroll handlers)
fx_scroll_toScroll to a row/node, set ScrollPane vvalue/hvalue or ScrollBar value
fx_dragSynthetic node-to-node drag and drop
fx_focusMove keyboard focus
fx_popup / fx_stepOpen/close popups; increment/decrement Slider, Spinner, DatePicker, ScrollBar
fx_textClear, append, select range, caret, replace, copy/paste/cut
fx_select_rows / fx_selectionMulti-select rows, select all or clear selection
fx_tableRows (filtered, paged, as a snapshot), diff against a snapshot, cells, cell clicks (double click starts the editor), lookup editors, edit/set, sort, columns, selection and scrolling in TableView/TreeTableView
fx_treeExpand/collapse one item or all items in TreeView/TreeTableView
fx_tab / fx_accordion / fx_paginationTabs, accordion panes and pagination
fx_menu / fx_context_menuNested menu paths and context menus
fx_windowFocus, close, iconify, maximize, move and resize windows
fx_propertyRead/write JavaFX bean properties or Node.getProperties() values
fx_webWebView JavaScript execution, DOM query, click and HTML
fx_chartChart title, series and data points
fx_canvasCanvas pixel read and coordinate click
fx_mediaMediaView play/pause/stop/seek/volume/mute/rate
fx_imageSave an ImageView image as PNG; an existing file is only replaced with overwrite=true
fx_tooltip / fx_idleRead tooltips / wait for queued FX work
fx_wait_for_windowWait until a window with a matching title exists
fx_retryRetry a tool call until it succeeds; a tool that changes the UI is only retried after errors that show it did not start (force=true retries every error)
fx_execGeneric access to the extended operation set

fx_click understands button (PRIMARY/SECONDARY/MIDDLE), mode (fire or mouse), modifiers and requireVisible/requireEnabled. fx_press_key accepts modifiers, fx_assert checks selection, row counts, focus, progress, tooltips and arbitrary properties, and fx_screenshot accepts a crop region (x, y, width, height).

Examples:

fx_select(selector="customerTable", value="Sample Inc. | CH")
fx_select(selector="customerTable", index=3)
fx_set_value(selector="deliveryDate", value="2026-12-01")
fx_click_menu(menu="File", item="Save as...")
fx_set_expanded(selector="orderTree", value="Order 1001 | open")
fx_select(selector="orderTree", value="Order 1001 | open")
fx_click(selector="role=button", within="#dialog", nth=1)
fx_wait_for(selector="statusLabel", text="Saved", timeoutMs=5000)   # at most 120000
fx_screenshot_diff(selector="#statusPane", baseline="fxpilot/status.png", tolerance=0.005)

fx_batch runs several calls in one request, which keeps a multi-step interaction compact:

fx_batch(calls=[
  {"tool": "fx_set_text", "args": {"selector": "nameField", "text": "Sample Inc."}},
  {"tool": "fx_assert",   "args": {"selector": "nameField", "text": "Sample Inc."}},
  {"tool": "fx_click",    "args": {"selector": "okButton"}}
])

Tree tables: fx_get_node returns the visible rows (indented, cell | cell) and rowCount, so a tree that is collapsed only shows what is expanded. fx_set_expanded expands the parents automatically, and fx_select by row text also opens collapsed branches. If a tree has thousands of rows, maxDepth and full on fx_get_tree keep the output manageable.

Ambiguous selectors

A selector such as .button can match several nodes. Actions then use the first match and add "matches": 3 and a warning to the response, and fx_find lists all candidates:

fx_find(selector=".button")
fx_assert(selector=".button", count=3)

With -Dfxpilot.strictSelectors=true (or FXPILOT_STRICT=true), ambiguous actions fail instead of guessing:

{"error": "Selector '.button' matches 2 nodes: Button#ok \"OK\", Button#cancel \"Cancel\". Use a more specific selector, nth=<index>, or call fx_find to list them.",
 "code": "NODE_AMBIGUOUS",
 "details": {"selector": ".button", "matches": 2,
             "candidates": [{"type": "Button", "id": "ok", "text": "OK", "ref": "...", "uid": "n4"}, ...]}}

Errors carry details that tell the agent how to continue: the candidates of an ambiguous selector (pick one by uid=), and for NODE_NOT_FOUND nodes with a similar text or id (text=ok finds the button OK). The MCP server passes them on in the tool error.

Dialogs, forms and tables

These are the places where agents most often lose track of a real application.

Modal dialogs. An action whose handler opens a modal dialog (showAndWait, an Alert) returns status: "pending" with the dialog's title, message, buttons and defaultButton. Answer it first with fx_window(action="accept") / "dismiss" or a click on one of its buttons. Some applications open the dialog a moment later with Platform.runLater, e.g. after a validation; settleMs waits for that and reports it the same way:

fx_click(selector="saveButton", settleMs=500)
→ {"status": "done", "dialogs": [{"title": "Validation", "message": "Quantity must be positive", "buttons": ["OK"], "defaultButton": "OK"}], ...}

fx_window(action="close") goes through the same path as the title bar's X: an onCloseRequest handler can veto it (unsaved changes), and the answer reports stillOpen. force=true hides the window without asking.

Form fields. Many forms take a value only on ENTER or when the field loses focus. commit does that after the text is in the field; typed=true types the text key by key for filters and auto-completion:

fx_set_text(selector="quantity", text="12", commit="tab")
fx_set_text(selector="customerFilter", text="Samp", typed=true)

Table rows by content. row accepts Column=Value[;Column=Value] everywhere it accepts an index, so a step keeps working when the application sorts or inserts rows. No match gives ROW_NOT_FOUND, several matches NODE_AMBIGUOUS with the row indices. fx_table(action="rows") reads rows with where, cells, from/to and limit; a snapshot and a later diff show what an action changed:

fx_table(selector="orders", action="cell", row="Order=4711", column="State")
fx_table(selector="orders", action="rows", snapshot="before")
fx_click(selector="releaseButton")
fx_table(selector="orders", action="diff", snapshot="before", key="Order")
→ {"added": [], "removed": [], "changed": [{"key": "4711", "cells": {"State": {"before": "new", "after": "released"}}}], "unchanged": 41}

Cell clicks and lookup editors. fx_table(action="click") sends real mouse events into a cell: one click selects the row, clicks=2 starts the cell editor (or opens what the application opens on a double click), and the answer names an active editor as editor, so its parts can be addressed with within=uid=.... fx_table(action="lookup") starts a cell editor that contains a lookup button (a field plus "..."), clicks the button (buttonIndex, default 0) and reports a modal dialog as pending.

fx_table(selector="orders", action="click", row="Order=4711", column="State", clicks=2)
fx_table(selector="orders", action="lookup", row="Order=4711", column="Customer")

fx_select_rows no longer switches a single-selection table to multiple selection on its own; pass force=true if that is really wanted.

Record & Replay

A driven run can become a regression test. Record the actions while Claude works:

fx_record_start(name="checkout")
fx_set_text(selector="nameField", text="Sample Inc.")
fx_assert(selector="nameField", text="Sample Inc.")
fx_click(selector="okButton")
fx_assert(selector="resultLabel", text="Saved")
fx_record_stop(file="fxpilot/checkout.json")

Replay the plan against a running app, via the agent or from a normal shell (exit code 0 = pass, 1 = fail):

java -jar fxpilot.jar --replay fxpilot\checkout.json
java -jar fxpilot.jar --replay fxpilot\checkout.json --port 8766 --delay 500 --continue-on-error

Or as an MCP tool: fx_replay(file="fxpilot/checkout.json").

Replay supports variables and CI-friendly reporting:

java -jar fxpilot.jar --replay fxpilot\checkout.json --var customer="Sample Inc." --retry 3 --screenshot-on-failure --report fxpilot\replay.xml

--var key=value replaces ${key} in step arguments, --retry retries a failing step, --screenshot-on-failure writes fxpilot/failure-step-N.png, and --report writes a JUnit XML file.

Text entered into a PasswordField with fx_set_text, fx_type, fx_text or fx_exec is not written to the plan. The recording stores ${<fx:id>} instead (${password} if the field has no usable id, ${password2} for a second, different text) and lists these names under secrets. Secrets in ordinary text fields (a PIN, an API key) are marked by the caller: fx_set_text(selector="pin", text="4711", sensitive=true) records ${password} the same way. A replay without all of them fails before the first step: pass them with --var password=... or fx_replay(variables={"password": "..."}). The same holds for every other ${name} in the plan, so a forgotten --var never types a literal placeholder into the application.

Check a plan without touching the application, e.g. in a CI job before the app is up:

java -jar fxpilot.jar --replay fxpilot\checkout.json --dry-run --var customer=x
java -jar fxpilot.jar --replay fxpilot\checkout.json --list-steps

fx_replay accepts the same as dryRun and listSteps, and returns its result also as structuredContent (status, passed, failed, durationMs and the failing steps).

  • Recorded are mutating tools (fx_click, fx_set_text, fx_select, fx_set_value, fx_press_key, ...), fx_wait_for, fx_screenshot_diff and passing fx_assert calls. Reads and plain screenshots are not recorded.
  • The plan stores selectors and arguments, not node references, so it survives UI rebuilds as long as the selectors stay valid. If an fx:id changes, re-record.
  • The port argument is not recorded, so one plan runs against any app instance; --port overrides the target for replay.
  • fx_robot_click and fx_robot_drag record absolute scene coordinates and are sensitive to window position and display scaling.
  • Default delay between steps is 300 ms. Use --delay 0 / delayMs: 0 only for fully synchronous UIs.
  • Plan format: {"fxpilot":"<version>","planVersion":1,"name":"...","createdAt":"...","steps":[{"tool":"fx_click","args":{...}}]}. Plans without planVersion (recorded by 1.0 and 1.1) are version 1; a plan with a newer planVersion is rejected instead of being half understood.
  • Recordings contain the text you type, including passwords. Do not record credentials and do not commit plans with sensitive data.

Error codes

Every error response carries a stable code next to the human-readable message:

{"error": "No node matches selector 'okButton'", "code": "NODE_NOT_FOUND"}
CodeHTTPMeaning
UNAUTHORIZED / FORBIDDEN401 / 403Missing token or missing X-FxPilot-Client
UNKNOWN_ENDPOINT404Unknown path
METHOD_NOT_ALLOWED405Action called with GET
BODY_TOO_LARGE413Body above 1 MB
INVALID_SELECTOR400Selector empty or malformed
NODE_NOT_FOUND404No node matches the selector
NODE_AMBIGUOUS409Selector matches several nodes (strict mode), or a row condition matches several rows
STALE_UID404The node behind a uid= handle is gone or no longer showing
WINDOW_NOT_FOUND404Window index does not exist
ITEM_NOT_FOUND / ROW_NOT_FOUND / TAB_NOT_FOUND404Combo/list/table/tab entry missing
TREE_ITEM_NOT_FOUND / MENU_NOT_FOUND404Tree item or menu missing
UNSUPPORTED_NODE400Action not supported by this control
NOT_SCROLLABLE400Node has no scroll bar
INVALID_KEY / INVALID_VALUE / INVALID_NUMBER400Bad key, value or number
NODE_DISABLED / NO_CHILDREN409Menu item disabled / tree item has no children
NODE_HIDDEN409Node is not visible in the scene graph
UNSUPPORTED_ACTION400Operation is not possible for this control
PROPERTY_NOT_FOUND404JavaFX property does not exist
PROPERTY_NOT_ACCESSIBLE403Property getter of a class whose package the app's module does not export to FxPilot
WINDOW_ACTION_FAILED400Window action is not possible (not a Stage)
WEB_NOT_AVAILABLE400Node is not a WebView / WebView is unavailable
CHART_NOT_FOUND / CANVAS_NOT_FOUND400Node is not a chart/canvas
MEDIA_NOT_AVAILABLE / IMAGE_NOT_FOUND400No MediaPlayer / no image
INVALID_OPERATION400Unknown extended operation name
READ_ONLY / NODE_DENIED403Read-only mode / selector denied by fxpilot.deny
DANGEROUS_DISABLED403Operation disabled by fxpilot.dangerous=false
HOST_REJECTED / ORIGIN_REJECTED403Request not addressed to 127.0.0.1:<port>, or sent by a web page (DNS rebinding guard)
TOOLKIT_NOT_RUNNING503JavaFX toolkit is not running yet
FX_THREAD_TIMEOUT504FX thread busy for more than 10 s
INVALID_VALUE400Also: a boolean parameter that is not true or false (checked=yes is rejected instead of read as false)
ACTION_FAILED / INTERNAL_ERROR500Handler threw / unexpected error

Security

  • Without a port, no endpoint starts. Production launches are unaffected as long as the VM option is absent.
  • The endpoint binds to 127.0.0.1 only.
  • It only answers requests whose Host header is 127.0.0.1:<port>, localhost:<port> or [::1]:<port> and that carry no Origin header. Binding to loopback alone does not keep web pages out: a page on a domain that resolves to 127.0.0.1 (DNS rebinding) is same-origin with the endpoint. Browsers always send that domain in Host, so the check rejects them with 403 HOST_REJECTED. FxPilot 1.0.0 lacks this check, so update to 1.1.1 or set a token.
  • A token is required by default. Leaving fxpilot.token / FXPILOT_TOKEN unset behaves like token=auto: a random token per start is written to %LOCALAPPDATA%\FxPilot\ports\<port>.token (Windows) or ~/.fxpilot/ports/<port>.token; the MCP server reads it from there and the endpoint deletes it on stop() or, in agent mode, when the JVM ends. The file is written atomically and readable by the current user only (POSIX permissions on Linux and macOS, an ACL with a single entry on Windows), and an endpoint deletes only its own token, never the one a newer instance on the same port wrote. The token is sent in X-FxPilot-Token and compared in constant time.
  • token=none turns authentication off. Then every POST needs the header X-FxPilot-Client: <anything>. The MCP server sends it automatically. If you call the endpoint with curl yourself, add -H "X-FxPilot-Client: curl". An endpoint that accepts actions without a token says so on stderr at startup.
  • Request bodies are limited to 1 MB.
  • Mark buttons with real side effects (printing, database, machine control) with setNotes() or fxpilot.notes. Claude reads these hints through fx_health; they are not a technical lock.
  • -Dfxpilot.readonly=true rejects every action (POST) with 403 READ_ONLY; queries and screenshots keep working.
  • -Dfxpilot.deny=#deleteAll,.danger,text=Wipe is a real lock: actions on matching nodes or one of their ancestors fail with 403 NODE_DENIED. It also covers the indirect ways to trigger a control: keys sent to a denied focus owner, ENTER/ESCAPE when a denied button is the default/cancel button, accelerators of denied menu items in menu bars, MenuButtons and the context menus of controls, tabs and table columns, mnemonics (ALT+underlined letter) of denied controls, menu and context-menu items (matched by #id, .styleClass or text=), tabs (also by #id, .styleClass or text=), drag and drop, dialog buttons fired by fx_window accept|dismiss, and robot clicks at the coordinates of a denied node in any window at that screen position. Robot clicks outside the target window's scene, and coordinates that are not finite numbers, are always rejected (400), because the robot moves the real mouse. Scene accelerators registered as plain Runnables have no target node and cannot be matched.
  • -Dfxpilot.dangerous=false disables the escape hatches with 403 DANGEROUS_DISABLED: JavaScript in a WebView (fx_web execute, query, html and click), reflective setters (fx_property set), file writes (fx_image), closing windows and tabs, and reading the system clipboard. FXPILOT_DANGEROUS=false on the MCP server also hides these tools. They are still allowed by default in 1.x; set fxpilot.dangerous=false wherever the app controls real equipment or data.
  • PasswordField text is never returned: node snapshots show ***, fx_property reads only text-independent properties of a PasswordField (editable, promptText, disable ...; everything else, including custom values, gives 403 NODE_DENIED), text=/text*= selectors do not match it and error messages leave it out. Recorded plans replace text entered into a PasswordField with a variable (see Record & Replay); single keys sent with fx_press_key and clipboard content are still recorded as they are.
  • If a handler opens a modal dialog, the action returns status: pending with the dialog's title, message and buttons (see Dialogs, forms and tables). The dialog then shows up in fx_list_windows and can be operated normally, e.g. with fx_click on text=OK.
  • fxpilot.auditFile keeps a record of who did what (see Configuration). It holds metadata only, so it can be kept where the plans themselves would be too sensitive.
  • The MCP instructions tell the agent to treat text read from the application (labels, table cells, dialogs) as data, not as instructions; only the notes from fx_health come from the operator.

What FxPilot does not do

The supported platforms and the current limits are collected in docs/compatibility.md.

  • WebView DOM access is limited to the optional JavaScript bridge (fx_web); there is no browser-automation model for downloads, dialogs or cross-origin pages.
  • Canvas support is pixel/coordinate based (fx_canvas); there is no structured drawing model.
  • Native OS dialogs (file chooser, print dialog) cannot be automated through JavaFX. Charts are read-only; there is no data-point selection API.
  • Table/tree rows are matched as strings (cell | cell), not as domain objects. Direct cell writes are best effort and depend on the cell editor being present.
  • TreeTableView only exposes visible (expanded) rows; use fx_set_expanded/fx_tree to open branches.
  • Robot tools need the window in the foreground and are not reliable on multi-monitor setups with different scaling.
  • Media controls require a MediaPlayer exposed by the MediaView.

Troubleshooting

SymptomCause / fix
HTTP 503: JavaFX toolkit is not running (yet)The app is starting or has no FX thread yet. Wait and retry, or call fx_health until it answers.
Cannot reach the app at ...Wrong port, -Dfxpilot.port missing, or the app ended.
Nothing listens and stderr says JavaFX not foundThe app runs without JavaFX on the class/module path, or JavaFX is older than 11.
NoClassDefFoundError: com/sun/net/httpserver/HttpServerModular app with FxPilot on the class path: add --add-modules jdk.httpserver, or put fxpilot.jar on the module path.
Agent loads but prints "without port"Pass =port=8765 to -javaagent.
Address already in usePick another port per app.
ESCAPE does not close a dialogCall fx_press_key without a selector, so the event reaches the focused node and the scene.

How it compares to TestFX

TestFX drives a JavaFX app from the inside as a test library, with JUnit integration and headless support. FxPilot is not a test framework: it is a runtime endpoint for an AI agent, starts with one VM option or one method call, needs no test code, and works on any app including third-party ones. Use TestFX for regression suites, FxPilot for exploratory driving and verification while developing.

Development

mvnw.cmd test          :: unit, HTTP and headless UI tests
mvnw.cmd clean verify  :: full build with coverage report and gate, no signing
mvnw.cmd -Prelease,sbom deploy  :: release build, GPG-signs, uploads to Central and writes the SBOM
java -jar fxpilot.jar --replay plan.json  :: replay a recorded plan in CI

mvnw.cmd and ./mvnw run the Maven wrapper in this repository (Maven 3.10.2, downloaded on the first run). A local Maven installation works too, but the wrapper is what CI uses.

The code compiles against JavaFX 11, the oldest supported version. The UI tests start a real scene graph headless with Monocle on JavaFX 21, because JavaFX 11 crashes in its native font code on current JDKs; running the tests therefore needs JDK 21. CI builds the library with JDK 17 (-DskipTests clean package) and runs the full suite with JDK 21, so both cases stay covered. On a JDK 17 machine set JAVA_HOME to a JDK 21 for mvnw.cmd verify; otherwise the UI tests fail with UnsupportedClassVersionError.

The compiler runs with -Werror and an explicit list of -Xlint categories (see pom.xml), so a warning fails the build; fix warnings instead of suppressing them. mvnw.cmd verify fails if the line coverage drops below 78 % per package (85 % for the internal package; Codes holds only constants and is excluded; JaCoCo report in target/site/jacoco). Extra JVM options for the tests go into -Dsurefire.jvmArgs=....

The MCP server is part of the jar, so mvnw.cmd verify compiles and tests it.

Releases

mvnw.cmd -Prelease,sbom deploy signs the artifacts, writes a CycloneDX SBOM (target/bom.json) and uploads everything to the Central Portal. autoPublish is false, so review the deployment in the portal and release it there. Versioning follows the release policy.

The workflow .github/workflows/release.yml does the same for v* tags and publishes only on the tag that matches project.version (v1.2.0 for 1.2.0); a manual dispatch from a branch fails before anything is deployed. It also builds the fxpilot-<version>.mcpb Claude Desktop extension and attaches the jar, sources, Javadoc, SBOM, MCPB and SHA-256 checksums to a draft GitHub release, signs them with cosign and attests their build provenance. The mcp-registry workflow publishes server.json to the official MCP Registry. The build workflow runs a gitleaks secret scan over the full history. Required repository secrets:

SecretPurpose
MAVEN_CENTRAL_USERNAMECentral Portal token user
MAVEN_CENTRAL_PASSWORDCentral Portal token
MAVEN_GPG_PRIVATE_KEYASCII-armored GPG private key
MAVEN_GPG_PASSPHRASEKey passphrase

If the Central secrets are missing, the tag workflow succeeds and skips the Central upload. See docs/maven-central.md for namespace verification, GPG setup, token creation and the publish step.

git tag -a v1.2.0 -m "FxPilot 1.2.0"
git push origin v1.2.0

Once you have published the deployment in the portal, point the launcher scripts at it. The script also pins its SHA-256 from Maven Central, and LauncherScriptsTest checks that the three scripts agree:

scripts\pin-release.ps1 -Version 1.2.0
scripts/pin-release.sh 1.2.0

Contributing

Contributions are welcome. See CONTRIBUTING.md for the development setup and pull-request checklist. Security issues should be reported privately as described in SECURITY.md.

License

FxPilot is licensed under the Apache License 2.0 and may be used, modified and redistributed for commercial and non-commercial purposes. Redistributions must include LICENSE and NOTICE. Both files are also contained in the jar under META-INF/.

MCPB
https://github.com/dbuedenbender/fxpilot/releases/download/v1.2.0/fxpilot-1.2.0.mcpb
Install Command
# mcpb: https://github.com/dbuedenbender/fxpilot/releases/download/v1.2.0/fxpilot-1.2.0.mcpb