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. |
connect | none | Connect using saved session. |
status | none | Get 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-resources | none | List available resource URIs. |
list-tools | none | List available tools + schemas. |
disconnect | none | Delete 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/infovagus://sensors/motion,activity,activity_recognition,location,environmentvagus://inference/attention,indoor_confidence,sleep_likelihood,notification_timingvagus://device/connectivity,screen,battery,clipboard,notificationsvagus://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/patternclipboard/set,agent/set_namesms/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 enablement | User in VAGUS app settings | Unavailable capabilities fail at read/call time. |
| Runtime approval prompts | User on device | Sensitive tool calls may be approved, denied, or timeout. |
| Agent identity context | agent/set_name + app context | Shown 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 timeout | 22000ms |
| MCP initialize timeout | 20000ms |
| WS heartbeat interval | 30000ms |
| Pong timeout | 10000ms |
Error Codes
| Code | Meaning |
|---|---|
NO_COMMAND | No subcommand passed. |
NO_SESSION | No saved session file. |
PAIR_FAILED | Pairing API failed. |
SESSION_EXPIRED | Token rejected by relay. |
CONNECT_FAILED | WSS connect/init failure. |
BAD_JSON | Invalid tool arg JSON. |
READ_FAILED | Resource read failed. |
CALL_FAILED | Tool invocation failed or timed out. |
FATAL | Unhandled client error. |