Skip to main content

MCP service that wraps HarmonyOS hdc commands

Project description

Harmony Tools MCP 服务

将 HarmonyOS 命令行工具(hdchvigor 等)封装为 MCP 服务,接入任意支持 MCP 的客户端,常用开发任务以结构化 JSON 返回。

快速上手

  • 前置条件:Python ≥3.11;已安装 HarmonyOS Command Line Tools。
  • 下载地址:HarmonyOS Command Line Tools
  • 配置必需环境变量:
# 解压后在 command-line-tools/sdk/default/openharmony/toolchains 目录下
export HDC_PATH=/path/to/hdc
# 解压后在 command-line-tools/bin 目录下
export HVIGORW_PATH=/path/to/hvigorw

安装

# 全局安装(推荐)
uv tool install git+<repository-url>

# 开发模式(本地源码)
uv pip install -e .

启动

  • stdio(默认):
    • uv run harmony-tools-mcp
  • http(调试/多客户端):
    • uv run harmony-tools --transport http
    • ./start_http_server.sh

客户端最小配置示例

  • stdio
{
  "mcpServers": {
    "harmony-tools": {
      "command": "harmony-tools-mcp",
      "env": {
        "HDC_PATH": "/path/to/hdc", 
        "HVIGORW_PATH": "/path/to/hvigorw"
      }
    }
  }
}
  • http
{
  "mcpServers": {
    "harmony-tools": {
      "transport": "http", 
      "url": "http://127.0.0.1:10005/mcp"}
  }
}

可用工具一览

  • list_targetsshell
  • hvigor_cleanhvigor_assemblehvigor_find_output
  • hdc_screenshothdc_install_app

常见问题(精简)

  • 找不到 hdc/hvigorw:检查并设置 HDC_PATHHVIGORW_PATH
  • 无响应或超时:适当提高超时或减少输出量。
  • 权限问题:设备开启开发者模式并授予访问权限。

开发者文档

详细技术说明(环境变量、运行模式、工具参数与返回结构、长示例、完整排障)见 docs/DEVELOPER.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

harmony_tools_mcp-0.1.2.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

harmony_tools_mcp-0.1.2-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file harmony_tools_mcp-0.1.2.tar.gz.

File metadata

  • Download URL: harmony_tools_mcp-0.1.2.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for harmony_tools_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 51b794490352870a8b6d35b920bd3151135c5430604777af65b80a4e0bd5fbb2
MD5 a493c9afbe9eeb854f2a2d1db10621a6
BLAKE2b-256 b73ac92946ff890502860bac0e79a53ca75ffc15e7177c63e5a7157333e96657

See more details on using hashes here.

Provenance

The following attestation bundles were made for harmony_tools_mcp-0.1.2.tar.gz:

Publisher: python-publish.yml on 99byte/harmony-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file harmony_tools_mcp-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for harmony_tools_mcp-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fade4617195bcdf5016e9249a42c6a766b30620b9158e135bbd908e84e7a9200
MD5 d28398dadb0ffb5e739acba2cf2088df
BLAKE2b-256 07ffb9aaa3e531174181c23c9354a233e92bc626126cd2734d040063130ac5cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for harmony_tools_mcp-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on 99byte/harmony-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page