DocsIntegrate

Connect an AI agent

Installing the stick-mcp MCP server, the tools it offers and the recommended workflow, and how it divides work with the software-layer SDK.

Two layers of tools#

Layer MCP server What it does
Hardware layer stick-mcp Device status, keyboard and mouse actions, macros, the monitor screen, screenshots, apps, files
Software layer stick-sdk-mcp Intent-level operations: move, click, drag and type by screen coordinates; foreground window checks; post-run verification

The hardware layer only sends actions out on time. When an agent needs to "click this coordinate" or "type into this window", use the software layer. You can register both at the same time.

The quickest way#

The Connect an agent card on the device web app's home page
The Connect an agent card on the home page: copy the text and send it to your agent
  1. Open the device web app's home page in a browser; see Device web app.
  2. On the Connect an agent card, click Copy and send the prompt to your agent.
  3. The agent reads http://<device-address>/llms.en.txt, installs the tools itself and requests pairing.
  4. When the pairing request appears on the device screen, check the number and click BOOT.

llms.en.txt is served by the device itself (the Chinese version is llms.txt), and its commands already contain the install package's file name. Below are the same steps done by hand.

Install stick-mcp manually#

The device ships the host tools' install package, which contains the stick CLI and the stick-mcp MCP server, in a version that matches the device firmware.

Requirement: uv on your computer; on Windows, use winget install astral-sh.uv.

The package address looks like this:

http://192.168.1.50/sdk/stick-x.y.z-py3-none-any.whl

The exact file name is listed in http://192.168.1.50/llms.en.txt. Below, $whl stands for it:

PowerShell
$dev = "http://192.168.1.50"
$whl = "$dev/sdk/stick-x.y.z-py3-none-any.whl"

1. Pair. The command shows a 4-digit number; when the same number appears on the device screen, click BOOT within 30 seconds to allow.

PowerShell
uvx --from $whl stick --url $dev pair --wifi --name "Claude Code"

The key is saved to ~/.esp-stick/secrets/devices.json, so you don't need to pass it again.

2. Try it.

PowerShell
uvx --from $whl stick --url $dev info

3. Register it as an MCP server. Using Claude Code as an example:

PowerShell
claude mcp add stick -e STICK_URL=$dev -- uvx --from $whl stick-mcp

For other MCP clients: the command is uvx --from <package-address> stick-mcp, set the environment variable STICK_URL to the device address, and use the stdio transport.

After registering, have the agent call stick_info first to confirm it can connect.

NoteIf the device's IP address changes, update both the package address and STICK_URL. You can give the device a fixed address in your router.

Common tools#

Tools map one-to-one to CLI commands: add the stick_ prefix and replace - with _. Results are JSON: check ok, and on failure read error.

Tool Effect
stick_info, stick_status Device info, status snapshot
stick_hid_arm Arm keyboard and mouse output, with a lease of 1–600 seconds
stick_hid_send Send keyboard and mouse actions
stick_hid_release Release all keys without disarming
stick_hid_disarm Emergency stop and disarm
stick_hid Output state: armed or not, queue, keys held, reason for the last stop
stick_hid_play Send a timeline file, for long sequences with precise timing
stick_monitor Show what is happening on the device's monitor screen
stick_button Read BOOT button events, or wait for the user to confirm with a press
stick_snap Capture the device screen and return the image directly
stick_macro_ls, stick_macro_get, stick_macro_put, stick_macro_select, stick_macro_run, stick_macro_stop Manage and run macros
stick_pair Request pairing over Wi-Fi, with wifi=true
stick_logs, stick_events Device logs, app events
stick_push, stick_try, stick_eval Push and debug Lua apps
stick_fs_*, stick_sd_* Files in storage and on the microSD card

Tools that press keys, reboot or delete data are marked as destructive, for example stick_hid_send, stick_macro_run, stick_sd_play, stick_fs_rm and stick_wifi_forget. The tools that build and update firmware need the full repository; see Build the firmware yourself.

Action syntax:

JSON
[{"tap": "S", "mods": ["ctrl"]},
 {"text": "hello"},
 {"move": [100, 0]},
 {"click": "left"},
 {"wait": 200}]
  1. stick_info: confirm the device is online and running the kernel.
  2. Confirm with the user that the foreground window is the one to operate on.
  3. stick_monitor: show on the device screen what is about to happen.
  4. stick_hid_arm: arm, with the shortest lease that is long enough.
  5. stick_hid_send: send actions.
  6. Finish: stick_hid_release to only release keys, or stick_hid_disarm for an emergency stop and disarm.

Key points:

  • For long sequences with precise timing, send a timeline with stick_hid_play instead of calling one action at a time.
  • For very large sequences, first put them on the microSD card with stick_sd_put, then use stick_sd_play to have the device read and play them from the card itself.
  • Write repeatable, fixed procedures as macros: upload with stick_macro_put and set as current with stick_macro_select; after that, the user runs it with a single BOOT click.
  • When you need the user's confirmation, wait for one button press with stick_button.

Rules for agents#

These rules are written in the device's llms.en.txt, and agents should follow them; you should know them too.

  • Keystrokes go to whichever window is in the foreground. Before sending any keys, confirm the foreground window with the user.
  • Pressing BOOT during output is an emergency stop. Tell the user this.
  • Use only the standard 87-key set, up to F12.
  • A keyboard device cannot type Chinese directly. When the computer's Pinyin input method is in Chinese mode, it intercepts English text too: ask the user to switch to English before typing.
  • Don't clear Wi-Fi. wifi-forget without a name takes the device offline, and the agent cannot recover it on its own.
  • Use the keyboard and mouse tools only when the user asks.

Without installing tools#

An agent can also call the HTTP API directly: request pairing, sign requests, arm and send actions. The steps and sample code are in the device's llms.en.txt; for the protocol, see HTTP API.

Software-layer SDK#

To operate windows on the computer by screen coordinates, use the software layer's stick-sdk-mcp. It is built on top of the hardware layer:

  • The agent submits a JSON plan stating where to click, what to type and what guards apply; the SDK compiles it into a timeline and sends it in one batch.
  • A plan can declare that the target window must be in the foreground; this is checked periodically during execution, and if it fails the SDK triggers an emergency stop immediately.
  • Optional human style and post-run verification.
Tool Description
screen, windows Read-only: displays, foreground window, cursor, visible windows
run_plan Run a plan. The first choice for multi-step operations
move_to, click_at, drag_path, type_text, press_keys, scroll Single-step operations
stop Emergency stop immediately

The SDK must run on the computer the device is plugged into. It currently supports Windows only and runs from the repository. For installation, usage and the recommended workflow, see Software-layer SDK; for every plan field, see Plan format.

View the source of this page on GitHub