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 MCP server built into MAS: 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 local MCP server built into 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. It can also list and run the macros in your library, crop a control into your Image Library, hand a goal to MAS Agent, scaffold and validate macro code, and put a macro on a schedule. Thirty-seven tools in total on the local server, and the device and vision ones all work from pixels, so they work on games as well as apps.
The hosted MAS server does the same on the always-on cloud devices in your account, adding device leases and the learned map of an app. That is 40 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.
- The emulator’s ADB setting switched on, if it has one; the BlueStacks setup guide shows where. The app drives whatever adb can see.
- Macro Automation Studio, open and signed in. It brings its own adb, so there is nothing else to install; the download is free to try.
- Claude Code installed.
Step 1: switch the local server on
Open the app, go to Integrations (MCP) and turn the local server on. The page shows the URL it listens on, http://127.0.0.1:3846/mcp unless you changed the port, and the device list next to it tells you whether the app can see your emulator. If it cannot, the emulator’s ADB option is off or its port is not exposed; fix that first.
Step 2: add the server to Claude Code
The local server is a streamable HTTP server, so one command registers it:
claude mcp add --transport http mas-local http://127.0.0.1:3846/mcp
Run /mcp inside Claude Code to confirm it connected. When several emulators are running, name the one you want in the prompt: every device tool takes a device, which is the id list_devices returned (emulator-21513), an adb serial (127.0.0.1:21513) or the bare port. Leave it out and the server uses the single emulator that is running.
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 server stays on your machine. The hosted MAS MCP server reaches the always-on cloud Android devices and runs the same work server-side: run_macro executes a saved macro on a cloud device with your PC off, 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.
Register it the same way, then sign in from /mcp inside Claude Code:
claude mcp add --transport http mas-cloud https://api.automationmacro.com/mcp
Pick mas-cloud, choose Authenticate, and approve the scopes in the browser tab that opens. For a scripted setup, skip the sign-in and send a key you created in the app instead:
claude mcp add --transport http mas-cloud https://api.automationmacro.com/mcp --header "X-API-Key: $MAS_API_KEY"
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 40 tools with their parameters, plus the Cursor and Codex snippets.
Troubleshooting
- No devices listed. The emulator’s ADB option is off, or the emulator is not running. Check the app’s device list first; the server returns what the app sees.
- Claude Code cannot connect. The app is closed or the local server is switched off. Check the toggle under Integrations (MCP), and confirm the port in your URL matches the one the page shows.
- Taps land in the wrong place. The emulator resolution changed after a template was captured, or two devices are connected and the server picked the other one. Name the device in the prompt.
- 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 MAS local server is an Android emulator MCP server: one claude mcp add --transport http 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 desktop app ships its own adb and talks to the emulator with it. 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 server lists it like an emulator. Nothing is installed on the phone.
Does it work with Cursor or Codex too?
Yes. Both servers are URLs, so Cursor, Codex, Hermes and any other client that speaks MCP over HTTP take the same two entries. Claude Desktop launches commands rather than calling URLs, so it starts the app itself with a --mcp flag that bridges to the same local server. Snippets are on the MCP page.
What does the local server cost?
Nothing beyond the app: it is part of Macro Automation Studio and needs the app open and signed in. It listens on loopback and answers only your own machine. 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 API key, first prompts, and the hosted route to cloud devices.
AI Macro Generator for BlueStacks, LDPlayer and MuMu
An AI macro generator writes the macro for you on BlueStacks, LDPlayer, MuMu or MEmu. How MAS Agent explores the emulator, writes the code, and what it costs.
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.
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.