Every tool, flag, and data shape of the OpenApps MCP server (src/open_apps/mcp/). To add the server to Claude Code, Claude Desktop, Cursor, VS Code or Codex, and for a walkthrough of an episode, see OpenApps over MCP.

One process is one session: a FastHTML server running every app in a thread, plus one headless Playwright Chromium. Spawn N processes for N parallel environments.

Launch

# stdio (a local client spawns this as a subprocess)
uv run python -m open_apps.mcp

# HTTP / SSE (remote or multiple clients connect to a running server)
uv run python -m open_apps.mcp --transport http --host 127.0.0.1 --port 8000

# on a phone: 390x844, touch pointer, and the apps rendered for that form factor
uv run python -m open_apps.mcp --device phone
Flag Default What it does
--app none (the launcher) Optional. reset() lands inside this app instead of on the launcher, and it becomes reconfigure's default app for layout/content. Any key in registry.APP_URL_PATHS: todo, calendar, messages, map, codeeditor, files, openbanking, contacts, passwords, uilibrary, onlineshop.
--transport stdio stdio, http (streamable HTTP) or sse.
--host, --port 127.0.0.1, 8000 Bind address for http/sse.
--device a 1024x640 desktop window A config/device/ option: desktop, laptop, tablet, phone.

Every app is always served, whatever --app says. That is why startup prints "Setting environment for ..." once per app: the apps share one FastHTML server, a task can span several of them, and the reward reads every app's state. --app only moves where the browser starts.

Leave --app unset to score tasks as BrowserGym does. A BrowserGym episode starts on the launcher (OpenAppsTask.setup opens the base URL). Navigation tasks are scored on the page URL, so a session that already starts inside the target app completes them before the agent does anything. Use --app for interactive work in one app, or for a sweep of one app's layouts and content.

--device sets two things at once. It sizes the Playwright context and sets its input model (is_mobile, has_touch), and it is passed to the app server as a Hydra override, so the pages render for that device rather than being a desktop layout in a narrow window. See config/device/.

__main__ publishes the flags as OPENAPPS_APP, OPENAPPS_DEVICE, OPENAPPS_MCP_HOST and OPENAPPS_MCP_PORT before importing the server, which reads them from there. Because it writes them unconditionally (and clears OPENAPPS_APP when --app is not given), the flags always win over anything already in the environment. Set these variables yourself only when embedding open_apps.mcp.server directly rather than launching it with python -m.

The shop is refused when it is not served (see open_apps.apps.availability).

Tools

Tool Description
reset(seed=None) Reset all apps, reload the landing page (the launcher unless --app) → first observation.
act(action, with_reward=True) Run a BrowserGym action string → observation. send_msg_to_user(text) / report_infeasible(reason) reply in the chat instead of touching the page.
observe() Current observation without acting.
screenshot() Current screenshot (PNG).
get_state() Structured cross-app state (the JSON behind the reward).
describe_actions() The action grammar accepted by act.
list_task_groups() Task sets under config/tasks/ (all_tasks, files, openbanking, ...).
list_tasks(app=None, group=None) Task keys from every set or one group; app keeps those that touch it.
load_task(key) Bind a task for scoring; returns its goal. Call reset after.
get_reward() Reward for the bound task (1.0 if complete, else 0.0), scored as BrowserGym scores it.
set_goal(goal) Free-form goal, no automatic scoring.
reconfigure(app, theme, layout, content, seed, extras, appearance) Live variant/seed change. theme is the shared design-token theme for every app. layout and content are per-app and apply to app (default: --app; required without it). appearance is deprecated, see below.
list_apps() App keys actually registered in this process.
list_variants(app, group) Variant stems for a group (theme/layout/content).
app_url(app=None) Absolute URL of an app's landing page (default: where reset lands).

Actions

Actions are BrowserGym action strings in full-resolution pixels:

