Claude Agent SDK on Android: give Claude a phone.
The Claude Agent SDK can operate Android apps through Mobilebox. Add the hosted Mobilebox MCP server to mcpServers, allow its tools, and Claude reads a cloud phone’s screen as numbered elements, then taps, types, swipes and installs apps to finish the task.
TypeScript, 29 lines, the hosted MCP server and its 13 tools. Android and iPhone over one API.
- 1
Get a key
Sign up with GitHub and create an API key in the dashboard. New accounts get $2 of credit.
- 2
Install Claude Agent SDK
npm i @anthropic-ai/claude-agent-sdk - 3
Run the example
node agent.tswithMOBILESANDBOX_API_KEYandANTHROPIC_API_KEYset. It creates a phone, gives the agent one task and deletes the phone, also when the run fails.
The whole example
tools: [] turns off the built-in file and shell tools, so this agent only has the phone; allowedTools runs the Mobilebox tools without a permission prompt.
// Claude Agent SDK + Mobilebox: Claude drives a cloud Android phone with the Mobilebox MCP tools.
// npm i @anthropic-ai/claude-agent-sdk
// MOBILESANDBOX_API_KEY=... ANTHROPIC_API_KEY=... node agent.ts
import { query } from '@anthropic-ai/claude-agent-sdk'
const API = 'https://mobilebox.dev'
const AUTH = { Authorization: `Bearer ${process.env.MOBILESANDBOX_API_KEY}` }
async function phones(method: string, path = '') { // your code owns the phone: create it, and always delete it
const res = await fetch(`${API}/v1/phones${path}`, { method, headers: AUTH })
if (!res.ok) throw new Error(`${method} /v1/phones${path}: ${res.status} ${await res.text()}`)
return res.status === 204 ? null : res.json()
}
const phone = (await phones('POST', '?wait=ready')).id
try {
for await (const message of query({
prompt: 'Open Settings > Display and tell me the brightness level.',
options: {
systemPrompt: `You operate the Android phone ${phone} with the Mobilebox tools. ` +
'Observe, act, and check each result on the returned screen. Don\'t create or delete phones.',
mcpServers: { mobilebox: { type: 'http', url: `${API}/mcp`, headers: AUTH } },
tools: [], // no built-in file or shell tools: only the phone
allowedTools: ['mcp__mobilebox'], // every Mobilebox tool, without a permission prompt
maxTurns: 20,
},
})) {
if (message.type === 'result') console.log(message.subtype === 'success' ? message.result : message.subtype)
}
} finally {
await phones('DELETE', `/${phone}`)
}
Ran once against production on 5 November 2026: the agent answered “The brightness level is 83%” in 35 s, and the phone was deleted. Run log
Questions
Before you wire Claude Agent SDK to a phone.
Is this the same as Claude Code?
The Agent SDK runs the Claude Code harness as a library. In Claude Code itself one command adds the same server; see Claude Code setup.
Why tools: [] and allowedTools?
An empty tools list removes the built-in Read, Write and Bash tools, so the agent can only use the phone. allowedTools: ["mcp__mobilebox"] lets every Mobilebox tool run without asking.
Can the agent install my app?
Yes. install_app takes a public APK or split-bundle URL, or your code uploads the file over REST; then the agent opens it with {"type":"open_app","package":…}. See installing APKs and split bundles.
Does it work on iPhone?
Yes. Create the phone with platform: "ios" and the agent uses the same tools. See iPhone and iPad.
What does a run like this cost?
A ready phone costs $0.01 a minute, billed per second with a one-minute minimum; boot time and parked phones are free, so a run like the one above costs about a cent. See pricing.
Read more
Test your Android app with Claude Code on a cloud phone
Give Claude Code a hosted Android phone over MCP, install your APK from a URL, check the first screen and delete the phone, with the tool calls we ran.
Give your coding agent an Android sandbox over MCP
Add the remote MCP server to Claude Code or Cursor, see every phone tool, run a bounded first task and know what is proven.
Using another framework? OpenAI Agents SDK, LangGraph, CrewAI, browser-use, Mastra, Vercel AI SDK.
All integrations