Optics Framework

Testing and QADeveloper tools

Open-source test automation for Android, iOS, web, smart TV (Android TV, Tizen, webOS) and Bluetooth (BLE) devices. Write tests as CSV/YAML, record them live, or let an AI agent build them over MCP. Self-healing locators: XPath, text, OCR, image.

Your AI app calls the Optics Framework MCP server, which does the testing and QA and developer tools work and sends the result back to the chat.

About Optics Framework

Optics Framework is a community MCP server from mozarkai, filed in our directory under testing and qa and developer tools. Open-source test automation for Android, iOS, web, smart TV (Android TV, Tizen, webOS) and Bluetooth (BLE) devices. Write tests as CSV/YAML, record them live, or let an AI agent build them over MCP. Self-healing locators: XPath, text, OCR, image.

At a glance

Publisher
mozarkai (community)
Runs
See the README for setup
Written in
Python
License
Apache-2.0
GitHub stars
444

How to set up Optics Framework

  1. Follow the install steps in the Optics Framework README; it is written in Python, so have that toolchain ready.
  2. Check the Optics Framework README for keys or settings; the registry lists none that Optics Framework requires.
  3. Add Optics Framework to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Optics Framework tools to confirm the connection.
  5. Run one read-only task with Optics Framework first, and keep your app asking before each tool call until the results look right.

Optics Framework compared with similar servers

  • Flutter Skill by ai-dashboad has fewer GitHub stars than Optics Framework (417 against 444); both are community servers, and both run locally.
  • Sandbox (shanselman) by shanselman has more GitHub stars than Optics Framework (502 against 444); both are community servers, and both run locally.
  • Flutter MCP Toolkit by Arenukvern has fewer GitHub stars than Optics Framework (401 against 444); both are community servers, and both run locally.

Before you connect Optics Framework

  • Give Optics Framework its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Optics Framework tool call until you trust what it does with them.
  • Treat text that Optics Framework fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Optics Framework on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Optics Framework

How marketing and sales teams put Optics Framework to work, by company size. Pick the size closest to yours and start Optics Framework on one use case.

Small business

  • A small business can use Optics Framework to test its booking or checkout flow after each update, so a broken button doesn't cost a week of sales.
  • Owners can have Optics Framework check emails and forms render correctly before a promotion goes out.
  • A small business with a developer can use Optics Framework to ship site and tracking fixes faster, with the AI reading the code it changes.
  • Optics Framework runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Marketing teams can run Optics Framework on every landing page release, checking forms, tracking and copy before ads point at it.
  • Lifecycle teams can use Optics Framework to test email and signup journeys end to end, catching a broken step before customers do.
  • Growth engineers can use Optics Framework to build landing pages, tracking and integrations in fewer cycles, with reviews kept in the normal flow.
  • Start Optics Framework on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprises can plug Optics Framework into release gates, so marketing pages meet the same quality bar as the product.
  • Large web teams can use Optics Framework to test across locales, devices and accessibility rules at a scale no manual team can match.
  • Enterprise engineering teams can roll out Optics Framework with repo scopes and audit logs, so agents work only where they are allowed.
  • Optics Framework is a community server, so have security review the code and pin a version before Optics Framework touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Optics Framework README

From mozarkai/optics-framework on GitHub, shared under its Apache-2.0 license. Images are left out; the original has them.

README.md

Docs (optics-framework.org/docs/?ref=readme) · Install · Quickstart · Playground · Keywords

Optics is open-source test automation for Android, iOS, web, smart TV and desktop apps. You write a test as data, in CSV or YAML. Each element can have more than one way to find it, and Optics tries them in order: XPath, text, OCR, image, then an optional AI recovery. When the app changes and one way breaks, the next way finds the element and the test continues.

Try it in your browser

These four pages on optics-framework.org need no install. Click an image to open the page.

Real Optics, in the browser

/playground loads the optics-framework wheel from PyPI on Pyodide. Edit the suite, break a locator, then run dry_run or execute on Birch, a demo shop app. The output and junit_output.xml come from Optics itself.

optics live, next to a phone

The homepage playground is a simulation of optics live. Type a step or tap the phone. Each step runs at once and shows how Optics found the element. /save writes the steps that passed into modules.csv and elements.csv. Under the phone, each step also shows as CSV, Python, Robot, an HTTP call and an MCP call.

A real run, frame by frame

/run replays a real run of the Birch suite against two releases of the app. Each frame is a file that the run wrote. Release 2.2 passes every step and fails the run, because the last screen shows "Session expired".

Explain a suite

/explain reads a suite row by row. It shows what each step does, how each value resolves and what optics dry_run reports for it.

Install

One line installs the optics command into its own environment under ~/.optics:

curl -fsSL https://optics-framework.org/install | sh      # macOS, Linux
irm https://optics-framework.org/install.ps1 | iex        # Windows

