Skip to main content
Glama

connector-hub

One small local process that lets an AI agent control the devices in your home.

The agent talks to the hub over MCP (stdio) and sees six tools, no matter how many kinds of device you add. The hub finds devices on your network, keeps them connected, remembers them by hardware identity, and refuses to touch anything you have not approved. Support for a new kind of device is a drop-in folder (writing a driver).

Included driver: android_adb for Android TVs, projectors and streaming boxes with network debugging enabled.

agent ──MCP──▶ hub ──▶ driver: android_adb ──▶ projector, TV box, ...
                 │──▶ driver: (yours)      ──▶ ...
                 └── ~/.connectors/devices.json   (identity, names, approval)

Quick start

Requires Python 3.12+, uv, and for android_adb the Android platform-tools (adb). On the device, enable Developer options → Network/wireless debugging.

git clone <this repo> && cd connectors
uv sync

uv run connectors scan                                    # find devices on your network
uv run connectors approve android-0a1b2c3d4e5f --name projector
uv run connectors list

Then register the hub with your MCP client (below) and ask your agent to "pause the projector".

Related MCP server: Android MCP

Registering with an MCP client

The server command is connectors serve (stdio). For the Claude Code CLI:

scripts/install.sh            # runs: claude mcp add --scope user connectors -- <repo>/.venv/bin/connectors serve
scripts/install.sh --dry-run  # only print the commands

For any other client, add an entry equivalent to:

{ "mcpServers": { "connectors": { "command": "/path/to/connectors/.venv/bin/connectors", "args": ["serve"] } } }

The hub lives as long as the client keeps it running; discovery and health checks run in the background for that whole time. stdout carries only MCP; logs go to stderr and ~/.connectors/hub.log.

Tools

Tool

What it does

devices()

Every known device: id, friendly name, driver, reachable, approved, capabilities and their actions.

state(device)

Awake/asleep, foreground app, now playing (title, playing/paused), volume.

act(device, capability, action, args?)

Control the device using the shared vocabulary below.

observe(device)

Screenshot, returned as a downscaled JPEG image.

run(device, command, confirm?, timeout?)

Raw escape hatch (adb shell <command> for android_adb): stdout, stderr, exit code. Guarded, see Safety.

rescan()

Run discovery now.

device is an id or a friendly name; matching is case-insensitive and forgiving ("the Projector", "proj").

Capability vocabulary

The same words mean the same thing on every device. A device supports a subset, listed by devices().

Capability

Actions

Arguments

power

on off sleep wake

volume

set up down mute

level 0-100 for set; steps for up/down

media

play pause toggle seek next previous stop

seconds (±) for seek

navigate

up down left right ok back home menu

times

apps

list open close

app: a name ("netflix", "prime", "youtube") or a package id

text

type

text, enter

open

url search

url or query, optional app

Examples: act("projector", "media", "pause"), act("projector", "volume", "set", {"level": 30}), act("projector", "open", "search", {"query": "lofi beats", "app": "youtube"}).

Connections are the hub's job