mouse_click(375, 292)        keyboard_type('Call Mom')      keyboard_press('Enter')
scroll(0, 300)               mouse_drag_and_drop(10, 20, 200, 40)
mouse_dblclick(120, 80)      goto('/calendar')              noop(300)

goto takes an app path (resolved against the current page) or a full URL. Call describe_actions() for the full list.

Observations

An observation comes back as a screenshot (PNG image content) plus a JSON text block: {url, reward, done, step_count, action_desc, error}.

Tasks and scoring

Tasks come from every set under config/tasks/, not just the paper's all_tasks. Keys are unique across the sets. Which apps a task touches is open_apps.task_apps.task_apps, shared with the Config Composer.

Answer and abstention tasks are scored on the chat: act("send_msg_to_user('...')") answers or asks, and act("report_infeasible('...')") gives up. Scoring goes through open_apps.tasks.scoring.score, the same function BrowserGym's OpenAppsTask.validate calls, so done is true once a reply is in, even a wrong one.

Deprecated: appearance

reconfigure used to take a per-app appearance stem. That group was split into a shared theme (look) and a per-app layout (structure). The parameter still exists so existing clients keep binding, and is translated:

appearance= becomes
default theme="default"
dark_theme theme="dark"
black_and_white theme="mono"
challenging_font theme="challenging_font"
colorblind_access theme="colorblind"
kanban_board layout="kanban_board"
broken_logos layout="broken_logos"
clickable_logos layout="clickable_logos"

Each call raises a DeprecationWarning. Passing appearance together with a theme/layout it disagrees with raises ValueError rather than silently picking one. list_variants(app, "appearance") raises too: the group's directory is gone, and the missing-directory fallback would otherwise answer ["default"] and quietly drop every variation from a sweep. Two renderings shift slightly under the new axes (mono polarity, colorblind scope); the migration table has the detail. appearance will be removed in a later release.

Minimal client

import asyncio, json
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client


def meta(result):  # the JSON text block in an observation
    txt = [c.text for c in result.content if getattr(c, "type", None) == "text"]
    return json.loads(txt[0]) if txt else {}


async def main():
    params = StdioServerParameters(
        command="uv",
        args=["run", "--directory", "/path/to/OpenApps", "python", "-m", "open_apps.mcp"],
    )
    async with stdio_client(params) as (read, write):
        async with ClientSession(read, write) as s:
            await s.initialize()

            await s.call_tool("load_task", {"key": "add_call_mom_to_my_todo"})
            await s.call_tool("reset", {})  # lands on the launcher

            # Drive the UI: open Todo, click the "New Todo" field, type, submit.
            # (In practice you'd read the screenshot to choose coordinates.)
            await s.call_tool("act", {"action": "goto('/todo')"})
            await s.call_tool("act", {"action": "mouse_click(465, 91)"})
            await s.call_tool("act", {"action": "keyboard_type('Call Mom')"})
            obs = await s.call_tool("act", {"action": "keyboard_press('Enter')"})
            print("after add:", meta(obs))  # reward -> 1.0


asyncio.run(main())

For HTTP, swap the transport:

from mcp.client.streamable_http import streamablehttp_client
async with streamablehttp_client("http://127.0.0.1:8000/mcp") as (read, write, _):
    async with ClientSession(read, write) as s:
        ...

In-process (no MCP)

Session drives the same environment directly, which is handy for tests:

import asyncio
from open_apps.mcp import Session

async def main():
    s = Session()          # Session("todo") to land inside an app
    await s.start()
    obs = await s.reset()
    obs = await s.act("goto('/todo')")
    await s.close()

asyncio.run(main())

Notes

  • One session per process. The FastHTML app and Playwright are process singletons, so run one server process per parallel environment.
  • uvloop / Python < 3.12. The server forces plain-asyncio uvicorn and restores a subprocess-capable event-loop policy before launching the browser, so the Playwright driver spawns correctly even when uvloop is installed.
  • stdout belongs to the protocol. Under stdio, app print()s are routed to stderr so they can't corrupt the JSON-RPC stream. Logs you see in a terminal are stderr.