AI agents and MCP
Give Claude, Cursor, VS Code or any MCP client the ability to see and use an Android phone through droidline mcp, with setup for each client and tips for good results.
MCP (Model Context Protocol) is the standard way AI assistants use outside tools. droidline mcp is an MCP server: once your assistant is connected to it, the assistant can look at a phone's screen and tap, type and scroll on it, using the same commands you would use in a script.
How it works
- Every Droidline command becomes a tool with the same name. Dotted names use an underscore:
chrome.goischrome_go. dumpreturns a compact screen tree with empty fields removed, so it costs the model fewer tokens.screenshotreturns an image the model can see.- The server tells the agent how to work: look with
dump, act on elements bytext,idordesc, and use coordinates only on screens without elements. - If
droidline serveis not running,droidline mcpstarts one inside its own process. You still need to pair phones once withdroidline pair.
Set up your client
Use the tab for your assistant. In every case the command is droidline mcp; if droidline is not on your PATH, use the full path to the program instead, such as C:\\Tools\\droidline\\droidline.exe (backslashes doubled inside JSON).
claude mcp add droidline -- droidline mcpThen start claude and ask it to look at your phone. claude mcp list shows whether the server is connected.
Open Settings, Developer, Edit Config, or edit the file directly:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"droidline": { "command": "droidline", "args": ["mcp"] }
}
}Restart Claude Desktop. The Droidline tools appear in the tools menu of a new chat.
Add this to ~/.cursor/mcp.json for every project, or to .cursor/mcp.json inside one project:
{
"mcpServers": {
"droidline": { "command": "droidline", "args": ["mcp"] }
}
}Open Cursor's settings, MCP, and check that droidline is listed and enabled.
Add this to .vscode/mcp.json in your workspace:
{
"servers": {
"droidline": { "type": "stdio", "command": "droidline", "args": ["mcp"] }
}
}Start the server from the code lens that appears above it, then use the tools in Copilot's agent mode.
Any MCP client that can start a server over standard input and output works. Configure it to run:
droidline mcpwith no environment variables required. Settings such as DROIDLINE_DEVICE and DROIDLINE_TOKEN are read if present.
Choosing a phone
With one phone online, the agent uses it. With several, the agent calls devices and passes a device to each tool. To pin an agent to one phone, add --device:
{
"mcpServers": {
"droidline": { "command": "droidline", "args": ["mcp", "--device", "shelf-01"] }
}
}
Two entries with different names and devices let one assistant use two phones by name.
Asking for good results
Agents do best with a clear goal and a way to check it. Some prompts that work well:
- "Open Settings on my phone and tell me which Wi-Fi network it is connected to."
- "In the demo app, sign in as knife, then read me the balance on the main screen."
- "Take a screenshot, find the button that dismisses this pop-up, and tap it."
- "Write a Python script that does what you just did, using the droidline package."
The last one is a good habit: let the agent explore a new app once, then turn what it did into a script you can run without it.
Be careful with what you connect
An agent connected to droidline mcp can do anything you could do on the phone, including sending messages and changing settings. Use a test phone or a phone without personal accounts while you try things out, and keep the per-tool confirmation in your client turned on for commands that change data, such as clear_data, input and notification_reply.