opencode
Add Mobster to opencode.json as a local MCP server with a one-array command and a safe timeout. Only Claude Code and Codex are tested with the server.
You can write and build your iOS code from the terminal with opencode. Follow opencode’s documented setup below to add the Mobster MCP server. The server’s tools run your app on a headless iOS simulator Mobster manages. The tools read each screen by element name. Mobster checks your declared assertions. You get a verdict and a report with frames when available. The server also exposes tools to drive your iPhone over USB.
You need an Apple silicon Mac with macOS 13 or later and Xcode with an iOS Simulator runtime. A real iPhone also needs Developer Mode and the WebDriverAgent runner, set up in Mobster for Mac (Device setup). To set up your iPhone and to build and test your own app, you need the macOS your Xcode version needs (Apple lists it on its Xcode page).
Add the server
opencode reads opencode.json at the project root and ~/ for every project, merges them, and gives the project’s file the last word. Its MCP block differs from most clients in three ways: the key is mcp, a local server needs "type": "local", and command is one array that holds the arguments too.
{ "$schema": "https://opencode.ai/ config.json", "mcp": { "mobster": { "type": "local", "command": ["/ Applications/ Mobster.app/ Contents/ MacOS/ mobster-agent", "mcp"], "enabled": true, "timeout": 120000 } }}The timeout is there on purpose. opencode’s docs describe it as the time allowed for fetching a server’s tools, 5 seconds by default, and its config schema as a timeout for every request to the server. Calls to Mobster take up to 45 seconds, and wait up to 50, so a 5-second value copied from an example would cut them off. 120,000 ms is safe under every reading. opencode mcp add walks you through the same thing interactively.
You do not need an API key for key-less checks. Your agent supplies the model access for this loop. Mobster checks the declared assertions. Smart uses your OpenAI or Anthropic key to run the steps. To use Smart, add the Mobster env file to the array. Mobster expands the ~ itself:
"command": ["/ Applications/ Mobster.app/ Contents/ MacOS/ mobster-agent", "mcp", "--env-file", "~/ .config/ mobster/ agent.env"]Check it’s connected
opencode mcp listmobster should be listed. Then, in a session:
Call mobster's status tool and tell me what it says.status names the Mobster version, the simulator setup, whether Smart is available and why not if it’s off, and where runs go.
A first check: a task marked done, with Smart
Most integration pages here show the key-less loop, where you ask the agent to tap through the app itself. You can also ask opencode to hand the whole flow to Mobster. With a key in the env file, verify_start takes "smart": true: Mobster performs the steps on your key, then checks the declared assertions and returns a verdict, as in a key-less run.
Say your app has a task list. As a prompt:
Build my app for the simulator, then call verify_start in mobster with smart on to mark the first task done.Expect the task to be ticked and the count to read "2 tasks left".Ask opencode to call verify_start with "smart": true, the app, the steps and the expectations, plus a spend cap:
{"tool": "verify_start", "arguments": { "app_path": "/ abs/ path/ YourApp/ .mobster/ build/ Build/ Products/ Debug-iphonesimulator/ YourApp.app", "launch_env": {"SEED_TASKS": "3"}, "open_url": "yourapp://tasks", "steps": ["Tap the first task to mark it done."], "expect": [{"visible": {"id": "task_1", "selected": true}}, {"value": {"id": "done_count"}, "equals": 1}, {"value": {"id": "tasks_left"}, "equals": 2}], "smart": true, "max_usd": 0.15}}max_usd defaults to 0.25 and can go up to 1.00; max_seconds defaults to 180. A run that finishes within 40 seconds returns its result. A longer one returns {"status": "running", "run_id": …}; ask your agent to call wait. A Smart run finishes on its own, so there is no verify_finish call. Mobster checks these three expect assertions together against one accessibility-tree read. Smart sends each screen’s image and accessibility text to OpenAI or Anthropic, whichever key it runs on.
Put the rule in AGENTS.md
opencode reads project instructions from AGENTS.md, and /init creates or updates one. Add:
## Verifying UI changesAfter you change a screen in this iOS app, verify it before you say it works.1. Build for the simulator: xcodebuild -scheme <Scheme> -destination 'generic/ platform=iOS Simulator' -derivedDataPath .mobster/ build CODE_SIGNING_ALLOWED=NO build2. Call mobster's verify_start with app_path set to the absolute path of .mobster/ build/ Build/ Products/ Debug-iphonesimulator/ <App>.app, the steps in plain English, and expect: what must be true when the steps are done.3. Drive with screen, tap, type_text and swipe, then call verify_finish.4. If the verdict is failed, fix the code and verify again. Report the verdict and the report path.Use a real iPhone
list_devices names every device Mobster can use. With a USB iPhone’s name as device and no run_id, screen, tap, type_text, swipe, alert, open_url, launch_app and home act on the phone itself. Mobster holds the phone’s lock until stop with the device, or 90 idle seconds.
This is where opencode needs one more setting. It starts from permissive defaults, so it calls tools without asking unless a rule says otherwise. Its permissions are keyed by tool name, and it names MCP tools with the server’s prefix. Make the Mobster acting tools ask before you connect a phone:
{ "permission": { "mobster_tap": "ask", "mobster_type_text": "ask", "mobster_swipe": "ask", "mobster_alert": "ask", "mobster_open_url": "ask", "mobster_launch_app": "ask", "mobster_home": "ask", "mobster_use_code": "ask", "mobster_set_clipboard": "ask", "mobster_install_app": "ask" }}Then limit the server to the phones you mean, since a rule covers a tool, not a device:
"command": ["/ Applications/ Mobster.app/ Contents/ MacOS/ mobster-agent", "mcp", "--allow-device", "Test iPhone"]Any other real device is listed as not_allowed and refused. The Mobster MCP annotations mark which tools only read. The server’s instructions tell the agent to ask you before anything that sends, buys, posts or deletes on a real iPhone. Use permission rules to make opencode stop for approval. Instructions alone don’t enforce that stop. A locked phone stops the call at once. The server never enters a passcode.
Troubleshooting
| Symptom | Fix |
|---|---|
| opencode doesn’t load mobster | Use the mcp key, "type": "local", and one command array: ["/ |
| Calls fail after a few seconds | A small timeout is cutting them off. Set "timeout": 120000 |
The first verify_start returns status: "preparing" | The simulator is booting and WebDriverAgent is building. Ask your agent to call wait |
verify_start has no smart argument | Smart is off. status says why: no key, a missing env file, or --keyless |
couldnt_run | reason.class and reason.fix in the result say what to do (Checks) |
The MCP reference lists every tool. AI end-to-end tests for iOS explains how the verdict is decided.
Questions
What timeout should opencode use for Mobster?
Set "timeout" to 120000 on the server. opencode's docs describe the field as a 5-second timeout for fetching tools. Its config schema describes a timeout for every server request. Calls to the server take up to 50 seconds. A timeout of 120 seconds covers both readings.
Does opencode ask before it calls the Mobster tools?
Not by default. opencode starts from permissive defaults where most permissions are allow. Set acting tools such as mobster_tap and mobster_type_text to ask before you point it at a real iPhone.
Why doesn't opencode load the server?
Check the shape. opencode's key is mcp, not mcpServers, the server needs "type": "local", and command is one array with the arguments in it, ["mobster", "mcp"].
Sources
opencode’s logo is a trademark of opencode, shown only to name the product. Mobster isn’t affiliated with or endorsed by opencode.