Skip to main content
Glama

πŸ“Ί TV Remote MCP

License: MIT Python: 3.8+ Protocol: FastMCP Platforms: 10+ Brands Zero Cloud

Universal Smart TV Web Remote + Model Context Protocol (MCP) Server for AI Assistants.

Control any smart TV on your local network β€” from your phone's browser or using natural language with AI coding assistants (Claude, Hermes, Antigravity, Cursor, ChatGPT, Codex). Zero app stores, zero accounts, zero cloud dependencies. Works completely over local Wi-Fi.


πŸ€– For AI Assistants & Crawlers (1-Prompt Automated Setup)

IMPORTANT

If you are an AI assistant (Claude Code, Hermes, Antigravity, Cursor, Codex) given the prompt:
"""Install this https://github.com/Shival-Gupta/tv-remote-mcp"""

Run this single command:

python install.py

(On Linux/macOS, you can also run ./install.sh)

What python install.py does automatically:

  1. Installs Dependencies: Installs requirements.txt (pywebostv, requests, websockets, fastmcp).

  2. Registers MCP Server: Automatically detects and writes configuration for:

    • Claude Desktop (%APPDATA%\Claude\claude_desktop_config.json on Windows, ~/Library/Application Support/Claude/ on macOS, ~/.config/Claude/ on Linux).

    • Cursor (.cursor/mcp.json).

  3. Installs Agent Skills: Automatically registers smart-tv-control in:

    • Project .agents/skills/smart-tv-control/ (for Antigravity / Hermes)

    • Project .claude/skills/smart-tv-control/ (for Claude Code)

    • Machine global skills: ~/.gemini/config/skills/ and ~/.claude/skills/

  4. Runs Self-Verification: Executes tests/test_mcp_server.py to verify that all 7 MCP server endpoints pass.

  5. Discovers Local TVs: Performs an initial Wi-Fi subnet probe and reports any reachable smart TVs.

AI Control Reference

  • Agent Skill Instructions: Read skills/smart-tv-control/SKILL.md

  • Claude Instructions: Read CLAUDE.md

  • Developer Guidelines: Read AGENTS.md

  • MCP Tools:

    • universal_action(host, brand, action, arg): Executes TV actions (power_on, power_off, volume_up, volume_down, mute, volume_set, up, down, left, right, enter, back, home, media_play, media_pause, launch_app, set_input).

    • discover(network): Scans local subnet for active smart TVs.

    • list_brands(): Returns list of supported smart TV brands.

  • Direct CLI Execution (Zero Background Daemon Required):

    python skills/smart-tv-control/scripts/tv_cli.py discover
    python skills/smart-tv-control/scripts/tv_cli.py power_on <ip>
    python skills/smart-tv-control/scripts/tv_cli.py action <ip> <brand> volume_up
    python skills/smart-tv-control/scripts/tv_cli.py launch <ip> <brand> youtube

Related MCP server: MCP Roku Control

πŸ‘€ For Humans: Quick Start Guide

You can use TV Remote MCP in two ways: as a phone web remote or as an AI assistant integration.

Option A: Use the Phone Web Remote (Zero Install for Roku)

  1. Open projects.shivalgupta.me/tv-remote-mcp/remote/ on your phone (connected to your home Wi-Fi).

  2. For Roku TVs, enter your TV's IP address and select Roku β€” it works directly from the browser!

  3. For LG, Samsung, Android TV, Sony, or Vizio, start the lightweight companion relay on your computer:

    git clone https://github.com/Shival-Gupta/tv-remote-mcp.git
    cd tv-remote-mcp
    python install.py
    python server/relay.py
  4. On your phone, the remote will auto-detect the relay server or let you enter your computer's IP (e.g. http://192.168.1.12:7070/remote/).

Option B: Use with AI Assistants (Claude, Cursor, Gemini)

  1. Clone this repository:

    git clone https://github.com/Shival-Gupta/tv-remote-mcp.git
    cd tv-remote-mcp
  2. Run the automated installer:

    python install.py
  3. Restart Claude Desktop or Cursor. Your AI assistant can now control your TV natively!

    • "Turn down the TV volume by 5 steps"

    • "Switch TV to HDMI 2"

    • "Turn off the TV when this build completes"


πŸ“Ί Supported Brands & Protocols

Brand

Protocol

Default Port(s)

Pairing Method

Wake-on-LAN (Power On)

LG WebOS (3.0+)