Then run optics quickstart. It asks what you want to test, installs the engine for it, makes a project, checks your setup and runs the first test. Each prompt has a default.

To use pip, you need Python 3.12 or newer. The core package has no drivers, OCR or AI engines. Add the extras that you need:

python3 -m venv .venv && source .venv/bin/activate
pip install "optics-framework[appium,easyocr]"
Kind Extras
Drivers appium · selenium · playwright · ble
OCR apple-vision · rapidocr · easyocr · pytesseract · google-vision
AI gemini · openai · anthropic
MCP server mcp
Bundles mobile · web · vision · llm · all

optics setup --list shows the same engines, and optics setup --install appium easyocr installs them for the Optics version you have.

[!IMPORTANT] A driver extra installs only the Python client. A phone test also needs the Appium server, a device or emulator, and the platform tools. pytesseract needs the Tesseract program, and playwright needs its browsers (playwright install). See the install guide.

[!WARNING] Do not use Conda with easyocr. Its NumPy version conflicts with the one that Optics needs. Use venv.

Four ways to create a test

  1. Write it. Elements, modules and test cases are plain CSV or YAML files. The same keywords are also a Python library and a Robot Framework library.
  2. Record it. Run keywords one at a time in optics live next to your device. Each step that works is recorded, and /save writes the recording into your suite as a module.
  3. Describe it. Press Ctrl+N in optics live and describe the flow. An AI model (Gemini, Claude, OpenAI or a local model) drives the device one step at a time, then keeps only the steps that mattered.
  4. Delegate it. Run optics mcp install to register the MCP server with Claude Code, or add optics mcp to any MCP client. Your agent looks, taps, types and checks through the tools. When it is done, it gets the steps it ran as a suite.

A test is data

A suite is three kinds of file. Optics finds each file by its CSV header or YAML keys, not by its folder.

