Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b2738c0d48 | ||
|
|
ea0c1d9774 | ||
|
|
4af32b993d |
No files matched your search
@@ -140,12 +140,14 @@ MAX_VOLUME=40
|
|||||||
|
|
||||||
## Running the MVP Server (`pair` & `serve`)
|
## Running the MVP Server (`pair` & `serve`)
|
||||||
|
|
||||||
|
> **Note:** Inside `nix develop`, run commands using `python -m lg_smtv_mcp <subcommand>` (or `nix run . -- <subcommand>`), as the devShell provisions the Python environment directly rather than installing package console scripts to `PATH`.
|
||||||
|
|
||||||
1. **Pair with the TV (one-time per TV):** Ensure the TV is powered on with *LG Connect Apps* enabled, then run:
|
1. **Pair with the TV (one-time per TV):** Ensure the TV is powered on with *LG Connect Apps* enabled, then run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
lg-smtv-mcp pair
|
python -m lg_smtv_mcp pair
|
||||||
# Optional: override IP or also fetch Developer Mode SSH key
|
# Optional: override IP or also fetch Developer Mode SSH key
|
||||||
lg-smtv-mcp pair --ip <TV_IP>
|
python -m lg_smtv_mcp pair --ip <TV_IP>
|
||||||
```
|
```
|
||||||
|
|
||||||
Accept the pairing prompt on the TV screen. The client key is saved atomically with `0600` permissions to `CLIENT_KEY_PATH` (default `.client_key.json`).
|
Accept the pairing prompt on the TV screen. The client key is saved atomically with `0600` permissions to `CLIENT_KEY_PATH` (default `.client_key.json`).
|
||||||
@@ -155,10 +157,10 @@ MAX_VOLUME=40
|
|||||||
```bash
|
```bash
|
||||||
# Default: persistent Streamable HTTP daemon at http://<HOST>:<PORT>/mcp
|
# Default: persistent Streamable HTTP daemon at http://<HOST>:<PORT>/mcp
|
||||||
# Requires Authorization: Bearer <MCP_BEARER_TOKEN>
|
# Requires Authorization: Bearer <MCP_BEARER_TOKEN>
|
||||||
lg-smtv-mcp serve
|
python -m lg_smtv_mcp serve
|
||||||
|
|
||||||
# Local testing over stdio (no HTTP Bearer token required)
|
# Local testing over stdio (no HTTP Bearer token required)
|
||||||
lg-smtv-mcp serve --transport stdio
|
python -m lg_smtv_mcp serve --transport stdio
|
||||||
```
|
```
|
||||||
|
|
||||||
If you re-pair while `serve` is running, send `SIGHUP` to reload `.client_key.json` without restarting the daemon.
|
If you re-pair while `serve` is running, send `SIGHUP` to reload `.client_key.json` without restarting the daemon.
|
||||||
@@ -203,9 +205,9 @@ On a trusted home LAN, SSH host-key checking is disabled by default because the
|
|||||||
|
|
||||||
## Operator Live-TV E2E Smoke Test Checklist
|
## Operator Live-TV E2E Smoke Test Checklist
|
||||||
|
|
||||||
Automated tests run strictly offline. After deploying or updating on a host on the same LAN as the TV, run this manual smoke checklist from an MCP client connected to `lg-smtv-mcp serve`:
|
Automated tests run strictly offline. After deploying or updating on a host on the same LAN as the TV, run this manual smoke checklist from an MCP client connected to `python -m lg_smtv_mcp serve`:
|
||||||
|
|
||||||
- [ ] **`pair`**: Run `lg-smtv-mcp pair`, accept the on-screen TV prompt, and confirm `CLIENT_KEY_PATH` (`.client_key.json`) exists with `0600` permissions and an entry for `<TV_IP>`.
|
- [ ] **`pair`**: Run `python -m lg_smtv_mcp pair`, accept the on-screen TV prompt, and confirm `CLIENT_KEY_PATH` (`.client_key.json`) exists with `0600` permissions and an entry for `<TV_IP>`.
|
||||||
- [ ] **`tv_wake`**: With the TV in standby, verify a mutating tool (`launch`) fails fast with `TV_OFFLINE_STANDBY` (no implicit WoL), then call `tv_wake` and confirm the TV powers on and returns `status: "connected"`.
|
- [ ] **`tv_wake`**: With the TV in standby, verify a mutating tool (`launch`) fails fast with `TV_OFFLINE_STANDBY` (no implicit WoL), then call `tv_wake` and confirm the TV powers on and returns `status: "connected"`.
|
||||||
- [ ] **`get_state`**: Call `get_state` and confirm `connected: true`, `stale: false`, and live `volume`, `muted`, `sound_output`, and `foreground_app` values.
|
- [ ] **`get_state`**: Call `get_state` and confirm `connected: true`, `stale: false`, and live `volume`, `muted`, `sound_output`, and `foreground_app` values.
|
||||||
- [ ] **`launch`**: Call `launch` (e.g., `app_id="youtube.leanback.v4"` with an optional `content_target`) and confirm the app opens on screen.
|
- [ ] **`launch`**: Call `launch` (e.g., `app_id="youtube.leanback.v4"` with an optional `content_target`) and confirm the app opens on screen.
|
||||||
|
|||||||
+5
-5
@@ -2,12 +2,11 @@
|
|||||||
|
|
||||||
## Current Direction
|
## Current Direction
|
||||||
|
|
||||||
`lg-smtv-mcp` has completed its M1 MVP control plane (persistent SSAP, pointer input, WoL recovery, FastMCP tools, Bearer auth, `pair`/`serve` CLI, and full-stack offline E2E verification) and the M2 capture and E2E-hardening slices. Remaining M2 work is deployment packaging and its `systemd` hardening follow-up.
|
`lg-smtv-mcp` has completed Milestone M2 (capture, E2E hardening, and systemd deployment packaging). Active work is the `systemd` unit sandboxing hardening follow-up ([#17](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/issues/17), Backlog) and the live-TV operator smoke verification.
|
||||||
|
|
||||||
## Near Term (Milestone M2)
|
## Near Term
|
||||||
|
|
||||||
- **Systemd Unit & Deployment Docs ([#13](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/issues/13)):** Add `deploy/lg-smtv-mcp.service` template and document systemd + Developer Mode SSH setup in `README.md`.
|
- **Systemd Unit Sandboxing Hardening ([#17](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/issues/17)):** Tighten the `deploy/lg-smtv-mcp.service` sandbox directives (`PrivateTmp`, `ProtectSystem`, capability drops, etc.) as a post-M2 hardening pass.
|
||||||
- **Systemd Unit Sandboxing Hardening ([#17](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/issues/17)):** Follow-up to `#13`, tightening the unit's sandboxing directives once the baseline deployment template lands.
|
|
||||||
|
|
||||||
## Medium Term
|
## Medium Term
|
||||||
|
|
||||||
@@ -15,9 +14,10 @@
|
|||||||
|
|
||||||
## Completed
|
## Completed
|
||||||
|
|
||||||
### M2: Capture & E2E Hardening (partial, 2026-11-16)
|
### M2: Capture, E2E Hardening & Systemd Deployment (Completed 2026-11-17)
|
||||||
- **#11 (PR [#14](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/14)):** E2E harness hardening in [`tests/test_e2e_mvp.py`](tests/test_e2e_mvp.py) — fast-fail ASGI lifespan startup, `elapsed_ms` contract check, and post-`turn_off()` `1008` -> `get_state` stale parity.
|
- **#11 (PR [#14](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/14)):** E2E harness hardening in [`tests/test_e2e_mvp.py`](tests/test_e2e_mvp.py) — fast-fail ASGI lifespan startup, `elapsed_ms` contract check, and post-`turn_off()` `1008` -> `get_state` stale parity.
|
||||||
- **#12 (PR [#15](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/15)):** `tv_core/capture.py` (`CaptureClient` + `AsyncSshCaptureTransport`), default `server.py` wiring, and offline capture contract tests; review remediation CR-01..CR-11 landed in `61d2315`.
|
- **#12 (PR [#15](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/15)):** `tv_core/capture.py` (`CaptureClient` + `AsyncSshCaptureTransport`), default `server.py` wiring, and offline capture contract tests; review remediation CR-01..CR-11 landed in `61d2315`.
|
||||||
|
- **#13 (PR [#16](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/16)):** `deploy/lg-smtv-mcp.service` systemd template, deployment + Developer Mode SSH setup docs in `README.md`, and DNS-rebinding / PATH env guidance.
|
||||||
|
|
||||||
### M1: MVP Core & End-to-End Verification (Completed 2026-11-16)
|
### M1: MVP Core & End-to-End Verification (Completed 2026-11-16)
|
||||||
- **#1 (PR [#6](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/6)):** Nix flake packaging, `pyproject.toml`, Pydantic v2 `TvConfig`, and `ConfigError` / `TvError` taxonomy.
|
- **#1 (PR [#6](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/6)):** Nix flake packaging, `pyproject.toml`, Pydantic v2 `TvConfig`, and `ConfigError` / `TvError` taxonomy.
|
||||||
|
|||||||
+10
-16
@@ -3,7 +3,7 @@
|
|||||||
* **Author:** kiskaadee
|
* **Author:** kiskaadee
|
||||||
* **Status:** Approved
|
* **Status:** Approved
|
||||||
* **Date:** 2026-11-15
|
* **Date:** 2026-11-15
|
||||||
* **Last reconciled:** 2026-11-16 (M2 `#12` / PR [#15](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/15) merged)
|
* **Last reconciled:** 2026-11-17 (M2 fully delivered: `#13` / PR [#16](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/16) merged; Milestone M2 closed)
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ All tools return structured JSON payloads (plus inline MCP `ImageContent` when `
|
|||||||
|
|
||||||
## Detailed Implementation Plan
|
## Detailed Implementation Plan
|
||||||
|
|
||||||
Milestone M1 foundations (`#1`–`#4`) and the M2 capture/E2E slices (`#11`, `#12`) are implemented, verified, and merged on `main`. The completed baselines are summarized for reference below; the active plan specifies the remaining Milestone M2 deployment slice (`#13`).
|
Milestone M1 foundations (`#1`–`#4`) and all Milestone M2 slices (`#11`, `#12`, `#13`) are implemented, verified, and merged on `main`. The completed baselines are summarized for reference below. Follow-up `systemd` unit sandboxing hardening is tracked separately in [#17](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/issues/17).
|
||||||
|
|
||||||
### Completed Milestone M1 Baseline (`#1`–`#4`, Merged on `main`)
|
### Completed Milestone M1 Baseline (`#1`–`#4`, Merged on `main`)
|
||||||
|
|
||||||
@@ -278,7 +278,7 @@ Milestone M1 foundations (`#1`–`#4`) and the M2 capture/E2E slices (`#11`, `#1
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Completed Milestone M2 Slices (`#11`, `#12` — Merged on `main`)
|
### Completed Milestone M2 Slices (`#11`, `#12`, `#13` — Merged on `main`)
|
||||||
|
|
||||||
Delivered by `#12` (PR [#15](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/15)) and `#11` (PR [#14](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/14)). The contracts below match `main` as merged, including the PR `#15` review remediation (CR-01..CR-11).
|
Delivered by `#12` (PR [#15](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/15)) and `#11` (PR [#14](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/14)). The contracts below match `main` as merged, including the PR `#15` review remediation (CR-01..CR-11).
|
||||||
|
|
||||||
@@ -328,21 +328,15 @@ Delivered by `#12` (PR [#15](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/p
|
|||||||
* Asserted `isinstance(wake_payload["elapsed_ms"], int) and wake_payload["elapsed_ms"] >= 0` on `tv_wake`.
|
* Asserted `isinstance(wake_payload["elapsed_ms"], int) and wake_payload["elapsed_ms"] >= 0` on `tv_wake`.
|
||||||
* After `turn_off()`, simulated the TV closing the SSAP WebSocket with `1008` and re-queried `get_state` to verify `connected: false, stale: true` with cached state retained.
|
* After `turn_off()`, simulated the TV closing the SSAP WebSocket with `1008` and re-queried `get_state` to verify `connected: false, stale: true` with cached state retained.
|
||||||
|
|
||||||
* **M2 Delivery Checkpoint:** `nix develop --command bash -c "ruff check . && ruff format --check . && pyright && pytest"` and `nix flake check` passed for `#11` and `#12`.
|
#### 5. `deploy/lg-smtv-mcp.service` and `README.md` (Completed — Issue `#13`, PR [#16](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/pulls/16))
|
||||||
|
|
||||||
---
|
* **Type / Scope:** Systemd unit template and operator deployment documentation.
|
||||||
|
* **Delivered Changes:**
|
||||||
|
* Created `deploy/lg-smtv-mcp.service` template invoking `nix develop --command python -m lg_smtv_mcp serve` with `<User>`, `<WorkingDirectory>`, `EnvironmentFile`, `Restart=on-failure`, and `PATH` containing `<NixBinDir>`.
|
||||||
|
* Updated `README.md` with `systemd` setup instructions, Developer Mode pairing workflow (`python -m lg_smtv_mcp pair --fetch-ssh-key`), DNS-rebinding host configuration (`HOST` + `ALLOWED_HOSTS`), and live-TV operator smoke checklist items.
|
||||||
|
* Follow-up unit sandboxing hardening is tracked separately in issue [#17](https://gitea.roadtotech.me/kiskaadee/lg-smtv-mcp/issues/17).
|
||||||
|
|
||||||
### Active Milestone M2 Plan: Systemd Deployment (`#13`)
|
* **M2 Delivery Checkpoint:** All checks (`ruff`, `pyright`, `pytest`, `nix flake check`) passed; PR #16 merged on `main`.
|
||||||
|
|
||||||
#### 1. `deploy/lg-smtv-mcp.service` and `README.md` (Create / Modify — Issue `#13`)
|
|
||||||
|
|
||||||
* **Type / Scope:** Systemd unit template and operator documentation.
|
|
||||||
* **Proposed Changes:**
|
|
||||||
* Create `deploy/lg-smtv-mcp.service` with `<User>`, `<WorkingDirectory>`, `EnvironmentFile`, `After=network-online.target`, `Wants=network-online.target`, and `Restart=on-failure`, invoking `nix develop --command python -m lg_smtv_mcp serve`.
|
|
||||||
* Update `README.md` with `systemd` deployment steps (including ensuring `nix` is on `systemd`'s `PATH`), Developer Mode SSH setup (`pair --fetch-ssh-key`, `:9922` session timer behavior, `SSH_KNOWN_HOSTS_PATH`), and a live-TV `screenshot` / `keys(..., capture=True)` smoke checklist item.
|
|
||||||
* A follow-up issue (`#17`) tracks tightening the unit's sandboxing directives after this baseline template lands.
|
|
||||||
|
|
||||||
* **M2 Completion Checkpoint:** `nix develop --command bash -c "ruff check . && ruff format --check . && pyright && pytest"` and `nix flake check`.
|
|
||||||
|
|
||||||
### Verification Plan
|
### Verification Plan
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user