npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lhtdeg/harmony-mcp

v1.1.0

Published

MCP Server for HarmonyOS development tools - extracted from DevEco Code

Readme

HarmonyOS MCP Server

从 DevEco Code 提取的鸿蒙开发工具集,以 MCP Server 形式提供,可直接在原生 OpenCode 中使用。

配合 harmonyos-agent-skills 使用效果更佳 —— Skill 提供开发规范和工作流指引,MCP 提供可执行工具。

工具列表

| 工具 | 说明 | |------|------| | hdc_log | 收集/清理/列出 HarmonyOS 设备日志 | | arkts_check | ArkTS 静态语法检查 | | build_project | 通过 Hvigor 执行编译构建 | | start_app | 在模拟器/真机上运行应用 | | switch_cwd | 切换会话的项目上下文目录 | | list_devices | 列出已连接的鸿蒙设备 |

前置条件

  • Node.js >= 22
  • DevEco Studio >= 6.0(提供 Hvigor、HDC、Node)
  • 设置 DEVECO_HOME 环境变量指向 DevEco Studio 安装目录

安装

方式一:npx(推荐,无需安装)

~/.config/opencode/opencode.jsonc 中添加:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "harmony": {
      "type": "local",
      "command": ["npx", "@lhtdeg/harmony-mcp"],
      "enabled": true
    }
  }
}

然后重启 OpenCode 即可生效。npx 会自动下载并运行最新版本。

方式二:全局安装

npm install -g @lhtdeg/harmony-mcp

然后在 ~/.config/opencode/opencode.jsonc 中同样配置 npx @lhtdeg/harmony-mcp

搭配 HarmonyOS Agent Skills

推荐安装官方的 HarmonyOS 开发 Skill 集合,提供完整的开发工作流指引:

npx skills add HarmonyOS_Skills/harmonyos-agent-skills

Skill 和 MCP 互补:

  • Skill → 告诉 AI 怎么做(规范、流程、最佳实践)
  • MCP → 让 AI 能做(编译、运行、调试)

使用流程

1. switch_cwd → 设置项目路径
2. arkts_check → 检查 ArkTS 语法
3. build_project → 编译构建
4. start_app → 运行到设备
5. hdc_log → 查看设备日志

环境变量

| 变量 | 说明 | 默认值 | |------|------|--------| | DEVECO_HOME | DevEco Studio 安装路径 | 自动检测 | | HDC_PATH | hdc 可执行文件完整路径 | 自动检测 | | HVIGOR_PATH | hvigorw.js 完整路径 | 自动检测 | | DEVECO_NODE_PATH | DevEco Studio 内置 Node 路径 | 自动检测 |

路径包含空格的解决方法

如果 DevEco Studio 安装在 C:\Program Files\Huawei\DevEco Studio 等包含空格的目录中,工具会自动处理路径引用。如果仍然失败,可以通过环境变量手动指定:

# PowerShell
$env:HDC_PATH = "C:\Program Files\Huawei\DevEco Studio\sdk\default\openharmony\toolchains\hdc.exe"
$env:HVIGOR_PATH = "C:\Program Files\Huawei\DevEco Studio\tools\hvigor\bin\hvigorw.js"
$env:DEVECO_NODE_PATH = "C:\Program Files\Huawei\DevEco Studio\tools\node\node.exe"

License

MIT