The agent never connects, pairs or handles addresses.

  • Discovery runs in the background per driver. android_adb re-probes remembered devices, then sweeps the local /24 for TCP 5555 (override with CONNECTORS_SUBNETS=10.0.0.0/24,...).

  • Identity is a stable hardware id (the device's MAC address), not its IP. When DHCP moves a device, the hub finds it again and keeps its name and approval.

  • Health checks run every ~25 s, reconnecting with exponential back-off.

  • Every tool call first makes sure the device is connected, re-discovering it if needed. If that fails the agent gets a plain reason: "projector is not reachable on the network — it may be powered off, asleep or disconnected."

Safety

  • Approval. A newly discovered device is listed but unusable (state, act, observe and run all refuse) until you approve it from a terminal: connectors approve <id> --name <name>. The agent has no tool that can approve a device.

  • Guarded run. Commands matching a denylist of destructive patterns (factory reset / wipe, recursive delete, uninstalling or disabling apps, reboot, dd / mkfs, turning debugging or networking off, ...) are refused unless called with confirm=true, and the tool description instructs the agent to get your spoken yes first. The list is in safety.py. It is a seat belt against mistakes, not a sandbox: treat an approved device as fully controllable by the agent.

  • Risky actions. A driver can mark vocabulary actions as risky in its manifest; act refuses those without args.confirm=true.

  • Local only. The hub opens no listening ports. State lives in ~/.connectors/ (override with CONNECTORS_HOME).

Network adb has no authentication beyond the device's own "Allow debugging?" prompt, so only enable it on a network you trust.

CLI

connectors serve                      run the MCP server on stdio
connectors scan                       discover devices now
connectors list                       show known devices
connectors approve <id> --name NAME   allow the agent to use a device
connectors add <host:port>            register a device discovery cannot see (a paired phone)
connectors forget <id>                remove a device

android_adb notes

  • adb is located on PATH, then $ANDROID_HOME/platform-tools, then common install paths.

  • power.off and power.sleep both put the device in standby, so it can be woken again.

  • media.seek sends fast-forward / rewind key presses; how far each one jumps is up to the app.

  • open.search uses deep links for apps that have one (YouTube, Netflix); with no app it tries the system search, then a web search.

  • text.type handles single-line ASCII.

  • observe shows black where an app plays protected video.

  • A device that shows "unauthorized" needs its on-screen debugging prompt accepted once.

Phones and tablets

A phone is one more android_adb device. Pair it once, then add it by address:

  1. On the phone: Developer options → Wireless debugging → Pair device with pairing code.

  2. On this computer: adb pair <pairing address> and type the code.

  3. connectors add <IP address & port shown under Wireless debugging>, then connectors approve <id> --name phone.

Differences from a TV or projector:

  • Its port changes whenever Wireless debugging is switched back on. The hub follows it: it looks the phone up by hardware address and sweeps for the new port. After a phone reboot you still have to turn Wireless debugging on again yourself.

  • It gets the touch capability (tap, long press, swipe). Coordinates are fractions of the screen (0–1), so they match what observe returns at any size.

  • It is strict. Every raw run command needs the user's yes, not only destructive ones, and the agent is told to get a yes before anything that sends, calls, pays, deletes or installs. Taps cannot be classified mechanically, so that last rule relies on the agent and on your MCP client's own confirmation gate. Toggle with connectors approve <device> --strict / --no-strict.

Pairing keys live in ~/.android, and the device registry in ~/.connectors (owner-only). Neither belongs in this repository.

Adding a driver

Create a folder with a manifest.toml and a driver.py in ~/.connectors/drivers/ (or in src/connector_hub/drivers/ to contribute it). See docs/WRITING_A_DRIVER.md.

Development

uv run pytest        # no device needed: a fake driver and a scripted adb
uv run ruff check . && uv run ruff format --check .
uv run mypy

License

MIT

Available Tools

6 tools
actA

Control a device using the shared capability vocabulary.

device is a friendly name or id. capability and action come from this vocabulary (a device supports the subset listed by devices); args is an object with the named arguments:

  • power: on (turn the device on); off (turn the device off); sleep (put the device into standby); wake (wake the device from standby)

  • volume: set (set volume; args: level (0-100)); up (volume up; args: steps (default 1)); down (volume down; args: steps (default 1)); mute (toggle mute)

  • media: play (resume playback); pause (pause playback); toggle (toggle play/pause); seek (seek relative; args: seconds (negative = back; approximate)); next (next item); previous (previous item); stop (stop playback)

  • navigate: up (d-pad up; args: times (default 1)); down (d-pad down; args: times); left (d-pad left; args: times); right (d-pad right; args: times); ok (select / enter); back (go back; args: times); home (go to the home screen); menu (open the menu)

  • apps: list (list launchable apps); open (open an app; args: app (name or package)); close (close an app; args: app (default: the foreground app))

  • text: type (type text into the focused field; args: text, enter (bool, default false))

  • touch: tap (tap the screen; args: x, y as fractions of the screen (0-1, top-left is 0,0)); long_press (press and hold; args: x, y (fractions), ms (default 800)); swipe (swipe; args: x1, y1, x2, y2 (fractions), ms (default 300))

  • open: url (open a URL; args: url, app (optional)); search (search for something; args: query, app (optional))

Actions listed under a device's risky_actions are refused unless the user has clearly said yes and you pass args.confirm=true. A device with strict: true is personal (a phone or tablet). On it, never complete anything that sends a message, makes a call or payment, deletes data or installs an app without first telling the user exactly what will happen and hearing their yes. touch coordinates are fractions of the screen, so they match what observe shows whatever its size. Examples: act("projector", "media", "pause"); act("projector", "volume", "set", {"level": 30}); act("projector", "apps", "open", {"app": "netflix"}); act("projector", "open", "search", {"query": "lofi beats", "app": "youtube"}).

Inputs: action (required), device (required), capability (required), args. Returns: object

devicesA

List every known device: id, friendly name, driver, whether it is reachable and approved, and its capabilities with their actions. Start here.

Inputs: no named parameters. Returns: result

observeA

Take a screenshot of the device's screen and return it as an image. Use it to see menus or check that an action worked. Protected video may appear black.

Inputs: device (required).

rescanA

Search the network for devices right now and return the updated device list. Use it when a device the user mentions is missing or shows as unreachable.

Inputs: no named parameters. Returns: object

runA

Escape hatch: run a raw command on the device and return stdout, stderr and exit code.

For android_adb devices the command runs as adb shell <command>. Use this only when act cannot do the job. Commands that look destructive (factory reset / wipe, recursive delete, uninstalling or disabling apps, reboot, dd / mkfs, turning debugging or the network off, ...) are refused. Never pass confirm=true on your own initiative: first tell the user exactly what the command will do, get their spoken "yes", and only then repeat the call with confirm=true. On a device with strict: true every command needs that confirmation, not only destructive ones. timeout is in seconds (max 120); long output is truncated.

Inputs: device (required), command (required), confirm, timeout. Returns: object

stateB

What a device is doing now: awake or asleep, foreground app, what is playing (title, playing/paused) and the volume, where the device can report them.

Inputs: device (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 6 tools

    Disambiguation4/5

    Each tool targets a distinct facet: discovery (devices/rescan), structured state, action control, visual observation, and a raw escape hatch. Minor overlap exists between devices and rescan (both return device lists) and between state and observe (both inspect current device status), but the descriptions clarify when to use each.

    Naming Consistency3/5

    All names are single lowercase words, but the set mixes nouns (devices, state) with verbs (act, observe, rescan, run), so there is no single predictable convention. It remains readable and intuitive, but not a consistent verb_noun pattern.

    Tool Count5/5

    Six tools is well-scoped for a device-control server: discovery, rescan, state inspection, action, screenshot, and an escape hatch. Each tool has a clear, non-redundant role and earns its place.

    Completeness4/5

    The surface covers discovery, state, control (via a rich capability vocabulary), visual verification, and raw command fallback, which handles most workflows. Minor gaps remain around managing device approval/pairing and removing or forgetting devices, which the tools reference but do not expose.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers