# Server Mode

MobileCLI can run as a server, exposing all device operations via JSON-RPC over HTTP and WebSocket. This is how Mobile MCP integrates with it.

The full JSON-RPC API specification is available at [mobile-next/mobile-openrpc](https://github.com/mobile-next/mobile-openrpc/tree/main/mobilecli).

## Start the server[​](#start-the-server "Direct link to Start the server")

```
mobilecli server start --listen localhost:12000 --cors
```

## HTTP POST (JSON-RPC)[​](#http-post-json-rpc "Direct link to HTTP POST (JSON-RPC)")

Send JSON-RPC requests to the server:

```
curl -X POST http://localhost:12000/jsonrpc \

  -H "Content-Type: application/json" \

  -d '{"jsonrpc":"2.0","method":"devices.list","id":1}'
```

## WebSocket (JSON-RPC)[​](#websocket-json-rpc "Direct link to WebSocket (JSON-RPC)")

Connect via WebSocket for real-time interactions and streaming:

```
ws://localhost:12000/ws
```

## Use cases[​](#use-cases "Direct link to Use cases")

| Interface | Best for                                                 |
| --------- | -------------------------------------------------------- |
| CLI       | Scripts, CI/CD, one-off commands                         |
| HTTP POST | Request/response workflows, simple automation            |
| WebSocket | Real-time control, screen streaming, long-lived sessions |
