- hub: FastAPI backend (MCP server, ADB LAN controller, bridge, storage) - hub/web: Vue 3 admin console (device manager, screen mirror, chat workbench) - android: Kotlin shell app with WebView stage, OTA, telemetry, keep-alive - protocol: architecture, MCP schema, and WebSocket protocol specs
4.3 KiB
4.3 KiB
PulseWall MCP & Event Bridge Specification (v1.0)
Endpoint:
- MCP Streamable HTTP:
POST/GET/DELETE /mcp - Event Stream (for dsh / custom upstream plugins):
GET /api/events/stream(SSE) &POST /api/webhooks - LAN-Only ADB Debug REST (mirrored to MCP when LAN-authorized):
/api/lan-debug/*
1. MCP Resources
| URI | Description |
|---|---|
pulsewall://devices |
List of all registered/online Android devices with basic status & capabilities |
pulsewall://device/{device_id}/profile |
Full DisplayProfile (CSS viewport w/h, DPR, safe area, orientation, webview_version), hardware telemetry, and local UI framework hints |
pulsewall://device/{device_id}/layout |
Current active HTML/Vue layout source, snapshot version, and recent render health |
pulsewall://events/pending |
Pending reverse events (user interaction replies & end-side AI data clarification questions) |
2. MCP Tools
2.1 Device Inspection
list_devices()- Returns connected/offline devices,
device_type(phone/tablet), capabilities (basic,root,accessibility,adb_lan), and last heartbeat.
- Returns connected/offline devices,
get_device_status(device_id: str)- Returns live telemetry (battery, current/voltage, CPU, RAM, thermal zones, screen on/off, Wi-Fi RSSI) + exact
DisplayProfile+webview_version+ UI framework constraints.
- Returns live telemetry (battery, current/voltage, CPU, RAM, thermal zones, screen on/off, Wi-Fi RSSI) + exact
2.2 Live Feed & Alerts (Unbreakable Native + WebView)
push_feed_item(device_id, title, body, level="info", source="ai", html_snippet=None, sound="ding", tags=[])- Appends an item to the device's live feed without replacing the whole page.
level:info|notice|warning|error|critical
trigger_alert(device_id, title, message, level="warning", presentation="modal", sound="warning", vibrate=True, wake_screen=False, tts_text=None, details_code=None, custom_html=None, interaction=None)- Triggers native alert overlay (independent of WebView health).
presentation:toast|modal|fullscreen_alarmsound:none|ding|warning|siren|ttsinteraction(optional Preset-First object):{ "interaction_id": "int_001", "mode": "ack_required | action_required", "presets": [ { "id": "ack", "label": "确认收到", "style": "primary" }, { "id": "restart", "label": "立即重启服务", "style": "danger" }, { "id": "snooze_1h", "label": "暂缓 1 小时", "style": "secondary" } ], "allow_custom_input": true, "custom_input_placeholder": "其他说明或指令..." }
dismiss_alert(device_id, alert_id=None)- Dismisses an active alert or all active alerts on the target device.
2.3 Dynamic UI Rendering & Snapshots
render_page(device_id, html, mode="full", title=None, data_context=None, wait_validation_sec=15)- Sends HTML/Vue/CSS/JS code to Android for pre-render validation, offscreen sandbox check, optional end-side Repair AI self-healing, and live mount.
mode:full(full canvas replacement) |widget(upsert named widget slot)- Returns:
status:rendered|rendered_after_local_fix|needs_clarification|failed_rolled_back|queued_offlinesnapshot_id,local_fixes_applied,clarification_questions(if end-side AI needs upstream data),console_errors.
rollback_page(device_id, snapshot_id=None)- Rolls the device back to the previous healthy snapshot or a specific
snapshot_id.
- Rolls the device back to the previous healthy snapshot or a specific
reply_clarification(task_id, answers, updated_html=None, updated_data=None)- Answers a data clarification question raised by the device's Repair AI (either during initial render or runtime console monitoring).
2.4 Bidirectional Event Polling (for pure MCP clients without SSE plugin)
get_pending_events(device_id=None, limit=20)- Returns unacknowledged reverse events:
user_interaction_replyandrepair_data_clarification.
- Returns unacknowledged reverse events:
ack_events(event_ids: list[str])- Marks events as processed by the upstream AI.
2.5 LAN-Only Developer Debug / ADB Control (Strictly LAN)
lan_adb_action(device_id, action, params={})- Only succeeds if request originates from a private LAN IP AND Hub global + device LAN debug flags are enabled.
- Supported
action:status,tap,swipe,text,keyevent,launch_app,screencap,screen_wake,screen_sleep,dumpsys_summary.