Overview

The Node client is a CLI wrapper around MCP-over-WebSocket to VAGUS relay. It supports pair/connect, read/call/list operations, and long-running subscriptions with JSONL output.

Entry: scripts/vagus-connect.js

Session file: ~/.openclaw/vagus-session.json

Transport: wss://relay.withvagus.com/connect/<token>

Related: Server (Android App) for MCP surface and governance, Self-Hosted Relay for infrastructure setup.

Setup

cd ~/.openclaw/skills/vagus/scripts
npm install
node vagus-connect.js pair <PAIR_CODE>
node vagus-connect.js status

CLI Commands

node {baseDir}/scripts/vagus-connect.js <command> [args]
Command Args Description
pair<code>Pair and persist session token.
connectnoneConnect using saved session.
statusnoneGet connectivity and active modules.
read<uri>One-shot resource read.
subscribe<uri>Long-running stream of updates.
unsubscribe<uri>Stop a resource subscription.
call<tool> '<json>'Invoke a tool call.
list-resourcesnoneList available resource URIs.
list-toolsnoneList available tools + schemas.
disconnectnoneDelete local session file.

JSONL Contract

All outputs are line-delimited JSON objects.

{"type":"paired","session_token":"..."}
{"type":"capabilities","resources":["..."],"tools":["..."]}
{"type":"resource","uri":"vagus://device/screen","data":{"screen_on":true,"locked":false}}
{"type":"result","tool":"notify","success":true,"data":{"content":[{"type":"text","text":"{\"ok\":true}"}]}}

Request Metadata and Trace IDs

MCP response and notification envelopes include a top-level trace_id field when available. This identifier provides end-to-end correlation across request handling, outbound notifications, and server audit logs.

{
  "jsonrpc": "2.0",
  "id": 3,
  "trace_id": "43818824:tools/call:5545a8fa214dd67e:405164970b59034e",
  "result": {
    "content": [ { "type": "text", "text": "{\"ok\":true,\"id\":9098}" } ],
    "isError": false
  }
}
{
  "jsonrpc": "2.0",
  "method": "notifications/resources/updated",
  "trace_id": "43818824:resources/subscribe:5545a8fa214dd67e:aa3d70c94091b898",
  "params": {
    "sessionId": "5545a8fa214dd67e",
    "uri": "vagus://device/screen",
    "data": { "screen_on": true, "locked": false, "ts": 1772043993616 },
    "ts": 1772043993632
  }
}

The vagus-connect.js wrapper emits normalized JSONL and preserves MCP correlation context (including trace_id) in the mcp object for operational commands (read/call/list/subscribe/unsubscribe and streamed updates). If you need the full raw JSON-RPC envelope, capture raw MCP frames in custom integrations.

Resources

  • vagus://session/info
  • vagus://sensors/motion, activity, activity_recognition, location, environment
  • vagus://inference/attention, indoor_confidence, sleep_likelihood, notification_timing
  • vagus://device/connectivity, screen, battery, clipboard, notifications
  • vagus://io/type_* dynamic onboard sensor resources (device-specific)
node {baseDir}/scripts/vagus-connect.js read vagus://session/info
node {baseDir}/scripts/vagus-connect.js subscribe vagus://device/screen

Tools

  • notify, speak, haptic/pulse, haptic/pattern
  • clipboard/set, agent/set_name
  • sms/send, intent/open_url, calendar/create_event
node {baseDir}/scripts/vagus-connect.js call sms/send '{"to":"+14388090319","body":"Test message"}'
node {baseDir}/scripts/vagus-connect.js call intent/open_url '{"url":"https://withvagus.com"}'
node {baseDir}/scripts/vagus-connect.js call calendar/create_event '{"title":"dayclub","startTimeMs":1771772400000,"endTimeMs":1771776000000,"allDay":false}'

User Permissions (Server-Side)

Permissions are enforced in the VAGUS Android app. The Node client can issue MCP reads and tool calls, but execution is gated by user-configured capability toggles and runtime approval prompts.

Permission Layer Owner Node Client Impact
Module/capability enablementUser in VAGUS app settingsUnavailable capabilities fail at read/call time.
Runtime approval promptsUser on deviceSensitive tool calls may be approved, denied, or timeout.
Agent identity contextagent/set_name + app contextShown in approval/governance context.

Expected automation behavior: on permission denial/timeout, return a clear user action ("approve in VAGUS" or "enable permission"), then retry once.

Timeouts and Liveness

Setting Value
MCP request timeout22000ms
MCP initialize timeout20000ms
WS heartbeat interval30000ms
Pong timeout10000ms

Error Codes

Code Meaning
NO_COMMANDNo subcommand passed.
NO_SESSIONNo saved session file.
PAIR_FAILEDPairing API failed.
SESSION_EXPIREDToken rejected by relay.
CONNECT_FAILEDWSS connect/init failure.
BAD_JSONInvalid tool arg JSON.
READ_FAILEDResource read failed.
CALL_FAILEDTool invocation failed or timed out.
FATALUnhandled client error.