Offbeat-IoT Documentation
Get started
Connect an AI assistant to Offbeat-IoT

Connect a compatible AI assistant to your Offbeat-IoT account to view device information and use device tools.

Connect your assistant

In your assistant’s MCP settings, add a remote server with the URL https://www.offbeat-iot.com/mcp and choose the Streamable HTTP transport. Add an Authorization header with the value Bearer YOUR_PERSONAL_ACCESS_TOKEN. The exact setup depends on your assistant; it must support the Streamable HTTP transport.

Create a personal access token

In Offbeat-IoT, go to Profile → Manage access tokens and create a token. Use the token as the bearer credential in your assistant’s MCP settings. Keep it private, and revoke it from the same page if you no longer need it.

MCP tokens do not have scopes. A token can read, control and configure devices owned by its user, subject to its optional device restriction. Existing tokens use the same model; their former scopes no longer limit available operations. The authenticated POST /api/ai-agents endpoint accepts {"name":"Device provisioner"} and returns the token once.

Device-restricted tokens can only configure their allowed, user-owned devices. They cannot create devices: a newly generated ID is outside their fixed allowlist. Use a management token with no device restriction for creation. Device lookups always enforce account ownership.

Only grant device-control access to assistants you trust.

Available tools

  • listDevices - list your devices.

  • getDeviceStatus - view a device’s status by endpoint ID or friendly name.

  • sendDataToDevice - send data to a device.

  • getSensorHistory - view sensor history.

  • tailEvents - view recent device events.

Create and configure devices

Device creation and configuration reuse the REST v2 services and validation. All provisioning tools use exact deviceId values, returned by createDevice. The device need not be online. These tools do not link assistants or change assistant-specific settings.

Tool Arguments Result

createDevice

request: name, description (both required)

Device details including generated deviceId

getDeviceConfiguration

deviceId

device, toggles, modes, inputs, eventSources, inventory

updateDevice

deviceId, request: name and/or description

Updated device details

createDeviceToggle

deviceId, request: instance, friendlyNames

Created toggle

createDeviceMode

deviceId, request: instance, friendlyNames, states, optional description

Created mode

createDeviceInput

deviceId, request: instance, friendlyNames

Created input

createDeviceEventSource

deviceId, request: supportedEventId (ButtonOn or ButtonOff)

Created source including generated instanceId

createDeviceInventory

deviceId, request: instance, friendlyNames, optional replenishmentId

Created consumable

deleteDeviceToggle, deleteDeviceMode, deleteDeviceInput, deleteDeviceInventory

deviceId, instance

No response data

deleteDeviceEventSource

deviceId, instanceId

No response data

deleteDevice

deviceId

deviceId, name, deleted: true

friendlyNames is a nonempty array of names. A mode’s states is a nonempty array of objects with required state and optional friendlyNames and description. Instance-backed features support create, list and delete, matching REST; to replace one, delete it and create its replacement. This is two operations, not an atomic update. A creation retry can produce another device or event source; read back the result before retrying after an uncertain response.

deleteDevice permanently removes the device, its configuration and its related data, using the same cleanup as the UI deletion flow. It is not reversible, and a second deletion of the same ID returns not found. Delete the whole device only when you intend to retire it; use the instance deletion tools to remove a single toggle, mode, input, event source or consumable.

MCP worked example

Call the tools in order with these arguments. Substitute the deviceId returned by the first call for DEVICE_ID.

{"name":"createDevice","arguments":{"request":{"name":"Workshop","description":"Workshop controller"}}}
{"name":"updateDevice","arguments":{"deviceId":"DEVICE_ID","request":{"name":"Workshop controller"}}}
{"name":"createDeviceToggle","arguments":{"deviceId":"DEVICE_ID","request":{"instance":"light","friendlyNames":["work light"]}}}
{"name":"createDeviceMode","arguments":{"deviceId":"DEVICE_ID","request":{"instance":"fan","friendlyNames":["fan mode"],"states":[{"state":"quiet","friendlyNames":["quiet"]},{"state":"boost","friendlyNames":["boost"]}]}}}
{"name":"createDeviceInput","arguments":{"deviceId":"DEVICE_ID","request":{"instance":"usb","friendlyNames":["USB"]}}}
{"name":"createDeviceEventSource","arguments":{"deviceId":"DEVICE_ID","request":{"supportedEventId":"ButtonOn"}}}
{"name":"createDeviceInventory","arguments":{"deviceId":"DEVICE_ID","request":{"instance":"filter","friendlyNames":["filter"]}}}
{"name":"getDeviceConfiguration","arguments":{"deviceId":"DEVICE_ID"}}
{"name":"deleteDeviceToggle","arguments":{"deviceId":"DEVICE_ID","instance":"light"}}
{"name":"deleteDevice","arguments":{"deviceId":"DEVICE_ID"}}

