# remote-console-mcp

MCP server for [Remote Console](https://github.com/shinjiyu/remote-console).

It connects to a Remote Console WebSocket endpoint, authenticates with an API
token, and exposes tools that let Cursor inspect remote device sessions, read
logs, and execute JavaScript on connected WebViews.

## Install

```bash
npm install -g remote-console-mcp
```

Or run it without a global install:

```bash
npx -y remote-console-mcp
```

## Required environment variables

- `RC_SERVER_URL`: Remote Console WebSocket endpoint, for example
  `wss://your-domain.com/remote-console/ws`
- `RC_API_TOKEN`: API token created in the Remote Console Web UI (`Tokens` page)

Optional:

- `RC_DEVICE_ID`: only show sessions from a specific device ID

If `RC_SERVER_URL` is omitted, the package falls back to
`ws://127.0.0.1:3000/ws` for local development.

## Cursor configuration

Add this to your MCP config:

```jsonc
{
  "mcpServers": {
    "remote-console": {
      "command": "npx",
      "args": ["-y", "remote-console-mcp"],
      "env": {
        "RC_SERVER_URL": "wss://your-domain.com/remote-console/ws",
        "RC_API_TOKEN": "rct_<paste-token-here>"
      }
    }
  }
}
```

## Exposed tools

- `list_sessions`
- `get_logs`
- `get_session_info`
- `execute_js`

## Authentication

This package authenticates as a non-browser client using `RC_API_TOKEN`.

- Missing token: the Remote Console server will reject the connection
- Revoked token: the MCP server stops reconnecting and prints a clear error
- Human login credentials are **not** used here; they are only for the Web UI

## Publish

From `mcp-server/`:

```bash
npm publish
```

The package uses:

- `prepublishOnly` -> `npm run build`
- `bin.remote-console-mcp` -> `dist/index.js`
- `publishConfig.access=public`

## Local development

```bash
npm install
npm run build
npx remote-console-mcp
```
