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.
| Interface | Best for | You need | Guide |
|---|---|---|---|
| Python | Scripts of any size, data work, testing with pytest | Python 3.9+, pip install droidline | Python |
| Node.js | Scripts in JavaScript or TypeScript, web back ends | Node.js 18+, npm install droidline | Node.js |
| CLI | Quick checks, shell and PowerShell scripts, cron jobs | Nothing extra: the droidline program | CLI |
| HTTP | Languages without an SDK, no-code tools, curl | Any HTTP client | HTTP |
| Raw socket | Long-running programs in any language, events | A TCP socket and a JSON parser | Other languages |
| MCP | Letting an AI agent such as Claude or Cursor use the phone | An MCP client | AI 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 OKcurl -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=30in Python,{ timeout: 30 }in Node.js,--timeout 30in the CLI,"timeout": 30in 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:
| Variable | Default | Meaning |
|---|---|---|
DROIDLINE_HOST | 127.0.0.1 | Address of the server |
DROIDLINE_PORT | 8780 | Port your code connects to |
DROIDLINE_TOKEN | none | Client token, needed when the server runs on another machine |
DROIDLINE_DEVICE | none | The 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.