WebSocket (wss:// / ws://)

3001 (SSL) / 3000

Click "Yes" on TV screen

βœ… Supported

Samsung Tizen

HTTP REST + WebSocket

8001 / 8002

Accept on-screen popup

βœ… Supported

Roku TV

HTTP ECP

8060

Zero pairing required

βœ… Supported

Android TV / Google TV

ADB

5555

Allow Network Debugging prompt

βœ… Supported

Fire TV

ADB

5555

Allow Network Debugging prompt

βœ… Supported

Sony Bravia

HTTP REST / IRCC-over-HTTP

80

Pre-Shared Key (PSK) or PIN

βœ… Supported

Vizio SmartCast

HTTPS REST

7345 / 9000

On-screen PIN pair

βœ… Supported

Philips (JointSpace)

HTTP REST

1925 / 1926

Digest Auth / PIN

βœ… Supported

Panasonic Viera

HTTP SOAP

55000

None / PIN

βœ… Supported

TCL / Hisense

ADB / Roku ECP

5555 / 8060

Depends on OS

βœ… Supported


⚑ How It Works

πŸ“± Phone Web Remote ─────HTTP────▢ πŸ–₯️ Local Relay (relay.py) ────Socket────▢ πŸ“Ί Smart TV
                                       Port 7070                               (on LAN)

πŸ€– AI Assistant (Claude/MCP) ───▢ πŸ–₯️ MCP Server (mcp-server.py) ──Direct────▢ πŸ“Ί Smart TV
                                       Port 8000
  1. Browser Remote UI: Built with vanilla HTML5, CSS (Tailwind CDN), and JavaScript (<200KB total, zero build step, PWA-enabled with offline caching).

  2. Local Relay (server/relay.py): Runs on port 7070. Bridges the browser to smart TVs over raw TCP/WebSocket ports that web browsers block due to CORS and mixed-content security policies.

  3. MCP Server (server/mcp-server.py): Runs on port 8000. Exposes FastMCP tools and an HTTP JSON-RPC bridge (/rpc) for AI assistants to control TVs programmatically.

  4. Smart Power & Wake-on-LAN (WoL): When TVs are turned off, their network ports close. TV Remote MCP uses a 5-packet UDP magic packet burst (broadcast + subnet + unicast) to wake the TV up. The smart power button in the remote automatically turns ON when the TV is asleep and OFF when the TV is active.


πŸ“‚ Project Structure

tv-remote-mcp/
β”œβ”€β”€ install.py              # Unified cross-platform installer (dependencies + MCP + skills + tests)
β”œβ”€β”€ install.sh              # Unix/macOS one-click installer wrapper
β”œβ”€β”€ requirements.txt        # Python package dependencies
β”œβ”€β”€ CLAUDE.md               # Claude Code & Hermes agent instructions
β”œβ”€β”€ AGENTS.md               # Antigravity & AI pair programmer instructions
β”œβ”€β”€ index.html              # Landing page (GitHub Pages root)
β”œβ”€β”€ manifest.json           # PWA web manifest
β”œβ”€β”€ sw.js                   # Service Worker (offline shell cache)
β”œβ”€β”€ remote/
β”‚   └── index.html          # Universal Smart TV Remote Control web application
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ relay.py            # Local relay server (browser β†’ TV bridge, port 7070)
β”‚   └── mcp-server.py       # FastMCP server & HTTP RPC bridge (port 8000)
β”œβ”€β”€ skills/
β”‚   └── smart-tv-control/   # AI Agent Skill package
β”‚       β”œβ”€β”€ SKILL.md        # Instructions, MCP signatures, natural language scenarios
β”‚       β”œβ”€β”€ scripts/
β”‚       β”‚   └── tv_cli.py   # Standalone CLI helper (discover, action, power_on, launch)
β”‚       └── references/
β”‚           β”œβ”€β”€ brand-protocols.md  # Detailed brand network port & auth specifications
β”‚           └── app-ids.md          # Popular streaming app IDs & HDMI input mappings
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_mcp_server.py  # 7-step automated MCP server test suite
β”‚   └── test_lg_tv.py       # 9-step physical hardware validation suite
β”œβ”€β”€ docs/                   # Detailed guides (setup, pairing, brands, troubleshooting, AI)
└── assets/                 # Shared icons, CSS, and styling

πŸ”’ Privacy & Security

  • 100% Local: All commands travel strictly across your local home Wi-Fi network. No telemetry, no external API calls, and no cloud relay servers.

  • Credentials & Tokens: Pairing keys and tokens are stored exclusively in tv-tokens/tokens.json on your local PC.

  • Git Protection: tv-tokens/, *.token, *.key, and .env files are strictly gitignored to prevent accidental credential leakage.


πŸ§ͺ Testing & Validation

TV Remote MCP includes automated test suites to ensure reliable performance across hardware and MCP bridges:

# Test MCP Server (7/7 tests PASS)
python tests/test_mcp_server.py

# Test Physical Hardware (e.g. LG WebOS TV at 192.168.1.11)
python tests/test_lg_tv.py

❓ Frequently Asked Questions (FAQ)


🀝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details on code standards, atomic commits, and testing.

πŸ“„ License

This project is open source and licensed under the MIT License.

Related MCP Connectors

Related MCP Servers