The read-back contains the persisted settings in the five configuration arrays. For event-source deletion, use the instanceId returned by its creation call.

MCP returns JSON as text inside content. For example, the event-source call returns a result with this shape (the generated ID varies):

{"content":[{"type":"text","text":"{\"deviceId\":\"DEVICE_ID\",\"instanceId\":\"GENERATED_INSTANCE_ID\",\"supportedEventId\":\"ButtonOn\"}"}],"isError":false}

Parse content[0].text as JSON to obtain instanceId; use the same procedure on createDevice to obtain deviceId. A failed call instead returns isError: true, for example:

{"content":[{"type":"text","text":"Device-restricted PAT tokens cannot create devices"}],"isError":true}

Exception messages may include a framework prefix; use isError to determine success rather than matching the full text.

Equivalent REST workflow

The REST API uses an authenticated user session or a supported REST bearer access token (not an MCP personal access token). The commands below use a REST bearer token in REST_ACCESS_TOKEN; the shell syntax is Bash and requires jq. The complete request/response contract is in openapi.yaml.

BASE=https://www.offbeat-iot.com/api/v2
created=$(curl --fail-with-body -sS "$BASE/devices" \
  -H "Authorization: Bearer $REST_ACCESS_TOKEN" -H 'Content-Type: application/json' \
  -d '{"name":"Workshop","description":"Workshop controller"}')
DEVICE_ID=$(printf '%s' "$created" | jq -er '.deviceId')

curl --fail-with-body -sS -X PUT "$BASE/devices/$DEVICE_ID" \
  -H "Authorization: Bearer $REST_ACCESS_TOKEN" -H 'Content-Type: application/json' \
  -d '{"name":"Workshop controller"}'
curl --fail-with-body -sS "$BASE/devices/$DEVICE_ID/toggles" \
  -H "Authorization: Bearer $REST_ACCESS_TOKEN" -H 'Content-Type: application/json' \
  -d '{"instance":"light","friendlyNames":["work light"]}'
curl --fail-with-body -sS "$BASE/devices/$DEVICE_ID/modes" \
  -H "Authorization: Bearer $REST_ACCESS_TOKEN" -H 'Content-Type: application/json' \
  -d '{"instance":"fan","friendlyNames":["fan mode"],"states":[{"state":"quiet","friendlyNames":["quiet"]},{"state":"boost","friendlyNames":["boost"]}]}'
curl --fail-with-body -sS "$BASE/devices/$DEVICE_ID/inputs" \
  -H "Authorization: Bearer $REST_ACCESS_TOKEN" -H 'Content-Type: application/json' \
  -d '{"instance":"usb","friendlyNames":["USB"]}'
curl --fail-with-body -sS "$BASE/devices/$DEVICE_ID/event-sources" \
  -H "Authorization: Bearer $REST_ACCESS_TOKEN" -H 'Content-Type: application/json' \
  -d '{"supportedEventId":"ButtonOn"}'
curl --fail-with-body -sS "$BASE/devices/$DEVICE_ID/inventory" \
  -H "Authorization: Bearer $REST_ACCESS_TOKEN" -H 'Content-Type: application/json' \
  -d '{"instance":"filter","friendlyNames":["filter"]}'
for path in '' /toggles /modes /inputs /event-sources /inventory; do
  curl --fail-with-body -sS "$BASE/devices/$DEVICE_ID$path" \
    -H "Authorization: Bearer $REST_ACCESS_TOKEN"
done
curl --fail-with-body -sS -X DELETE "$BASE/devices/$DEVICE_ID/toggles/light" \
  -H "Authorization: Bearer $REST_ACCESS_TOKEN"

Whole-device deletion has no REST v2 endpoint; use the MCP deleteDevice tool or the web app’s confirmation flow. Both run the same cleanup service.

REST creation returns HTTP 201 with a Location header; device metadata updates and reads return 200; instance deletions return 204. MCP returns tool content instead of HTTP resource status codes. Failed calls have isError: true and an error message. Invalid/missing fields fail validation (REST 400); duplicate instance keys conflict (409); unknown or other-user devices are not found (404). Targeting a disallowed device produces access denied. An invalid/revoked MCP token is rejected at authentication (401).

A successful event-source REST response is the same JSON object directly, without the MCP content envelope:

{"deviceId":"DEVICE_ID","instanceId":"GENERATED_INSTANCE_ID","supportedEventId":"ButtonOn"}
Examples