MCP server for AI agents
PocketShare’s MCP server lets an AI coding agent test its own changes on a real Android phone: find a phone, rent it with a spending cap, install the build, take screenshots, read the screen’s UI elements, tap, swipe and type, read Logcat, and end the rental. It is an ordinary client of the PocketShare API acting for your account, so it can do nothing you haven’t allowed.
Connect your agent
Section titled “Connect your agent”There are two ways to run it, with the same tools.
Nothing to install and no key to copy. Add the server, then sign in when your client asks:
claude mcp add --transport http pocketshare https://pocketshare.io/mcpIn Claude Code, run /mcp and choose Authenticate; in Claude’s apps, add a custom
connector with the URL https://pocketshare.io/mcp. Any client that supports MCP
authorization (OAuth 2.1) works the same way: your browser opens pocketshare.io, you sign
in, check what the app asks for and where it sends you back, and approve. The app is then
listed under Connected apps on the API keys page,
where Disconnect cuts it off at once.
A connected app always acts as an agent (below). It may search phones and rent, use and end them; it can’t see your balance, change your account or create keys.
For clients without OAuth, and for CI. Use an API key, ideally an agent key (below):
claude mcp add --transport http pocketshare https://pocketshare.io/mcp \ --header "Authorization: Bearer psk_…"Other clients: a streamable HTTP server at https://pocketshare.io/mcp with the header
Authorization: Bearer <your key>.
Runs on your machine over stdio with the CLI’s sign-in, and can install APK files from disk:
pocketshare loginclaude mcp add pocketshare -- pocketshare mcpOther clients: command pocketshare, argument mcp. To give the agent its own key, set
POCKETSHARE_API_KEY in the server’s environment.
Cursor, VS Code and other clients
Section titled “Cursor, VS Code and other clients”Point any client that supports streamable HTTP at https://pocketshare.io/mcp; it asks you to
sign in the first time. In Cursor (~/.cursor/mcp.json, or .cursor/mcp.json in a project):
{ "mcpServers": { "pocketshare": { "url": "https://pocketshare.io/mcp" } } }In VS Code (.vscode/mcp.json):
{ "servers": { "pocketshare": { "type": "http", "url": "https://pocketshare.io/mcp" } } }A client that can’t sign in can send an agent key instead, as the header
Authorization: Bearer psk_….
The hosted server can’t read files on your computer: install_apk takes a public https URL
there; for a local build use the local server or pocketshare install.
Try it
Section titled “Try it”Once connected, ask your agent something like:
Rent a Pixel 9a with a $1 cap. Install
app/build/outputs/apk/debug/app-debug.apk, open the app, take a screenshot of the home screen and check Logcat for crashes. Then end the rental.
The agent searches for the phone, rents it, and calls the tools below. A local file needs the
local server (pocketshare mcp); with the hosted one, give the build as an https URL. You can
follow the rental live under Rentals on pocketshare.io.
| Tool | What it does | Costs money |
|---|---|---|
search_phones |
Phones by brand, Android version and price | No |
rent_phone |
Rent a phone; max_spend (dollars) is required. Waits until the phone is ready |
Yes |
session_status |
State, cost so far, cap, when it ends if idle, and today’s agent limit | No |
install_apk |
Install or update an app from a path (local server) or https URL | Rental time |
screenshot |
The screen as a PNG | Rental time |
get_ui_tree |
The screen’s elements with their text, id and the point to tap | Rental time |
tap, swipe, type_text, press_key |
Touch and keys | Rental time |
logcat |
Recent log lines, for one app, a priority or filter specs | Rental time |
shell |
A shell command as the phone’s unprivileged shell user, as adb shell |
Rental time |
end_session |
End the rental now: billing stops and the phone is wiped | No |
Rental time is billed per started minute at the phone’s hourly price, plus data, as for any
rental. Tell your agent to call end_session when it is done.
Spending limits
Section titled “Spending limits”AI agents can loop, so rentals they start have three limits, all enforced by PocketShare’s API rather than by the MCP server:
- A cap per rental.
rent_phonerefuses to rent withoutmax_spend; the rental ends when the next minute would go over it. - A daily limit for agent rentals, $5.00 by default. Agent rentals started in the last 24
hours count at their caps while open and at what they cost once ended; a rental whose cap
doesn’t fit in what’s left is refused (
agent_daily_limit_exceeded). - An idle timeout, 5 minutes by default. An agent rental with no tool calls for that long
is ended (
idle_timeout), so a forgotten rental stops costing money.
Every rental the MCP server starts is an agent rental. So is every rental made with an agent key or by a connected app, whatever program uses it: create an agent key for your agent on pocketshare.io, and the limits hold even if the agent calls the REST API directly. Agent keys and connected apps can lower the limits but never raise them.
pocketshare agent-limits # show thempocketshare agent-limits --daily 10 --idle-minutes 10Raising them needs the website or a regular (non-agent) key; the most an account can set is $50.00 a day.
Safety
Section titled “Safety”- The phone belongs to a host. Use test accounts and test data only.
shelland everything else goes through the same ADB policy asadb: no root, nothing that takes the phone out of the host’s control. Anything left behind is wiped after the rental, and a phone left in a state cleanup can’t undo is taken out of service.- The hosted server downloads APKs only from public https addresses.
- Sign-in follows the MCP authorization specification: PKCE, exact redirect addresses, tokens
that work only at
pocketshare.io/mcpand expire after an hour (the app refreshes them for up to 30 days between uses), and only hashes of them stored. Only approve a sign-in you just started; the approval page says when an app registered itself and when it sends you back to a program on your own computer.