Emulator MCP Server
Controls Android emulators from any MCP-capable client via ADB and emulator CLI, supporting AVD management, APK operations, screen interactions, and device diagnostics.
README
Emulator MCP Server
Model Context Protocol (MCP) server for controlling Android emulators from any MCP-capable client. Uses ADB and the Android emulator CLI. Control AVDs, install APKs, tap, swipe, type, take screenshots, read logs, and more—all through your AI assistant.
Table of contents
- Prerequisites
- Installation
- How to start the server
- Adding to clients
- Available tools
- Troubleshooting
- References
Prerequisites
- Python 3.9+
- Android SDK with:
adbon your PATHemulatoron your PATH (for launching AVDs)
- (Optional) An Android Virtual Device (AVD) for emulator tools
To check:
adb version
emulator -list-avds
Installation
-
Clone or copy this project to a folder, e.g.
android_emulator_mcp. -
Install dependencies:
cd android_emulator_mcp pip install -r requirements.txt -
Verify the server loads:
python main.pyThe server runs over stdio: it will start and wait for JSON-RPC messages. Normal exit is when stdin closes (e.g. the client disconnects). Use Ctrl+C to stop. You don’t need to “run” it yourself when using Cursor, VS Code, etc.—they start it automatically using the config below.
How to start the server
-
When used by a client (Cursor, VS Code, Claude, Antigravity, etc.):
You do not start the server yourself. The client runs thecommand(e.g.python) with theargs(e.g. path tomain.py) you configure. The server process is started and stopped by the client. -
For local testing / debugging:
Run it in the terminal so it uses stdio and waits for input:cd /path/to/android_emulator_mcp python main.pyThen either close stdin (client disconnect) or press Ctrl+C to stop.
To test the protocol, use the official MCP inspector or another MCP client that can launch a stdio server. -
Path to Python:
Use the same executable your client will use. Examples:pythonorpython3if it’s on PATH- Full path, e.g.
C:\Users\User\AppData\Local\Programs\Python\Python310\python.exe(Windows) or/usr/bin/python3(Linux/macOS)
Replace any path below with your project path and Python path as needed.
Adding to clients
Cursor
The emulator server is already added to your Cursor config:
- Global (all workspaces):
~/.cursor/mcp.json— contains the emulator server with path to this project. - This project only:
.cursor/mcp.jsonin this repo — uses${workspaceFolder}/main.pywhen you open this folder in Cursor.
If you add it manually:
- Open Cursor Settings → Features → MCP.
- Click + Add New MCP Server.
- Set:
- Name:
emulator(or any name). - Type:
stdio. - Command:
python(or full path topython.exe). - Args: path to
main.py, e.g.
C:\Users\User\Documents\android_emulator_mcp\main.py
- Name:
- Save. Restart Cursor if the new server doesn’t appear.
Using the server to launch the emulator:
- Restart Cursor (or reload the window) so it picks up
mcp.jsonand starts the emulator MCP server. - Open Chat (Composer / Agent).
- Ensure emulator (or its tools) appear under Available Tools. If not, check Settings → Features → MCP and that the server is enabled.
- Ask the agent to use the emulator, for example:
- “List my Android AVDs” → it can use
list_avds. - “Launch the Android emulator for AVD <name>” → it can use
launch_emulatorwith the AVD name. - “List connected devices” → it can use
list_devices.
- “List my Android AVDs” → it can use
You can approve tool calls when prompted or enable Auto-run for MCP tools in agent settings.
VS Code & Copilot
MCP is supported in VS Code 1.102+ with Copilot. Config can be workspace (.vscode/mcp.json) or user (via MCP: Open User Configuration).
Option A – Workspace (project-only)
- Create
.vscode/mcp.jsonin your project. - Add the emulator server:
{
"servers": {
"emulator": {
"type": "stdio",
"command": "python",
"args": ["C:\\Users\\User\\Documents\\android_emulator_mcp\\main.py"]
}
}
}
Use ${workspaceFolder}/main.py if main.py is inside the workspace, e.g.:
"args": ["${workspaceFolder}/android_emulator_mcp/main.py"]
Option B – User config (all projects)
- Command Palette → MCP: Open User Configuration.
- In the opened
mcp.json, add the sameservers.emulatorblock as above (adjust paths for your machine).
Option C – Command Palette
- MCP: Add Server → choose stdio.
- Command:
python(or full path). - Args: path to
main.py. - Choose Workspace or Global.
After adding, use Chat and ensure the emulator server (and its tools) are enabled in the tool picker. You may need to trust the server when prompted.
Google Antigravity
Antigravity uses a custom MCP config (e.g. Manage MCP Servers → View raw config → mcp_config.json). Add a stdio entry for this server.
- In Antigravity, open the MCP Store (e.g. "..." at the top of the agent/side panel).
- Click Manage MCP Servers → View raw config.
- Edit
mcp_config.jsonand add an entry for the emulator server. Structure is usually a map of server names to configs; use the same pattern as other stdio servers in the file. Example:
{
"emulator": {
"command": "python",
"args": ["C:\\Users\\User\\Documents\\android_emulator_mcp\\main.py"]
}
}
(or "type": "stdio" plus command / args if your Antigravity template uses that). Save and restart/reload MCP in Antigravity so it picks up the new server.
Claude Desktop
- Open the Claude Desktop config file:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Or: Settings → Developer → Edit Config in Claude Desktop.
- Windows:
- Add the emulator under
mcpServers:
{
"mcpServers": {
"emulator": {
"command": "python",
"args": ["C:\\Users\\User\\Documents\\android_emulator_mcp\\main.py"]
}
}
}
Use forward slashes or escaped backslashes in paths; no trailing commas. Restart Claude Desktop fully so the new server is loaded. Tools should appear (e.g. hammer icon) when the server is connected.
Other MCP clients
Most clients that support stdio MCP servers expect a config like:
- Command: executable to run (e.g.
python,python3, or full path to Python). - Args: list with the path to
main.py.
Generic pattern:
{
"mcpServers": {
"emulator": {
"command": "python",
"args": ["/absolute/path/to/android_emulator_mcp/main.py"]
}
}
}
Or with type (if the client requires it):
{
"emulator": {
"type": "stdio",
"command": "python",
"args": ["C:\\Users\\User\\Documents\\android_emulator_mcp\\main.py"]
}
}
Replace the path with your actual android_emulator_mcp path. Then point your client at this config (or merge this block into its MCP config).
Available tools
| Tool | Description |
|---|---|
launch_emulator |
Launch an AVD in the background |
kill_emulator |
Kill the Android emulator |
restart_emulator_cold_boot |
Use when emulator is hanging: kill, wait 25s, then cold boot (avoids PC freeze) |
list_avds |
List available Android Virtual Devices |
list_devices |
List connected devices/emulators |
install_apk |
Install an APK on the device |
uninstall_app |
Uninstall an app by package name |
launch_app |
Launch an app by package (optional activity) |
tap_screen |
Tap at (x, y) coordinates |
swipe |
Swipe from one point to another |
type_text |
Type text on the device |
press_key |
Send key event (BACK, HOME, ENTER, etc.) |
batched_input |
Execute multiple input actions in one call |
get_ui_hierarchy |
Get UI XML tree (bounds, text, IDs) |
click_element_by_text |
Find and tap element by visible text |
start_activity_with_data |
Launch via Deep Link (URI) |
set_gps_location |
Set emulator GPS (lat, lng) |
get_screen_info |
Get device screen resolution |
take_screenshot |
Capture screenshot (optional scale 0.1–1.0) |
read_logs |
Read logcat (optional filter) |
get_logcat_stream |
Last N lines, filter by tag |
clear_logs |
Clear logcat buffer |
check_network_condition |
Test emulator internet access |
get_emulator_stats |
Memory/CPU usage |
record_screen |
Record screen as MP4 |
pull_file |
Pull file from device to host |
push_file |
Push file from host to device |
shell_command |
Run arbitrary adb shell command |
Troubleshooting
-
“adb: command not found” / “emulator: command not found”
Add the Android SDKplatform-toolsandemulatordirectories to your PATH. -
PC or Cursor hangs when killing / launching emulator
What we fix: The server uses a timeout (8 s) foradb emu kill. If the emulator is hung, the command stops after 8 s and on Windows the server force-killsemulator.exe/qemu-system-*.exeso your machine doesn’t stay stuck. What we don't fix: The whole PC can still freeze from load. Killing then immediately cold-booting is very heavy; on 16 GB / i5 that often causes a hang. What to do: Userestart_emulator_cold_boot(avd_name)only—it kills, waits 25 s, then cold boots in one call. Do not call kill_emulator and launch_emulator separately or the PC may freeze. Close other apps first on 16 GB / i5. -
Server not showing in Cursor
Confirm the path tomain.pyin Args is correct and that python (or the full path) runsmain.pywithout errors. Restart Cursor and check Features → MCP for the server and any error state. -
VS Code: server not starting / not trusted
Run MCP: List Servers, select the emulator server, and use Show Output to see logs. Use MCP: Reset Trust if you need to be prompted to trust again. -
Claude Desktop: tools never appear
Restart Claude Desktop completely (quit and reopen). Ensure the config JSON is valid (no trailing commas). Check thatpythonand the path inargsare correct. -
Paths with spaces
Use quoted paths in configs where required. Forargs, a single string like"C:\\Users\\User\\Documents\\android_emulator_mcp\\main.py"is typical; avoid splitting the path across multiple args.
References
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。