Skip to content

Gemini CLI

Add Mobster to Gemini CLI with gemini mcp add at user scope. Trust the folder. Only Claude Code and Codex are tested with the Mobster MCP server.

gemini mcp add -s user mobster /Applications/Mobster.app/Contents/MacOS/mobster-agent mcp

You can change your SwiftUI code from the terminal with Gemini CLI. Follow Gemini CLI’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. They also tap and type. Mobster checks your declared assertions. You get a verdict. 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). Gemini CLI’s site notes that unpaid-tier and Google One users moved to Antigravity CLI; this page covers Gemini CLI’s own configuration. 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

gemini mcp add -s user mobster /Applications/Mobster.app/Contents/MacOS/mobster-agent mcp

mobster is the server’s name, and the agent’s path with mcp is the command. Without -s user, gemini mcp add writes to the project’s .gemini/settings.json and the server exists only in that project. The user-scope entry lands in ~/.gemini/settings.json:

{  "mcpServers": {    "mobster": {      "command": "/Applications/Mobster.app/Contents/MacOS/mobster-agent",      "args": ["mcp"]    }  }}

The default timeout is 600,000 ms, ten minutes, which covers every Mobster call: each returns within 45 seconds and wait within 50. Gemini CLI’s docs call the field a request timeout in one place and the --timeout flag a connection timeout in another; the default is long enough under either reading, so leave it unset.

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, pass an env file. Gemini CLI strips environment variables whose names contain KEY, TOKEN, SECRET and similar from a server’s environment unless you list them in its env. Exporting your key in the shell alone does not pass it to Mobster. --env-file has Mobster read the file itself:

"args": ["mcp", "--env-file", "~/.config/mobster/agent.env"]

Mobster expands the ~. The file holds OPENAI_API_KEY=… or ANTHROPIC_API_KEY=… and should be readable only by you.

Check it’s connected

Gemini CLI tests and connects stdio servers only in a trusted folder. In your project:

gemini trustgemini mcp list

Inside a session, /mcp shows each server as connected or disconnected, with its tools. Then ask:

Call mobster's status tool and tell me what it says.

A first check: catch a count that doesn’t fall

Say a change to your app stops the remaining count from falling when you mark a task done. Build it for the simulator:

xcodebuild -scheme YourApp -destination 'generic/platform=iOS Simulator' \  -derivedDataPath .mobster/build CODE_SIGNING_ALLOWED=NO build

Then ask Gemini:

Use mobster to verify my app's task list: launch with SEED_TASKS=3, open yourapp://tasks,tap the first task, then expect it to be selected, done_count at 1 and tasks_left at 2.

Ask Gemini to call verify_start with the absolute app_path, the launch environment, the deep link and those expectations. Then ask it to tap the task. Finally, ask it to call verify_finish. When the app breaks a declared expectation, Mobster returns failed. The result names what it finds. The terminal output below comes from the saved task check against the same build:

✗ value id=tasks_left == 2: was "3 tasks left"

Ask Gemini to find the cause and fix it, then verify again. The report path in the result opens a one-file HTML report with the count outlined in red.

Put the rule in GEMINI.md

Gemini CLI loads GEMINI.md files as context: ~/.gemini/GEMINI.md for every project, and GEMINI.md in your workspace. Add this to the project’s file, with your scheme and app names:

## 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 shows each device Mobster can use. With a USB iPhone’s name as device and no run_id, the phone tools (screen, tap, type_text, swipe, alert, open_url, launch_app and home) act on the phone directly. Mobster holds the phone’s lock until stop with the device, or 90 idle seconds.

Gemini CLI asks before a tool call, with four answers: proceed once, always allow this tool, always allow this server, or cancel. On a server that can reach your phone, “always allow this server” covers tap and type_text on the iPhone too, and so does "trust": true in the settings. Your approval covers a tool, not a device, so keep the server to the phones you mean:

"args": ["mcp", "--allow-device", "Test iPhone"]

Any other real device is listed as not_allowed and refused. excludeTools in the server’s settings hides tools you never want Gemini to call, such as install_app. The Mobster MCP annotations mark status, screen, list_devices, wait, wait_for, read_notifications and unlock_status as read-only. The server’s instructions tell Gemini to ask you before anything that sends, buys, posts or deletes on a real iPhone. A locked phone stops the call at once. The server never enters a passcode.

Troubleshooting

SymptomFix
/mcp shows mobster disconnectedRun gemini trust in the folder. Stdio servers connect only in trusted folders
mobster is missing in another projectIt was added at project scope. Add it again with -s user
Smart is off although your key is exportedGemini CLI removed the variable. Pass --env-file, or set the key in the server’s env
The first verify_start returns status: "preparing"The simulator is booting and WebDriverAgent is building. Ask your agent to call wait
couldnt_runreason.class and reason.fix in the result say what to do (Checks)

The MCP reference has every tool and argument.

Questions

  • Why does Gemini CLI show Mobster as disconnected?

    Gemini CLI connects stdio servers only in a trusted folder. Run gemini trust in your project, then check /mcp again. Also check the scope, since gemini mcp add writes to the project's settings unless you pass -s user.

  • How do I give Mobster a model key under Gemini CLI?

    Pass --env-file to the server. Gemini CLI removes environment variables whose names contain KEY, TOKEN or SECRET unless you set them in the server's env. This happens before the server starts. With --env-file, the server reads your key from the file itself.

  • Should I set trust to true for Mobster?

    Not if the server can reach your iPhone. trust true skips every confirmation for the server, including taps and typing on a real phone. Leave it off and approve tools as they come.

Sources

Gemini CLI’s logo is a trademark of Google, shown only to name the product. Mobster isn’t affiliated with or endorsed by Google.