my_test_project/
├── config.yaml
├── test_cases/test_cases.csv
├── modules/modules.csv
└── test_data/
    ├── elements.csv
    ├── error_definitions.csv      # optional
    └── input_templates/*.png      # optional, for image matching

elements.csv gives a name to each element. Give a name more than one row and Optics tries each value in order.

Element_Name,Element_ID
email_field,//android.widget.EditText[@resource-id="email"]
email_field,Email
sign_in,Sign in
sign_in,sign_in_button.png

A value can be an XPath, text=…, css=…, plain text, an image file from input_templates/, or TEXT_ONLY:… to search with OCR only.

modules.csv holds the steps, one keyword for each row. ${name} reads a value from elements.csv.

module_name,module_step,param_1,param_2
Sign In,Enter Text,${email_field},ava@birch.shop
Sign In,Press Element,${sign_in}

test_cases.csv sets the modules that each test case runs, in order. A test case named Suite Setup or Suite Teardown runs before or after all the others.

test_case,test_step
Suite Setup,Launch Birch
Sign in and buy,Sign In
Sign in and buy,Add To Cart

How Optics finds an element

Each keyword that acts on an element tries these ways in order and stops at the first one that works:

# Way What it does
1 XPath Queries the accessibility tree through the driver
2 Text Finds the visible text, CSS or class in the page source
3 OCR Reads the screenshot with Apple Vision, RapidOCR, EasyOCR, Tesseract, Google Vision or a remote OCR server
4 Image Matches a reference picture of the element on the screenshot
5 AI self-heal (optional) An LLM reads the screen and recovers with the same keywords

The fast ways run first, so OCR and image matching cost time only when the tree cannot help. Two more fallbacks run next to this one: the values of one element name, and the drivers or element sources that you enable, in config.yaml order.

Run a suite

optics dry_run my_test_project    # check keywords, parameters, elements and modules without a device
optics execute my_test_project    # run the suite

Each run writes to my_test_project/execution_output/:

  • junit_output.xml, written once when the run ends, also when you stop the run.
  • Screenshots of each step that finds an element, with a box around what Optics found.
  • Detected errors. Put an error_definitions.csv in the project and Optics reads the last screen for crash dialogs, Session expired and other messages. A match adds a failure to the JUnit report, with no assertion. See error detection.

optics execute exits with 1 when a test fails, so CI marks the build as failed. See Run in CI for GitHub Actions and GitLab.

One suite, many targets

Target Driver
Android, iOS appium with UiAutomator2 or XCUITest
Web playwright or selenium
Android TV, Samsung Tizen, LG webOS appium
macOS, Linux and Windows apps (Windows is experimental) appium with appium-xa11y-driver
Production devices that block debugging and screenshots ble: a Bluetooth dongle taps and types, and camera_screenshot reads the screen

config.yaml sets the driver and how to find elements. Each section is a list in order of priority, and each entry has an enabled flag. Enable a second driver and it becomes a fallback.

driver_sources:
  - appium:
      enabled: true
      url: "http://localhost:4723"
      capabilities:
        platformName: Android
        automationName: UiAutomator2
        deviceName: emulator-5554

elements_sources:
  - appium_find_element: { enabled: true }
  - appium_page_source:  { enabled: true }
  - appium_screenshot:   { enabled: true }

text_detection:
  - easyocr: { enabled: true }

optics configure <folder> writes this file from a few questions. See the configuration reference for every key, the AI engines and self-heal.

Use the keywords from code

The same keywords work from each of these:

Surface Start it with
CLI runner optics execute <project>
Interactive session optics live [project]
Python from optics_framework import Optics
Robot Framework Library optics_framework.optics.Optics
HTTP API optics serve (OpenAPI)
MCP server optics mcp, or optics mcp install for Claude Code
Python example
from optics_framework import Optics

optics = Optics()
optics.setup(
    driver_sources=[{"appium": {"enabled": True, "url": "http://localhost:4723"}}],
    elements_sources=[{"appium_find_element": {"enabled": True}}],
)

optics.launch_app(app_identifier="com.example.app")
optics.enter_text("username_field", "testuser")
optics.press_element("submit_button")
optics.validate_element("welcome_message")
optics.quit()
MCP client configuration
{ "mcpServers": { "optics": { "command": "optics", "args": ["mcp"] } } }

The server gives the agent 11 tools: start_session, observe, tap, type_text, scroll, press_key, launch_app, batch, check, run_keyword and terminate_session. Each action replies with what changed on the screen. For a network client, run optics mcp --transport http --port 8090. See the MCP reference.

Keywords

In CSV and YAML, keywords are in Title Case (Press Element). In Python they are in snake case (press_element).

Kind Keywords
Actions Press Element · Press By Percentage · Press By Coordinates · Detect And Press · Select Dropdown Option · Swipe · Swipe By Percentage · Swipe From Element · Swipe Until Element Appears · Scroll · Scroll From Element · Scroll Until Element Appears · Enter Text · Enter Text Direct · Enter Text Using Keyboard · Enter Number · Clear Element Text · Press Keycode · Go Back · Get Text · Sleep · Execute Script
Checks Assert Presence · Assert Visibility · Assert Text · Assert Equality · Validate Element · Validate Screen · Is Element · Get Interactive Elements · Get Screen Elements · Capture Screenshot · Capture Pagesource
App Launch App · Launch Other App · Start Appium Session · Initialise Setup · Get Driver Session Id · Close And Terminate App · Force Terminate App · Get App Version
Flow Execute Module · Run Loop · Condition · Read Data · Evaluate · Date Evaluate · Invoke API

optics list prints every keyword, and optics list press_element prints the parameters of one. The keyword reference has an example for each.

CLI

optics quickstart   Make a first project, step by step
optics init         Make a project (--template for a sample)
optics configure    Write or edit config.yaml
optics doctor       Check engines, tools and project config (--check for CI)
optics setup        Install engines (--list, --install)
optics list         Print the keywords, or the parameters of one
optics dry_run      Check a project without a device
optics execute      Run a project (--include, --exclude)
optics live         Run keywords one at a time on a device
optics generate     Write pytest or Robot Framework code from a project
optics serve        Start the HTTP API
optics mcp          Start the MCP server (install registers it with Claude Code)
optics completion   Install shell completion

See the CLI reference for every option.

Contribute

Bug reports and code are welcome. Larger tasks have the help wanted label. To report a bug or ask for a keyword, open an issue.

git clone git@github.com:mozarkai/optics-framework.git
cd optics-framework
pipx install poetry
poetry install --with dev,test
poetry run pytest
poetry run pre-commit run --all-files

The contribution guide has the development setup, how to add a keyword or an engine, and the commit format. Report security issues as SECURITY.md tells you, not in a public issue.

License

Apache 2.0. See LICENSE.

Questions about Optics Framework

What is the Optics Framework MCP server?

Open-source test automation for Android, iOS, web, smart TV (Android TV, Tizen, webOS) and Bluetooth (BLE) devices. Write tests as CSV/YAML, record them live, or let an AI agent build them over MCP. Self-healing locators: XPath, text, OCR, image. Optics Framework is maintained by mozarkai on GitHub at mozarkai/optics-framework, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Optics Framework MCP server?

Optics Framework doesn't publish a one-line install in the MCP registry, so follow the setup steps in its README on GitHub (mozarkai/optics-framework). Like most servers, Optics Framework ends with a command or URL you paste into your AI app's MCP config.

Does Optics Framework need an API key?

The registry lists no required keys for Optics Framework. Check the Optics Framework README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Optics Framework an official MCP server?

No. Optics Framework is a community server maintained by mozarkai. Community servers can be excellent; read the code and the open issues before you give Optics Framework access to company data.

What license is Optics Framework under?

Optics Framework is released under the Apache-2.0 license, according to its GitHub repository. The license covers the code of Optics Framework; the service it connects to has its own terms.