diff --git a/.gitignore b/.gitignore index 5096976..8a286ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ +.env +.direnv __pycache__/ *.pyc .ruff_cache/ .client_key.json .tv_state.json +*.jpg diff --git a/README.md b/README.md index 96a83c3..8c8854e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# webos-testing +# lg-smtv-mcp -Testing LG webOS local network control (SSDP discovery, SSAP WebSocket RPC, DIAL) from Linux/Python. +Model Context Protocol (MCP) server for local network control of LG Smart TVs (webOS) over SSAP WebSockets, Wake-on-LAN, and optional Developer Mode SSH screenshot capture. ## Setup @@ -10,11 +10,10 @@ nix develop Provisions Python 3.14, `websockets`, `ruff`, and `pyright` via [flake.nix](flake.nix). -## Scripts +## Historical PoC & Empirical Notes -- `discover.py` — SSDP multicast probe (`--all` to list DIAL/DLNA/SSAP services and MAC address). -- `tv_test.py` — One-shot SSAP pairing + command runner (`toast`, `info`, `apps`, `foreground`, `inputs`, `audio`, `launch`, `vol-up`, `vol-down`, `mute`, `raw`). +Initial feasibility probes and verified device findings (`65UR8750PSA` / `WebOS/4.1.0`) are archived in [`doc/poc/`](doc/poc/): -## Documentation - -- [docs/capabilities.md](docs/capabilities.md) — Verified SSAP/DIAL capabilities, deep-link contracts, and boundaries observed on `65UR8750PSA` (`WebOS/4.1.0`). +- [doc/poc/capabilities.md](doc/poc/capabilities.md) — Verified SSAP/DIAL endpoints, deep-link formats, `401` boundaries, and Developer Mode SSH screenshot pipeline. +- [doc/poc/discover.py](doc/poc/discover.py) — SSDP multicast probe (`--all` to list DIAL/DLNA/SSAP services and MAC address). +- [doc/poc/tv_test.py](doc/poc/tv_test.py) — One-shot SSAP pairing + command runner. diff --git a/docs/capabilities.md b/doc/poc/capabilities.md similarity index 82% rename from docs/capabilities.md rename to doc/poc/capabilities.md index 75af828..ef8b6a2 100644 --- a/docs/capabilities.md +++ b/doc/poc/capabilities.md @@ -28,9 +28,11 @@ Empirical notes from probing `192.168.1.11` (`Ethernet`, MAC `7c:64:6c:94:d1:24` - **Deep-linking quirks observed**: - **YouTube (`youtube.leanback.v4`)**: Expects `{"contentTarget": "v=&t=s"}` (full `https://...` URLs were ignored). If cold-started onto the profile picker, a second launch switches to the video. - **Netflix (`netflix`)**: Expects `{"contentTarget": "m=https://www.netflix.com/title/"}` (or `/watch/`). Without `m=`, Netflix hung on loading. Audio/subtitle track selection is not exposed via `params`. -- **Screen capture (local only)**: `ssap://com.webos.service.capture/executeOneShot` with `{"path": "/tmp/test.jpg", "method": "DISPLAY", "format": "JPG"}` succeeded (`960x540`, `12754` bytes), **but**: +- **Screen capture (via SSAP + Dev Mode SSH)**: `ssap://com.webos.service.capture/executeOneShot` with `{"path": "/tmp/test.jpg", "method": "DISPLAY", "format": "JPG"}` succeeded (`960x540`, `10410`–`12754` bytes): - Calling without `"path"` fails with `5 ERROR_NOT_ENOUGH_MEMORY`. - - `/tmp/test.jpg` is not served over `https://192.168.1.11:3001/tmp/...` (timed out); reading it off the TV requires **LG Developer Mode** SSH (port `9922`) or external HDMI capture. + - `/tmp/test.jpg` is not served over `https://192.168.1.11:3001/tmp/...` (timed out). + - **Verified workaround**: With **LG Developer Mode** + **Key Server** enabled (SSH on port `9922`, `ssh-rsa` host/pubkey algorithms enabled for the TV host), `scp webos-tv:/tmp/test.jpg .` transfers the `~10 KB` screenshot in `< 1s` (`1.1 MB/s`). + - Dev Mode shell environment observed: `uid=6739(prisoner) gid=5000(jailer)`, home `/media/developer`, `Linux LGwebOSTV 5.4.268-294.24.papikonda.2 #1 SMP PREEMPT ... aarch64 GNU/Linux` (`1222 MB` RAM). ### Blocked on Retail Firmware diff --git a/discover.py b/doc/poc/discover.py similarity index 100% rename from discover.py rename to doc/poc/discover.py diff --git a/tv_test.py b/doc/poc/tv_test.py similarity index 100% rename from tv_test.py rename to doc/poc/tv_test.py diff --git a/flake.nix b/flake.nix index d137db4..dda63e4 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "LG webOS local control testing environment"; + description = "LG Smart TV (webOS) MCP server and testing environment"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";