testfly-mcp
TestFly MCP is a browser automation and test-generation server.
Browser control: Start Chrome/Firefox (headless, window size), navigate, manage tabs/history, refresh, scroll, execute JS, emulate devices.
Element interaction: Click, type, hover, right/double-click, drag & drop, select options, fill forms, send keys, upload files, handle iframes, shadow DOM, and alerts.
Inspection & debugging: Capture screenshots, get page source/title/URL, find elements, inspect interactive elements, extract table data, read console/network logs, cookies, local/session storage.
Testing & validation: Assertions (title, URL, text, visibility, attribute, count), accessibility audits, visual regression, network mocking, wait for network idle/elements, self-healing locators.
Code generation: Export recorded sessions to Python pytest, Java TestNG/JUnit5, TestFly, C# NUnit, Gherkin, Playwright hints, Page Objects, and CI pipelines (GitHub Actions, Jenkins, GitLab CI).
TestFly integration: Detect TestFly projects, generate
testfly.ymlandpom.xml, and produce framework-managed TestFly code.
Generates TestFly Cucumber/BDD step definitions and runner classes from recorded browser sessions.
Generates JUnit 5 test code from recorded browser sessions, producing framework-native Java tests with web-first assertions.
Generates Python pytest test code from recorded browser sessions for Selenium-based web testing.
Enables browser automation through Selenium WebDriver, including navigation, element interaction, assertions, session recording, and test code generation from recorded flows.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@testfly-mcp Open example.com, click 'Get Started', and generate a Java TestFly test."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TestFly MCP Bridge & AI Studio
Lightweight Model Context Protocol (MCP) bridge for TestFly Java Test Automation.
Pairs with Playwright MCP for ultra-fast live browser driving, while providing autonomous TestFly Java 21 codegen, .testfly/action-cache.json management, and AI self-healing patch remediation.
Zero Python. Zero pip. Zero setup headaches.
π Architecture: Bring Your Own Browser
Rather than maintaining a heavy Selenium browser driver in Python, TestFly adopts the modern Bring Your Own Browser pattern:
Browser Driving: Delegated to Playwright MCP (
@playwright/mcp).TestFly Intelligence: Handled by this TestFly Bridge:
Compiles recorded actions into idiomatic TestFly Java 21 (
BaseTest,BasePage,getByRole,assertThat).Manages autonomous
act("Goal")plans in.testfly/action-cache.jsonfor 0ms replay.Reviews and applies AI self-healing git diff patches (
target/remediations/*.patch).Scaffolds new projects and calculates parallel CI test sharding.
[ AI Assistant (Cursor / Claude / Copilot) ]
β
βββββββββ΄βββββββββββββββββββββββββ
βΌ βΌ
[ playwright-mcp ] [ testfly-bridge ]
(Browser Driving) (Java Codegen & Agentic Tools)
β’ Navigates & clicks β’ Generates TestFly BaseTest / BasePage
β’ Captures A11y DOM snapshots β’ Manages .testfly/action-cache.json
β’ Takes screenshots β’ Applies target/remediations/*.patchRelated MCP server: MCP Selenium Server
β‘ 1-Click Setup
Option 1: VS Code Extension
Build and install the TestFly Studio extension from this checkout:
Open Command Palette (
Cmd+Shift+P/Ctrl+Shift+P).Run
TestFly: Configure Workspace MCP (Cursor & VS Code)and select this checkout'sbin/testfly-mcp.js.Review and confirm the changes to the workspace
.cursor/mcp.jsonand.vscode/mcp.json. Global assistant settings are not edited.
Option 2: Configure from source
Replace /absolute/path/testfly-mcp with this checkout's path in an MCP client that supports this configuration shape:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["-y", "@playwright/mcp@latest"]
},
"testfly": {
"command": "node",
"args": ["/absolute/path/testfly-mcp/bin/testfly-mcp.js"]
}
}
}π οΈ Available MCP Tools
Tool | Description |
| Converts Playwright interactions or DOM snapshots into TestFly Java 21 test classes ( |
| Reads and inspects autonomous |
| Invalidates or clears action cache plans so the AI can re-compile them. |
| Lists pending AI self-healing |
| Applies a reviewed |
| Scaffolds a TestFly 1.0.7 Java 21 test suite ( |
π§© VS Code Extension Features
Action Cache Explorer: Visual webview panel to inspect, invalidate, and re-compile
act()goals.AI Self-Healing Patch Reviewer: Visual diff viewer showing repaired selectors with a 1-click Apply Patch to Code button.
testfly.ymlEditor: Edit the shared starter template and existing YAML in the IDE.Environment Diagnostics: Instant verification of JDK 21, Maven, Node.js, and configuration status.
The current Node bridge does not implement testfly record or a live recorder studio. Those belonged to the historical Python recorder; this repository's codegen accepts actions supplied by an MCP client.
Available Tools
88 toolsaccept_alertB
Accept (OK) a JavaScript alert, confirm, or prompt dialog.
Inputs: timeout.
assert_attributeC
Assert an element attribute has the expected value.
Inputs: expected (required), selector (required), attribute (required), by, +2 more.
assert_element_countB
Assert number of elements matching selector equals expected count.
Inputs: selector (required), expected_count (required), by.
assert_element_not_visibleB
Assert an element is NOT visible (hidden or absent).
Inputs: selector (required), by, timeout.
assert_element_visibleC
Assert an element is visible on the page.
Inputs: selector (required), by, timeout.
assert_page_containsC
Assert the full page source or visible text contains a string.
Inputs: text (required), source_only.
assert_textB
Assert element text equals or contains expected value.
Inputs: expected (required), selector (required), by, exact, +1 more.
assert_titleA
Assert the page title equals or contains expected text.
Inputs: expected (required), exact.
assert_urlB
Assert the current URL equals or contains expected value.
Inputs: expected (required), exact.
check_accessibilityA
Run a built-in accessibility audit on the current page. Checks for missing alt text, unlabelled inputs, empty buttons/links, missing page title, HTML lang, heading structure, and keyboard accessibility.
Inputs: level.
clear_fieldB
Clear the text in an input field.
Inputs: selector (required), by, timeout.
clear_healed_locatorsA
Clear the self-healing locator cache so all selectors are re-evaluated from scratch.
Inputs: no named parameters.
clear_mock_responsesA
Remove all active mock response rules injected by mock_response.
Inputs: no named parameters.
clear_session_logA
Clear the recorded action log and start fresh.
Inputs: no named parameters.
clickC
Click on an element.
Inputs: selector (required), by, timeout.
close_browserA
Close and quit the browser session.
Inputs: no named parameters.
close_current_tabA
Close the currently active tab and switch to the previous one.
Inputs: no named parameters.
compare_screenshotA
Compare the current page screenshot against a saved baseline. On first run (or with update_baseline=true) saves the baseline. Returns the pixel diff percentage. Install Pillow for accurate pixel comparison.
Inputs: name, threshold, update_baseline.
delete_all_cookiesA
Delete all cookies for the current session.
Inputs: no named parameters.
delete_cookieB
Delete a specific cookie by name.
Inputs: name (required).
detect_selenium_bootA
Backward-compatible alias for detect_testfly. Detects whether the current working directory is inside a TestFly project.
Inputs: project_dir.
detect_testflyA
Detect whether the current working directory is inside a TestFly project (looks for testfly.yml or the io.testfly dependency in pom.xml / build.gradle, walking up parent directories). Call this BEFORE generating Java code: if it reports detected=true, generate with framework="testfly" so the output uses the framework's accessibility-first locators, open(), and managed driver.
Inputs: project_dir.
dismiss_alertC
Dismiss (Cancel) a JavaScript confirm or prompt dialog.
Inputs: timeout.
double_clickB
Double-click on an element.
Inputs: selector (required), by, timeout.
drag_and_dropC
Drag one element and drop it onto another.
Inputs: source_selector (required), target_selector (required), by.
emulate_deviceA
Emulate a mobile device using Chrome DevTools Protocol. Adjusts viewport, pixel ratio, and touch.
Inputs: width, device, height, mobile, +1 more.
execute_scriptC
Execute JavaScript in the browser.
Inputs: script (required), args.
fill_formA
Fill multiple form fields in a single call. Pass a map of CSS selector β value. Automatically handles text inputs, textareas, checkboxes (true/false), radio buttons, and dropdowns. Optionally clicks a submit button at the end.
Inputs: fields (required), by, submit, timeout.
find_elementB
Find an element and return its text, tag, and attributes.
Inputs: selector (required), by, timeout.
find_elementsA
Find all matching elements and return their texts.
Inputs: selector (required), by, timeout.
find_shadow_elementA
Find an element inside a shadow DOM. Provide the host element selector and then the selector for the element inside the shadow root.
Inputs: host_selector (required), shadow_selector (required), timeout.
generate_csharp_nunitA
Generate a C# NUnit + Selenium test class from the current browser session.
Inputs: namespace, test_name.
generate_gherkinA
Generate a Cucumber Gherkin .feature file + Java step definitions class + TestNG Cucumber runner from the recorded browser session. framework='testfly' (default) emits steps extending BaseCucumberSteps with framework-managed driver, open(), accessibility-first locators, web-first assertThat, and a RunCucumberTest runner extending BaseCucumberTest. framework='raw' emits standalone Selenium.
Inputs: framework, feature_name, package_name, scenario_name.
generate_github_actionsB
Generate a GitHub Actions CI workflow YAML for running the recorded test session.
Inputs: language, java_version.
generate_gitlab_ciA
Generate a .gitlab-ci.yml pipeline for running the recorded test session (Maven, Gradle, or pytest).
Inputs: language, java_version.
generate_java_junit5A
Generate a Java JUnit 5 test class from the current browser session. framework='testfly' (default) emits a TestFly test (extends BaseJUnit5Test, framework-managed driver, open(), accessibility-first locators and web-first assertThat assertions). framework='junit5' emits standalone raw Selenium with a ChromeDriver setUp/tearDown.
Inputs: framework, test_name, package_name.
generate_java_page_objectA
Generate a Java Page Object class + matching test class from the recorded session. USE THIS INSTEAD OF WRITING JAVA BY HAND β the output compiles as-is and contains only the elements/actions actually performed, so it never invents fields or uses non-existent framework APIs. Produces two files: a Page Object (locators + fluent action methods) and a Test class that uses it. Supports TestFly (framework='testfly', default): Page Object extends BasePage, Test extends BaseTest, framework manages driver lifecycle, accessibility-first locators and web-first assertThat assertions. framework='testng'/'junit5' emit standalone raw Selenium.
Inputs: framework, page_name, package_name.
generate_java_testngB
Generate a Java TestNG test class from the current browser session. framework='testfly' (default) emits a TestFly test (extends BaseTest, framework-managed driver, open(), accessibility-first getByRole/getByLabel/getByTestId/find locators and web-first assertThat assertions β no driver lifecycle boilerplate). framework='testng' emits standalone raw Selenium with a ChromeDriver setUp/tearDown.
Inputs: framework, test_name, package_name.
generate_jenkins_pipelineA
Generate a declarative Jenkinsfile for running the recorded test session (Maven, Gradle, or pytest).
Inputs: language, java_version.
generate_playwright_hintsA
Generate equivalent Playwright (TypeScript) code hints from the recorded browser session.
Inputs: test_name.
generate_python_testA
Generate a pytest + Selenium test script from the current browser session. Captures all recorded actions (navigate, click, type, hover, drag, select, etc.) into a runnable test.
Inputs: test_name, class_name.
generate_testfly_configC
Generate a production-ready testfly.yml configuration file tailored to the current session or customized via arguments.
Inputs: browser, base_url, headless, parallel, +4 more.
generate_testfly_pomA
Generate a standard Maven pom.xml pre-configured with TestFly 1.0.0, Java 17+, maven-compiler-plugin, and maven-surefire-plugin.
Inputs: version, group_id, artifact_id, testfly_version.
get_alert_textB
Return the text message of a currently open JavaScript alert/confirm/prompt.
Inputs: timeout.
get_attributeC
Get an attribute value from an element.
Inputs: selector (required), attribute (required), by, timeout.
get_console_logsA
Return browser console logs (errors, warnings, info). Chrome only.
Inputs: level.
get_cookiesA
Return all cookies for the current page, or a single cookie by name.
Inputs: name.
get_current_urlA
Return the current URL.
Inputs: no named parameters.
get_healed_locatorsA
Return all self-healed locator mappings from this session. Shows which selectors were automatically repaired and what they were replaced with.
Inputs: no named parameters.
get_local_storageA
Get a value from localStorage, or return all keys if no key is given.
Inputs: key.
get_network_logsA
Return captured XHR/fetch network requests (method, URL, status, timing). Chrome only.
Inputs: limit, method, url_filter.
get_page_sourceA
Return the current page HTML source.
Inputs: no named parameters.
get_page_titleB
Return the current page title.
Inputs: no named parameters.
get_session_logA
Return the raw list of recorded actions in the current session.
Inputs: no named parameters.
get_session_storageA
Get a value from sessionStorage, or return all keys if no key is given.
Inputs: key.
get_table_dataC
Extract data from an HTML table as a formatted text grid.
Inputs: selector (required), by, timeout.
get_textB
Get the visible text content of an element.
Inputs: selector (required), by, timeout.
go_backA
Navigate back in browser history.
Inputs: no named parameters.
go_forwardA
Navigate forward in browser history.
Inputs: no named parameters.
hoverB
Hover the mouse over an element.
Inputs: selector (required), by, timeout.
inspect_pageA
Discover all interactive elements on the current page β inputs, buttons, selects, checkboxes, textareas, and links β with their best CSS selectors and labels. Use this before writing locators so the AI knows exactly what's on the page.
Inputs: no named parameters.
is_displayedC
Check if an element is visible on the page.
Inputs: selector (required), by, timeout.
is_enabledC
Check if an element is enabled (not disabled).
Inputs: selector (required), by, timeout.
list_windowsA
List all open browser tabs/windows with their index, title, and URL.
Inputs: no named parameters.
mock_responseA
Intercept fetch/XHR requests matching a URL pattern and return a canned response. Useful for testing without a real backend. Injection survives until the page is reloaded.
Inputs: url_pattern (required), body, status, content_type.
open_new_tabA
Open a new browser tab, optionally navigating to a URL.
Inputs: url.
refreshB
Refresh the current page.
Inputs: no named parameters.
right_clickA
Right-click (context menu) on an element.
Inputs: selector (required), by, timeout.
scroll_byA
Scroll the page by a given number of pixels (positive = down/right).
Inputs: x, y.
scroll_to_bottomA
Scroll the page to the very bottom.
Inputs: no named parameters.
scroll_to_elementA
Scroll the page to bring an element into view.
Inputs: selector (required), by, timeout.
scroll_to_topA
Scroll the page to the very top.
Inputs: no named parameters.
select_optionA
Select an option from a dropdown by visible text, value, or index.
Inputs: selector (required), by, by_text, timeout, +2 more.
send_keysA
Send a key or key combination to the focused element (or a specific element if selector is given). Use key names like 'tab', 'enter', 'escape', 'up', 'down', 'f5', or combos like 'ctrl+a', 'shift+tab'.
Inputs: key (required), by, timeout, selector.
set_cookieC
Set a cookie on the current page.
Inputs: name (required), value (required), path, domain.
set_local_storageC
Set a localStorage key-value pair.
Inputs: key (required), value (required).
set_session_storageB
Set a sessionStorage key-value pair.
Inputs: key (required), value (required).
start_browserA
Start a browser session. Optional β any tool will auto-start Chrome if no browser is open. Use this to choose Firefox, enable headless mode, or set a custom window size.
Inputs: browser, headless, window_size.
switch_to_default_contentA
Switch back to the main page content from inside a frame.
Inputs: no named parameters.
switch_to_frameA
Switch focus into an iframe. Provide index (integer), name/id (string), or a CSS/XPath selector.
Inputs: by, name, index, timeout, +1 more.
switch_to_windowB
Switch to a browser window/tab by index.
Inputs: index.
take_screenshotA
Take a screenshot and return it as base64.
Inputs: no named parameters.
type_in_alertA
Type text into a JavaScript prompt dialog, then accept it.
Inputs: text (required), timeout.
type_textC
Clear and type text into an input field.
Inputs: text (required), selector (required), by, timeout, +1 more.
upload_fileA
Upload a file by sending its absolute path to an element.
Inputs: selector (required), file_path (required), by, timeout.
wait_for_elementC
Wait until an element is visible on the page.
Inputs: selector (required), by, timeout, condition.
wait_for_network_idleA
Wait until there are no active XHR/fetch requests for a quiet period. Essential for SPAs and pages that load data asynchronously. Also waits for document.readyState to be 'complete'.
Inputs: timeout, idle_time_ms, max_inflight.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 88 tools
Several tools overlap in purpose, most notably detect_testfly and detect_selenium_boot (exact duplicates), and the Java generation family (generate_java_junit5, generate_java_testng, generate_java_page_object) all produce Java test artifacts, making selection ambiguous. The sheer number of 88 tools, especially the many generate_* variants, increases the chance of an agent picking the wrong one despite mostly clear descriptions.
Tool names almost universally follow a snake_case verb_noun pattern with predictable families like get_*, set_*, assert_*, generate_*, and clear_*. Minor inconsistencies like the detect_selenium_boot alias and generate_java_junit5/generate_java_testng whose framework names are concatenated prevent a perfect score.
With 88 tools, this server is far beyond the 3-15 ideal and exceeds the 25+ threshold for 'too many' by a wide margin. Many of the code-generation tools could be consolidated into a single tool with a language/framework parameter, and the duplicate alias tool should be removed.
The tool surface is extremely comprehensive for browser automation and test generation, covering browser lifecycle, navigation, element interaction, waiting, assertions, iframes, shadow DOM, alerts, storage, cookies, network mocking, accessibility, screenshots, and multiple code/output formats. There are no obvious gaps that would prevent an agent from completing a typical browser-testing workflow.
Maintenance
Related MCP Connectors
Write, run and check natural-language browser tests of your web app from your AI assistant.
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Let your AI agent operate any website through a real, logged-in browser session.
Browser-based QA for AI-built software. Test pages with real browsers via agents.
Related MCP Servers
- AlicenseCqualityBmaintenanceEnables AI assistants to automate web browser interactions through Selenium WebDriver. Supports multi-browser automation, element interaction, navigation, and web testing capabilities.561,210 npm6MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to automate browser interactions using Selenium WebDriver, supporting multiple browsers and tools for navigation, clicking, typing, screenshots, and more.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to remotely control, debug, and automate real browsers, iOS simulators, and Android emulators, including navigation, element inspection, interaction, screenshots, and mobile gestures.22 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to drive real Chromium, WebKit, or Firefox browsers β opening named sessions, running ordered steps like clicks, typing, and assertions, and reading back text, console/network logs, and screenshots β so web apps can be tested and explored end to end. It starts and shares dev servers, attaches to already-running browsers, and can fake API responses or device settings.MIT