Connect Claude Code to an Android Emulator in 5 Minutes (MCP Setup)
Give Claude Code eyes and hands on BlueStacks, LDPlayer, MuMu or MEmu with the free MAS MCP connector: one command, first prompts, and the cloud route.
Claude Code can drive an Android emulator once it has an MCP server that turns the device into tools. This guide connects it to BlueStacks, LDPlayer, MuMu or MEmu with the free local connector from Macro Automation Studio, then shows the prompts that prove it works and the hosted route for cloud devices.
What you get
After setup, Claude Code can take a screenshot of the emulator and look at it, read the text on screen with OCR, find a button by matching an image, tap, swipe, type, press keys, and open or close apps. Thirteen tools in total on the local connector, all working from pixels, so they work on games as well as apps.
The hosted MAS server adds the rest: run and stop saved macros on a cloud device, ask MAS Agent to build a macro from a sentence, and read the map it learned of an app. That is 25 tools on one remote endpoint, covered at the end.
Prerequisites
- An Android emulator on your machine: BlueStacks, LDPlayer, MuMu, MEmu or any other adb-compatible one, on Windows or macOS.
- adb on your PATH. The connector drives whatever
adb deviceslists. Enable the emulator’s ADB setting if it has one; the BlueStacks setup guide shows where. - Python, and the MAS agent package. The desktop app’s Connect page walks you through getting it; the download is free to try.
- Claude Code installed.
Step 1: check that adb sees the emulator
Run adb devices in a terminal. You should see one line per running emulator. If the list is empty, the emulator’s ADB option is off or the port is not exposed; fix that first, because the connector cannot see what adb cannot.
Step 2: add the connector to Claude Code
The connector is a stdio MCP server. One command registers it:
claude mcp add mas-local -- python -m masagent mcp
To pin a specific emulator when several are running, set MAS_DEVICE to its serial from adb devices, or pass the device as an argument. Otherwise the connector takes the first device adb lists.
Step 3: prove it works
Start a Claude Code session and ask, in plain English:
- “List my Android devices.” You should get the emulator back.
- “Take a screenshot of the device.” Claude receives the image and can describe what it sees.
- “Read the text on screen.” You get OCR lines with a confidence and a bounding box each.
- “Find the Claim button and tap it.” Claude uses
find_imagewith a template, gets the coordinates and score, then taps.
The screenshot is scaled to 1280 px on its long edge and comes back with the scale factor, so coordinates from read_text and find_image line up with tap.
Step 4: give it a task worth doing
Now the prompts that matter. “Open the game, claim the daily reward, close any popup, and tell me what the energy counter says.” Claude chains screenshot, find_image, tap, read_text and press_key on its own. For a test flow: “Log in with the test account, and tell me whether the welcome screen appears.” Every step is visible in the tool calls, and every screenshot is something you can inspect.
The hosted server: cloud devices, macros and the agent
The local connector is free and stays on your machine. The hosted MAS MCP server reaches the always-on cloud Android devices and adds the tools a device server alone cannot offer: run_macro executes a saved macro server-side, author_macro asks MAS Agent to explore an app and build a macro from your goal, and get_map returns the screens and proven routes the agent learned.
Auth is OAuth client credentials. Create a key in the app under API keys, exchange it for a one-hour token at the token endpoint, and add the server with a bearer header:
claude mcp add --transport http mas https://api.automationmacro.com/mcp --header "Authorization: Bearer $MAS_MCP_TOKEN"
lease_device opens a control session on a cloud device and can boot a stopped one; leases renew on every call and expire after ten idle minutes. Device tools carry no per-call charge; running a finished macro costs zero credits; agent authoring spends credits as it works. The MCP page lists all 25 tools with their parameters, plus the Cursor and Codex snippets.
Troubleshooting
- No devices listed. The emulator’s ADB option is off, or adb is not on PATH. Run
adb devicesyourself before blaming the connector. - Taps land in the wrong place. The emulator resolution changed after a template was captured, or two devices are connected and the connector picked the other one. Pin the device with
MAS_DEVICE. - Claude says the screenshot is blank. Some emulators render to a second window; make sure the game is in the foreground of the device you selected.
- Slow steps. Each action waits on a model decision. For anything you will repeat, let
author_macrocompile it into a macro and run that instead.
One more thing before you point it at a game: No automation tool is 100% risk-free, so automate responsibly and at your own discretion.
Frequently asked questions
Can Claude Code control an Android emulator?
Yes. The free MAS local connector is an Android emulator MCP server: one claude mcp add command gives Claude Code screenshots, OCR, template matching and input on BlueStacks, LDPlayer, MuMu, MEmu or any adb-compatible emulator.
Do I need Android Studio?
No. The connector needs adb on your PATH and nothing else. Android Studio is a separate tool for building apps.
Does it work on a physical phone?
Yes. Enable USB debugging, plug the phone in, and the connector lists it like an emulator. Nothing is installed on the phone.
Does it work with Cursor or Codex too?
Yes. The local connector is a stdio server any MCP client can launch, and the hosted server takes a bearer header from Cursor, Codex, Hermes or any client that can call a remote HTTP MCP server. Snippets are on the MCP page.
Is the connector free?
Yes. It runs on your machine, makes no network calls of its own, and needs no account. The hosted server’s tools work on the cloud devices your MAS account owns.
Can Claude build a whole bot through MCP?
Yes, through author_macro on the hosted server. MAS Agent explores the app on a cloud device, compiles a macro, validates it by replay, and the macro lands in your library ready for run_macro.
Keep reading
Related guides
Cursor + Android Emulator MCP Setup: BlueStacks, LDPlayer, MuMu, MEmu
Set up a Cursor Android emulator MCP server in minutes: the .cursor/mcp.json entries, the token flow, first prompts, and the hosted route to cloud devices.
Android Automation Tools in 2026: Phone Apps vs Emulator Macros vs AI Agents
The five kinds of Android automation tool in 2026 and how to choose: on-phone app, emulator recorder, image-recognition studio, AI agent or cloud device.
Are Emulator Macros Safe? Ban Risk on BlueStacks, LDPlayer, MuMu, MEmu
A direct answer on emulator macro ban risk for BlueStacks, LDPlayer, MuMu and MEmu: what decides it, what humanized input means, and how to keep it low.
Ready to automate it?
Download Macro Automation Studio, point it at your emulator, cloud device or phone, and let the agent build the first macro.