grantiva mcp starts a Model Context Protocol server that hands an AI agent direct control of an iOS simulator. The agent can build your app, boot a device, read the accessibility tree, tap, swipe, type, take screenshots, run your tests, and capture visual regression baselines — all as ordinary tool calls.
The automation runs through GrantivaAgent, the WebDriverAgent embedded in the CLI. There is no Appium server to run, no Maestro install, and no Accessibility permission to grant. It works headless on CI the same way it works on your Mac.
Every UI-mutating tool returns the updated accessibility tree in its response. The agent sees what changed after each tap without having to ask again — which is what makes an agent able to recover from a broken flow rather than just fail on it.
Start the server
grantiva.yml from the working directory when one is present, which is how the build and VRT tools learn your scheme, simulator, and bundle ID. Tools that take an explicit scheme or simulator argument work without a config file.
UI tools need a runner session
The build, simulator, and context tools work on their own. The UI tools (grantiva_tap, grantiva_swipe, grantiva_type, grantiva_a11y_tree, grantiva_a11y_check, grantiva_script) talk to a live GrantivaAgent session. Start one before or during the agent’s work:
Register it with your agent
Claude Code
.mcp.json at your repo root so everyone on the team gets the same tools:
Claude Desktop
Add the same block toclaude_desktop_config.json, but point cwd at the project so grantiva.yml resolves:
Tools
The server registers asgrantiva and exposes 18 tools.
UI automation
grantiva_a11y_tree and grantiva_a11y_check are the two that change what an agent can do. Every other UI automation tool is a way to act; these are the way to see. The tree is the same accessibility hierarchy VoiceOver walks — labels, types, frames, enabled states — so an agent that gets an unexpected screen can read what is actually in front of it and pick a different element, instead of retrying a label that was never there.
grantiva_a11y_check walks that same tree and reports violations:
Both rules run by default; override the set with
a11y.rules in grantiva.yml. A clean screen returns “No accessibility violations found”, so an agent can gate a change on it.
Build and test
grantiva_run needs bundle_id in grantiva.yml — it cannot launch the app without one.
Simulators
runtime accepts a runtime name, a version, an identifier, or latest.
Scripting
Each step object carries exactly one action key:
tap (label), tap_xy ({x, y}), swipe (direction), type (text), or wait (seconds). Batching a whole flow into one call is much cheaper than a round trip per tap.
Context
This is the tool to call first. It tells the agent what it is working with before it starts guessing.
Visual regression
These shell out to the
grantiva diff subcommands, so they use the same .grantiva/baselines/ directory and the same thresholds as a local run. See Visual regression testing.
Errors
Tool failures are not uniform, so an agent should handle both shapes. The UI and script tools return a normal result withisError: true and a human-readable message — a missing direction, a tap with neither a label nor coordinates. grantiva_build, grantiva_run, and grantiva_test do the same for a failed build, with the compiler errors in the text. grantiva_sim_ensure and grantiva_sim_delete throw instead, surfacing as protocol-level errors.
Resources
Two resources are published alongside the tools:
Both support subscriptions. After
grantiva_tap, grantiva_swipe, grantiva_type, or grantiva_script, the server emits a resource-updated notification for grantiva://hierarchy, so a subscribed client refreshes its picture of the screen automatically.
Worked example
A typical agent session — build the app, get it onto a device, walk a flow, and lock in a baseline.1
Orient
The agent calls
grantiva_context and learns the scheme is MyApp, the bundle ID is com.example.myapp, no simulator is booted, and there is no runner session.2
Provision a simulator
grantiva_sim_ensure with name: "Agent iPhone", device_type: "iPhone 17 Pro", runtime: "latest", boot: true. Idempotent — a rerun reuses the same device instead of piling up new ones.3
Build and launch
grantiva_run with simulator: "Agent iPhone". The app builds, installs, and launches. A build failure comes back as an error result with the compiler errors inline, so the agent can fix the code and call it again.4
Walk the flow
grantiva_script with the onboarding steps:5
Check accessibility
grantiva_a11y_check on the landed screen reports any unlabeled buttons or tap targets below 44×44pt.6
Capture and approve a baseline
grantiva_vrt_capture screenshots every screen in grantiva.yml. grantiva_vrt_compare diffs them against the stored baselines. When the change is intentional, grantiva_vrt_approve promotes the captures — and the next CI run diffs against them.grantiva ci run and CI integration.