lgtv-control-mcp
An MCP server for controlling LG webOS TVs via SSAP protocol, enabling AI clients to adjust settings, switch inputs, launch apps, and more.
README
lgtv-control-mcp
An MCP (Model Context Protocol) server for controlling LG webOS TVs from AI clients like Claude, Codex, GitHub Copilot, and Antigravity.
Communication uses the webOS SSAP protocol over WebSocket, the same one used by the LG ThinQ app and projects like ColorControl.
Tools
set_backlight: backlight 0-100set_picture_setting/set_picture_mode/get_picture_settings: contrast, brightness, color, and picture modeset_volume/volume_up/volume_down/get_volume/set_mutelist_inputs/set_input: switch HDMI and other inputslist_apps/launch_app/close_app/get_foreground_appchannel_up/channel_down/set_channel/list_channels/get_current_channelmedia_play/media_pause/media_stop/media_rewind/media_fast_forwardpower_off/screen_off/screen_on/get_power_stateset_3d_on/set_3d_offshow_toast: display a notification on the TVsend_button: press a remote button. Compatible names include0-9,HOME,BACK,ENTER,EXIT,UP,DOWN,LEFT,RIGHT,RED,GREEN,YELLOW,BLUE,POWER,VOLUMEUP,VOLUMEDOWN,MUTE,MENU,CC,DASH,CHANNELUP,CHANNELDOWN,LIST,AD,SAP,PROGRAM,PLAY,PAUSE,STOP,REWIND,FASTFORWARD,GUIDE,AMAZON,NETFLIX,MAGNIFIER_ZOOM,LIVE_ZOOM,3D_MODE,ASPECT_RATIO,RECENT,RECORD,SCREEN_REMOTE,MYAPPSget_system_info/get_software_info/get_service_listssap_request: send any raw SSAP command (escape hatch)
Requirements
- Node.js 18+
- An LG webOS TV powered on and on the same local network
- The TV's IP address (Settings > Network)
- Mobile TV On enabled (Settings > Connection > External Devices > On via Wi-Fi)
Installation
Global install
npm install -g lgtv-control-mcp
This puts the lgtv-control-mcp binary in your PATH. Use command: "lgtv-control-mcp" with no args in your client config.
Via npx (no install)
npx -y lgtv-control-mcp@latest
This does not install the package. The MCP client runs this command each time it starts the server; npm caches the package after the first download.
From source
git clone https://github.com/brunofgmag/lgtv-control-mcp.git
cd lgtv-control-mcp
npm install
npm run build
node dist/index.js
Pairing
The first time you connect, the TV shows a "Connection Request" prompt on screen. Accept it with the remote.
The client key is saved automatically to ~/.lgtv-control-mcp/keys.json and reused on later connections. You don't need to configure it manually. If you want to pin a specific key, copy the value from that file into LGTV_CLIENT_KEY.
Client configuration
Set the TV's IP using the LGTV_HOST environment variable in your client config.
Claude Desktop
Open Settings → Developer → Edit Config. This opens claude_desktop_config.json directly in your editor. Add the entry and restart the app.
{
"mcpServers": {
"lgtv-control": {
"command": "npx",
"args": ["-y", "lgtv-control-mcp@latest"],
"env": { "LGTV_HOST": "192.168.1.50" }
}
}
}
If you installed globally, use "command": "lgtv-control-mcp" with "args": [].
Claude Code
The --scope user flag adds the server globally across all your projects:
claude mcp add lgtv-control --scope user --env LGTV_HOST=192.168.1.50 -- npx -y lgtv-control-mcp@latest
If you installed globally, replace npx -y lgtv-control-mcp@latest with just lgtv-control-mcp.
Or add it manually to ~/.claude/settings.json (user-level, global):
{
"mcpServers": {
"lgtv-control": {
"command": "npx",
"args": ["-y", "lgtv-control-mcp@latest"],
"env": { "LGTV_HOST": "192.168.1.50" }
}
}
}
Codex CLI
Via CLI:
codex mcp add lgtv-control --env LGTV_HOST=192.168.1.50 -- npx -y lgtv-control-mcp@latest
Or in ~/.codex/config.toml:
[mcp_servers."lgtv-control"]
command = "npx"
args = ["-y", "lgtv-control-mcp@latest"]
[mcp_servers."lgtv-control".env]
LGTV_HOST = "192.168.1.50"
GitHub Copilot / VS Code
In .vscode/mcp.json or your user MCP settings:
{
"servers": {
"lgtv-control": {
"type": "stdio",
"command": "npx",
"args": ["-y", "lgtv-control-mcp@latest"],
"env": { "LGTV_HOST": "192.168.1.50" }
}
}
}
For Copilot clients that expect the mcpServers format:
{
"mcpServers": {
"lgtv-control": {
"type": "local",
"command": "npx",
"args": ["-y", "lgtv-control-mcp@latest"],
"env": { "LGTV_HOST": "192.168.1.50" },
"tools": ["*"]
}
}
}
Antigravity
{
"mcpServers": {
"lgtv-control": {
"command": "npx",
"args": ["-y", "lgtv-control-mcp@latest"],
"env": { "LGTV_HOST": "192.168.1.50" }
}
}
}
Other MCP clients
Most clients that support local MCP via stdio use the same pattern:
{
"mcpServers": {
"lgtv-control": {
"command": "npx",
"args": ["-y", "lgtv-control-mcp@latest"],
"env": { "LGTV_HOST": "192.168.1.50" }
}
}
}
Environment variables
| Variable | Required | Default | Description |
|---|---|---|---|
LGTV_HOST |
yes | - | TV IP address on the local network |
LGTV_PORT |
no | 3001 |
3001 = wss (self-signed TLS); use 3000 for plain ws |
LGTV_CLIENT_KEY |
no | - | Pairing key; obtained and saved automatically on first use |
Usage examples
Once configured, try asking your AI:
- "Set the TV backlight to 30"
- "Turn up the volume" / "Switch to HDMI 2"
- "Open Netflix" / "Turn off the TV screen"
- "Show a 'Dinner's ready' notification on the TV"
Troubleshooting
- "pairing timed out": accept the connection prompt on the TV screen and try again.
- "could not connect": check the IP, that the TV is on and on the same network. Try
LGTV_PORT=3000. - Backlight not changing: some firmware versions require the luna path. The server already tries SSAP first and falls back automatically. Also check that your current picture mode allows manual backlight adjustment.
- Re-pairing: delete the TV's entry in
~/.lgtv-control-mcp/keys.jsonto force a new pairing prompt.
How it works
The server opens an SSAP WebSocket with the TV, performs the registration handshake (with pairingType: PROMPT), and sends ssap://... requests. Remote control buttons use a separate pointer socket (getPointerInputSocket). Picture adjustments use setSystemSettings; when the direct SSAP path is rejected by the firmware, the server uses the luna trick (creating and closing an alert whose onclose points to luna://com.webos.settingsservice/setSystemSettings).
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。