Choose a language

Every way to talk to Droidline (Python, Node.js, the CLI, HTTP, a raw socket and MCP), what each one is best at, and the settings they share.

Every interface talks to the same server, droidline serve, on 127.0.0.1:8780, and every one uses the same command names with the same parameters. touch is touch everywhere. Pick the one that fits the job; you can mix them, for example a Python script for the routine and the CLI for quick checks.

InterfaceBest forYou needGuide
PythonScripts of any size, data work, testing with pytestPython 3.9+, pip install droidlinePython
Node.jsScripts in JavaScript or TypeScript, web back endsNode.js 18+, npm install droidlineNode.js
CLIQuick checks, shell and PowerShell scripts, cron jobsNothing extra: the droidline programCLI
HTTPLanguages without an SDK, no-code tools, curlAny HTTP clientHTTP
Raw socketLong-running programs in any language, eventsA TCP socket and a JSON parserOther languages
MCPLetting an AI agent such as Claude or Cursor use the phoneAn MCP clientAI agents

The same command everywhere

Here is one command, tapping the element whose text is "OK", in each interface:

d.touch("text", "OK")
await d.touch("text", "OK");
droidline touch text OK
curl -s -X POST localhost:8780/devices/_/touch \
  -H 'content-type: application/json' -d '{"by":"text","value":"OK"}'
{"id":1,"cmd":"touch","by":"text","value":"OK"}

The parameters follow the same rules everywhere:

  • Required parameters come first, in the order the command reference lists them. Pass them by position.
  • Optional parameters can be left out; the server fills in the defaults. Pass them by name: timeout=30 in Python, { timeout: 30 } in Node.js, --timeout 30 in the CLI, "timeout": 30 in JSON.
  • Which phone: with one phone online you never have to say. With several, choose one: connect("shelf-01"), --device shelf-01, /devices/shelf-01/... or "device": "shelf-01".

All of them are generated from one file, commands.json, so a new command reaches every language at the same time.

Settings every interface reads

These environment variables change the defaults for the SDKs, the CLI and the MCP adapter alike:

VariableDefaultMeaning
DROIDLINE_HOST127.0.0.1Address of the server
DROIDLINE_PORT8780Port your code connects to
DROIDLINE_TOKENnoneClient token, needed when the server runs on another machine
DROIDLINE_DEVICEnoneThe phone to use when you do not name one

The server only accepts connections from the same computer unless you change client.listen in config.toml. To control phones from another machine, read Security first; the client token is what keeps strangers out.