
fxpilot
io.github.dbuedenbender/fxpilot
Drive a running JavaFX app from Claude: inspect, click, type and test.
Documentation
FxPilot
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.jarcontains both sides:java -jar fxpilot.jarstarts 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.jaris the JPMS moduleio.github.dbuedenbender.fxpilot, which exportsio.github.dbuedenbender.fxpilot(FxPilotServer,FxPilotAgent) andio.github.dbuedenbender.fxpilot.mcp(FxPilotMcpServer). A modular app puts the jar on the module path and addsrequires io.github.dbuedenbender.fxpilot;; the module bringsjdk.httpserveralong. If a modular app keeps FxPilot on the class path instead, start it with--add-modules jdk.httpserver. The packageio.github.dbuedenbender.fxpilot.internalis 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 noopensfrom the app; onlyfx_propertyon the app's own classes needs their package exported toio.github.dbuedenbender.fxpilot(otherwise 403PROPERTY_NOT_ACCESSIBLE).examples/modular-demoshows the setup.
Use with Claude
| Surface | Install |
|---|---|
| Claude Code plugin | claude plugin marketplace add dbuedenbender/fxpilot then claude plugin install fxpilot@fxpilot |
| Claude Desktop | Open fxpilot-1.2.0.mcpb from the latest release |
| Manual MCP | claude 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
-
Start a JavaFX app with the agent:
java -javaagent:C:\path\to\fxpilot.jar=port=8765,token=auto -jar YourApp.jartoken=autogenerates 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; usetoken=noneto turn authentication off on a single-user machine. -
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 -
Ask the MCP client to call
fx_healthand thenfx_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
-
Build the module and install it into the local Maven repository:
cd C:\path\to\fxpilot mvnw.cmd -DskipTests clean installOn Linux and macOS use
./mvnwinstead ofmvnw.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.jarand in the local Maven repository underio\github\dbuedenbender\fxpilot\. This installs without running the tests. The test suite needs JDK 21 (see Development); setJAVA_HOMEto a JDK 21 and runmvnw.cmd verifyto execute it. -
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.jarIf
javais not on the PATH, give the full path to ajava.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):
| Setting | System property | Environment variable | Agent argument |
|---|---|---|---|
| Port (enables the endpoint) | fxpilot.port | FXPILOT_PORT | port= |
Token (header X-FxPilot-Token); unset/auto = generated, none = off | fxpilot.token | FXPILOT_TOKEN | token= |
| Directory of the token files | fxpilot.tokenDir | FXPILOT_TOKEN_DIR | |
| Hints for the agent | fxpilot.notes or FxPilotServer.setNotes() | ||
| Strict selectors (ambiguous = error) | fxpilot.strictSelectors | FXPILOT_STRICT | |
| Read-only (all POSTs rejected) | fxpilot.readonly | FXPILOT_READONLY | |
| Denied selectors (comma list) | fxpilot.deny | FXPILOT_DENY | |
Dangerous operations (default true) | fxpilot.dangerous | FXPILOT_DANGEROUS | |
| Audit log (JSONL file, metadata only) | fxpilot.auditFile | FXPILOT_AUDIT_FILE | |
Wait for an action before pending (ms, default 2000) | fxpilot.actionTimeoutMs | FXPILOT_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 variable | Meaning |
|---|---|
FXPILOT_URL | Default endpoint, http://127.0.0.1:8765 |
FXPILOT_TOKEN | Static 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_DIR | Directory of the token files, same default as the endpoint |
FXPILOT_TOOLS | Tool profile: core, standard or all (default standard), see Tool profiles |
FXPILOT_DANGEROUS | false 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_EXEC | false hides fx_exec, so only the tools of the active profile are reachable (on by default in 1.x) |
FXPILOT_JAVA | Launcher 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
| Tool | Purpose |
|---|---|
fx_health | Checks whether the app is reachable; returns window titles and app hints (notes) |
fx_list_windows | All open windows (main window, dialogs, popups) |
fx_get_view | Compact snapshot of visible, actionable nodes with ref paths (valid while the scene structure stays the same); start here |
fx_get_tree | Scene graph as JSON (fx:id, text, values, items, rows, state, position) |
fx_get_node | State of a single node |
fx_find | All nodes matching a selector, with count (for disambiguation and assertions) |
fx_click | Fires a button or simulates a mouse click |
fx_hover | Fires mouse-enter/move events to trigger hover handlers and :hover CSS |
fx_set_text / fx_type | Sets text, or types it character by character (fires onKeyReleased); commit=enter|tab|focus commits the value afterwards |
fx_press_key | Sends 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_select | Selects an entry in a ComboBox, ChoiceBox, ListView, TableView, TreeView, TreeTableView or TabPane |
fx_set_expanded | Expands or collapses an item in a TreeView/TreeTableView |
fx_set_value | Sets a Slider, Spinner, DatePicker (2026-11-18) or ColorPicker (#ff0000) |
fx_scroll | Scrolls a ScrollPane, ListView, TableView or TreeView; each step moves 10 % of the scroll range |
fx_set_checked | Sets a CheckBox or toggle |
fx_click_menu | Fires a menu entry by menu and item text, without opening the popup |
fx_screenshot | PNG of a window or node |
fx_wait_for | Waits until a node matches text/value/count/visible/enabled checks |
fx_assert | Checks node state (text, value, visible, enabled, checked, existence, count) |
fx_batch | Runs several tool calls in one request |
fx_screenshot_diff | Pixel diff against a baseline PNG (visual regression, with tolerance) |
fx_record_start | Starts recording a replayable plan |
fx_record_stop | Returns or writes the JSON plan |
fx_replay | Replays a plan against the app, reports passed/failed steps |
fx_robot_click | Real mouse click at coordinates, only needed for WebView or Canvas |
fx_robot_drag | Real 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:
| Profile | Tools |
|---|---|
core | fx_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 |
all | every 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.
| Tool | Purpose |
|---|---|
fx_hotkey | Key combinations such as CTRL+S or CTRL+SHIFT+T |
fx_clipboard | Read or write the system clipboard (reading counts as dangerous, it may hold other apps' data) |
fx_wheel | Real ScrollEvent (also for custom scroll handlers) |
fx_scroll_to | Scroll to a row/node, set ScrollPane vvalue/hvalue or ScrollBar value |
fx_drag | Synthetic node-to-node drag and drop |
fx_focus | Move keyboard focus |
fx_popup / fx_step | Open/close popups; increment/decrement Slider, Spinner, DatePicker, ScrollBar |
fx_text | Clear, append, select range, caret, replace, copy/paste/cut |
fx_select_rows / fx_selection | Multi-select rows, select all or clear selection |
fx_table | Rows (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_tree | Expand/collapse one item or all items in TreeView/TreeTableView |
fx_tab / fx_accordion / fx_pagination | Tabs, accordion panes and pagination |
fx_menu / fx_context_menu | Nested menu paths and context menus |
fx_window | Focus, close, iconify, maximize, move and resize windows |
fx_property | Read/write JavaFX bean properties or Node.getProperties() values |
fx_web | WebView JavaScript execution, DOM query, click and HTML |
fx_chart | Chart title, series and data points |
fx_canvas | Canvas pixel read and coordinate click |
fx_media | MediaView play/pause/stop/seek/volume/mute/rate |
fx_image | Save an ImageView image as PNG; an existing file is only replaced with overwrite=true |
fx_tooltip / fx_idle | Read tooltips / wait for queued FX work |
fx_wait_for_window | Wait until a window with a matching title exists |
fx_retry | Retry 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_exec | Generic 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_diffand passingfx_assertcalls. 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:idchanges, re-record. - The
portargument is not recorded, so one plan runs against any app instance;--portoverrides the target for replay. fx_robot_clickandfx_robot_dragrecord absolute scene coordinates and are sensitive to window position and display scaling.- Default delay between steps is 300 ms. Use
--delay 0/delayMs: 0only for fully synchronous UIs. - Plan format:
{"fxpilot":"<version>","planVersion":1,"name":"...","createdAt":"...","steps":[{"tool":"fx_click","args":{...}}]}. Plans withoutplanVersion(recorded by 1.0 and 1.1) are version 1; a plan with a newerplanVersionis 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"}
| Code | HTTP | Meaning |
|---|---|---|
UNAUTHORIZED / FORBIDDEN | 401 / 403 | Missing token or missing X-FxPilot-Client |
UNKNOWN_ENDPOINT | 404 | Unknown path |
METHOD_NOT_ALLOWED | 405 | Action called with GET |
BODY_TOO_LARGE | 413 | Body above 1 MB |
INVALID_SELECTOR | 400 | Selector empty or malformed |
NODE_NOT_FOUND | 404 | No node matches the selector |
NODE_AMBIGUOUS | 409 | Selector matches several nodes (strict mode), or a row condition matches several rows |
STALE_UID | 404 | The node behind a uid= handle is gone or no longer showing |
WINDOW_NOT_FOUND | 404 | Window index does not exist |
ITEM_NOT_FOUND / ROW_NOT_FOUND / TAB_NOT_FOUND | 404 | Combo/list/table/tab entry missing |
TREE_ITEM_NOT_FOUND / MENU_NOT_FOUND | 404 | Tree item or menu missing |
UNSUPPORTED_NODE | 400 | Action not supported by this control |
NOT_SCROLLABLE | 400 | Node has no scroll bar |
INVALID_KEY / INVALID_VALUE / INVALID_NUMBER | 400 | Bad key, value or number |
NODE_DISABLED / NO_CHILDREN | 409 | Menu item disabled / tree item has no children |
NODE_HIDDEN | 409 | Node is not visible in the scene graph |
UNSUPPORTED_ACTION | 400 | Operation is not possible for this control |
PROPERTY_NOT_FOUND | 404 | JavaFX property does not exist |
PROPERTY_NOT_ACCESSIBLE | 403 | Property getter of a class whose package the app's module does not export to FxPilot |
WINDOW_ACTION_FAILED | 400 | Window action is not possible (not a Stage) |
WEB_NOT_AVAILABLE | 400 | Node is not a WebView / WebView is unavailable |
CHART_NOT_FOUND / CANVAS_NOT_FOUND | 400 | Node is not a chart/canvas |
MEDIA_NOT_AVAILABLE / IMAGE_NOT_FOUND | 400 | No MediaPlayer / no image |
INVALID_OPERATION | 400 | Unknown extended operation name |
READ_ONLY / NODE_DENIED | 403 | Read-only mode / selector denied by fxpilot.deny |
DANGEROUS_DISABLED | 403 | Operation disabled by fxpilot.dangerous=false |
HOST_REJECTED / ORIGIN_REJECTED | 403 | Request not addressed to 127.0.0.1:<port>, or sent by a web page (DNS rebinding guard) |
TOOLKIT_NOT_RUNNING | 503 | JavaFX toolkit is not running yet |
FX_THREAD_TIMEOUT | 504 | FX thread busy for more than 10 s |
INVALID_VALUE | 400 | Also: a boolean parameter that is not true or false (checked=yes is rejected instead of read as false) |
ACTION_FAILED / INTERNAL_ERROR | 500 | Handler 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.1only. - It only answers requests whose
Hostheader is127.0.0.1:<port>,localhost:<port>or[::1]:<port>and that carry noOriginheader. Binding to loopback alone does not keep web pages out: a page on a domain that resolves to127.0.0.1(DNS rebinding) is same-origin with the endpoint. Browsers always send that domain inHost, so the check rejects them with 403HOST_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_TOKENunset behaves liketoken=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 onstop()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 inX-FxPilot-Tokenand compared in constant time. token=noneturns authentication off. Then every POST needs the headerX-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()orfxpilot.notes. Claude reads these hints throughfx_health; they are not a technical lock. -Dfxpilot.readonly=truerejects every action (POST) with 403READ_ONLY; queries and screenshots keep working.-Dfxpilot.deny=#deleteAll,.danger,text=Wipeis a real lock: actions on matching nodes or one of their ancestors fail with 403NODE_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,.styleClassortext=), tabs (also by#id,.styleClassortext=), drag and drop, dialog buttons fired byfx_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 plainRunnables have no target node and cannot be matched.-Dfxpilot.dangerous=falsedisables the escape hatches with 403DANGEROUS_DISABLED: JavaScript in a WebView (fx_webexecute, query, html and click), reflective setters (fx_propertyset), file writes (fx_image), closing windows and tabs, and reading the system clipboard.FXPILOT_DANGEROUS=falseon the MCP server also hides these tools. They are still allowed by default in 1.x; setfxpilot.dangerous=falsewherever the app controls real equipment or data.PasswordFieldtext is never returned: node snapshots show***,fx_propertyreads only text-independent properties of a PasswordField (editable,promptText,disable...; everything else, including custom values, gives 403NODE_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 withfx_press_keyand clipboard content are still recorded as they are.- If a handler opens a modal dialog, the action returns
status: pendingwith the dialog's title, message and buttons (see Dialogs, forms and tables). The dialog then shows up infx_list_windowsand can be operated normally, e.g. withfx_clickontext=OK. fxpilot.auditFilekeeps 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
notesfromfx_healthcome from the operator.
What FxPilot does not do
The supported platforms and the current limits are collected in docs/compatibility.md.
WebViewDOM access is limited to the optional JavaScript bridge (fx_web); there is no browser-automation model for downloads, dialogs or cross-origin pages.Canvassupport 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. TreeTableViewonly exposes visible (expanded) rows; usefx_set_expanded/fx_treeto 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
MediaPlayerexposed by theMediaView.
Troubleshooting
| Symptom | Cause / 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 found | The app runs without JavaFX on the class/module path, or JavaFX is older than 11. |
NoClassDefFoundError: com/sun/net/httpserver/HttpServer | Modular 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 use | Pick another port per app. |
ESCAPE does not close a dialog | Call 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:
| Secret | Purpose |
|---|---|
MAVEN_CENTRAL_USERNAME | Central Portal token user |
MAVEN_CENTRAL_PASSWORD | Central Portal token |
MAVEN_GPG_PRIVATE_KEY | ASCII-armored GPG private key |
MAVEN_GPG_PASSPHRASE | Key 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/.
https://github.com/dbuedenbender/fxpilot/releases/download/v1.2.0/fxpilot-1.2.0.mcpb# mcpb: https://github.com/dbuedenbender/fxpilot/releases/download/v1.2.0/fxpilot-1.2.0.mcpb