adb-tv-mcp

adb-tv-mcp

Enables AI agents to control Android TV/Android devices through ADB, including screen capture, remote control, app management, and more.

Category
访问服务器

README

adb-tv-mcp

An MCP server that lets an AI agent control an Android TV or Android device through ADB.

Overview

adb-tv-mcp is a local server for the Model Context Protocol. The server gives an AI agent a set of tools. The agent uses the tools to control an Android device. The device must be reachable through the Android Debug Bridge (ADB).

The agent can do these tasks:

  • Capture the screen as an image.
  • Send remote-control and D-pad key presses.
  • Start, install, and remove applications.
  • Open a web address.
  • Type text and touch the screen.
  • Transfer files.
  • Read device properties, settings, and logs.
  • Run shell commands.
  • Pair with a device that uses Android 11 wireless debugging.

The server sends each request to the adb program. The server does not modify the device firmware.

Demo

Figure 1 shows a status display that the server sent to a TCL C6K television with the adb_open_url tool. The page runs in the television browser.

A status display shown on a TCL C6K television

Features

  • Screen capture. The adb_screenshot tool returns the screen as a PNG image. Vision-capable agents can see the screen and then act.
  • Remote control. The tools send D-pad keys, media keys, and system keys, and also touch and text input.
  • Application control. The tools start, list, install, and remove applications, and open web addresses.
  • Wireless pairing. The adb_pair tool completes the Android 11 pairing sequence.
  • File transfer. The tools copy files to and from the device.
  • Diagnostics. The tools read properties, settings, and logs, and record the screen.

Requirements

  • Node.js version 18 or later.
  • The Android platform-tools package. This package supplies the adb program.
  • An Android device with developer options and debugging turned on.

Installation

  1. Clone the repository:

    git clone https://github.com/mosesmrima/adb-tv-mcp.git
    cd adb-tv-mcp
    
  2. Install the dependencies:

    npm install
    
  3. Build the project:

    npm run build
    

Configuration

Add the server to the configuration file of your MCP client.

To use the published package, run it with npx. You do not need to clone the repository.

{
  "mcpServers": {
    "adb-tv": {
      "command": "npx",
      "args": ["-y", "adb-tv-mcp"],
      "env": { "ADB_PATH": "/path/to/platform-tools/adb" }
    }
  }
}

To use a local build instead, set the command to node and give the absolute path to the built file:

{
  "mcpServers": {
    "adb-tv": {
      "command": "node",
      "args": ["/absolute/path/to/adb-tv-mcp/dist/index.js"],
      "env": { "ADB_PATH": "/path/to/platform-tools/adb" }
    }
  }
}

Set the ADB_PATH variable only if the adb program is not on the PATH of the client process. Restart the client after you change the configuration.

Connect to a device

Android 11 or later (wireless debugging)

  1. On the device, open Developer options.
  2. Select Wireless debugging.
  3. Select Pair device with pairing code. The device shows a 6-digit code and an address in the form host:port.
  4. Tell the agent to run adb_pair with the host, the port, and the code.
  5. Tell the agent to run adb_connect with the host and the connect port. The device shows the connect port on the main Wireless debugging screen.

Note: The pairing port and the connect port are different. The command adb mdns services also finds these endpoints.

USB or earlier Android

  1. Turn on network ADB on the device.
  2. Tell the agent to run adb_connect with the device address and port 5555.

Tools

Tool Description
adb_devices Lists the connected devices and their state.
adb_pair Pairs with a device that uses Android 11 wireless debugging.
adb_connect Connects to a device endpoint.
adb_disconnect Disconnects a device, or all devices.
adb_screenshot Captures the screen and returns a PNG image.
adb_screenrecord Records the screen and saves the video to a local file.
adb_key Sends a remote-control or D-pad key.
adb_tap Touches the screen at a pixel position.
adb_swipe Swipes from one position to another.
adb_text Types text into the active field.
adb_launch Starts an application by package name.
adb_open_url Opens a web address on the device.
adb_start_intent Sends an Android intent with am start.
adb_list_apps Lists installed packages.
adb_current_app Reports the application in the foreground.
adb_install Installs an APK file.
adb_uninstall Removes an application.
adb_push Copies a file to the device.
adb_pull Copies a file from the device.
adb_getprop Reads device properties.
adb_settings Reads or writes an Android setting.
adb_logcat Reads recent log lines.
adb_reboot Restarts the device.
adb_shell Runs a shell command.

For the adb_key tool, use one of these key names, or a numeric Android key code: UP, DOWN, LEFT, RIGHT, ENTER, BACK, HOME, MENU, POWER, VOLUME_UP, VOLUME_DOWN, MUTE, PLAY_PAUSE, NEXT, PREV, FAST_FORWARD, REWIND, SEARCH, ASSIST, SETTINGS, APP_SWITCH, CHANNEL_UP, CHANNEL_DOWN.

Environment variables

Variable Description
ADB_PATH The path to the adb program. The default value is adb on the PATH.

Security

Read this section before you use the server.

  • The server controls real hardware.
  • The adb_shell tool runs any shell command. The adb_reboot and adb_uninstall tools also make changes to the device.
  • Use the server only with devices that you own or that you have permission to control.
  • Do not connect the server to devices on a network that you do not trust.
  • Give the agent only the autonomy that the task needs.

To report a security problem, see SECURITY.md.

How it works

The server calls the adb command-line program with execFile. Each MCP tool is a wrapper around one adb operation. The server exposes the tools over the stdio transport of the MCP SDK.

The adb_screenshot tool reads the output of screencap -p and returns it as an MCP image block. An agent that supports images can see the screen and then choose the next action.

Development

npm run dev     # run from source with tsx
npm run build   # compile TypeScript to dist/
npm start       # run the compiled server

Contributing

See CONTRIBUTING.md for the contribution process and the coding standards.

License

This project uses the MIT License. See LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选