{
  "name": "remote-agent-connector",
  "version": "0.1.0",
  "description": "Control plane: an MCP client drives machines (macOS/Windows/Linux/Android) through connectors that only dial out. No inbound ports on the target.",
  "mcp": {
    "url": "https://conn.mergio.app/mcp",
    "transport": "Streamable HTTP (stateless)",
    "auth": "Authorization: Bearer rac_…",
    "required_headers": [
      "Authorization",
      "User-Agent",
      "Content-Type: application/json",
      "Accept: application/json, text/event-stream"
    ],
    "tools": [
      "devices",
      "exec",
      "sysinfo",
      "screenshot",
      "file",
      "gui",
      "job",
      "clipboard",
      "task"
    ]
  },
  "how_to_use": [
    "1. Admin creates an API key: POST /admin/keys (ADMIN_TOKEN) → rac_…",
    "2. Install the connector on the target machine and register it: rac register --worker <base> --code <REGISTER_CODE>",
    "3. Start it: rac run   (it long-polls /device/poll, outbound only)",
    "4. Point an MCP client at /mcp with the rac_ key; call devices, then exec/screenshot/…"
  ],
  "endpoints": {
    "GET /": "this document",
    "POST /mcp": "MCP Streamable HTTP (API key)",
    "POST /device/register": "register a connector (X-Register-Code) → rad_ token, 7d TTL",
    "POST /device/renew": "rotate device token",
    "POST /device/poll": "long-poll for tasks (22s) → 204 when idle",
    "POST /device/complete": "report task result",
    "POST /device/blob?fmt=&width=&height=": "upload a screenshot to R2",
    "GET /device/me": "device token info",
    "GET /device/task/:id": "task state/result (API key or ADMIN_TOKEN)",
    "GET|POST /admin/keys": "list / create API keys",
    "POST /admin/keys/:id/rotate": "rotate key",
    "DELETE /admin/keys/:id": "revoke key",
    "GET /admin/devices": "devices + online status + capabilities",
    "POST /admin/devices/:id/revoke": "revoke a device",
    "GET /admin/audit?limit=&device_id=&ok=": "audit log",
    "GET /admin/tasks?limit=&state=&device_id=": "task queue",
    "GET /admin/screenshots?device_id=&limit=": "screenshot timeline",
    "GET /admin/screenshots/:id": "screenshot bytes (R2)",
    "GET /admin/stats": "24h rollup"
  },
  "security": "Keys and device tokens are stored as SHA-256 hashes only. Scope: readonly < noexec < all. Keys may be limited to specific device_ids. Every MCP call is audited."
}