
Harmonyos
io.github.FadingLight9291117由 GitHub 帳號 FadingLight9291117 發布v1.0.3更新於 Oct 24, 2026
MCP server for HarmonyOS development - interact with projects, devices, and applications
概覽
針對 HarmonyOS 開發的在地 MCP 伺服器,讓助理查詢已連線裝置、專案設定、建置產物與已安裝應用程式。
- 可以做什麼
- 列出已連線的 HarmonyOS 裝置,並依裝置 ID 讀取型號、廠商、系統版本等詳細資訊。從 app.json5 讀取專案中繼資料,並列出專案各模組及其 HAP/HSP/HAR 類型。檢查建置產物是否存在,並列出產生的 HAP 與 HSP 檔案。列出裝置上已安裝的應用程式,並查看版本、安裝時間、是否為系統應用程式等詳細資訊。
- 適用情境
- 適合在開發 HarmonyOS 專案時,讓助理不必手動執行 hdc 指令就能查看裝置、專案結構、建置產物與已安裝應用程式。README 將其定位為快速唯讀查詢,建置與部署則交由 shell 指令完成。
- 執行需求
- 需要 Node.js 18 或更新版本,透過 npm 或 npx 在本機安裝。需安裝 HarmonyOS DevEco Studio,並確認其 hdc 命令列工具位於 PATH 中。查詢裝置與應用程式時,需以 USB 連接 HarmonyOS 裝置並開啟開發人員選項與 USB 偵錯。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Harmonyos,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
MCP HarmonyOS
npm: https://www.npmjs.com/package/mcp-harmonyos
[NPM Version] [GitHub Stars] [License]
A Model Context Protocol (MCP) server for HarmonyOS development. This server enables AI assistants like Claude to interact with HarmonyOS projects, devices, and applications.
Features
- Device Management: List and query connected HarmonyOS devices
- Project Information: Read project configuration, modules, and build outputs
- Application Management: List and inspect installed applications on devices
- Build Verification: Check build outputs and project structure
Prerequisites
- Node.js 18+
- HarmonyOS DevEco Studio (for hdc command-line tools)
hdcmust be available in your PATH
Installation
Global Installation (Recommended)
Or use with npx
Configuration
For OpenCode
Add to your ~/.config/opencode/opencode.json:
For Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Available Tools
Device Management
harmonyos_list_devices
List all connected HarmonyOS devices.
Returns: Array of devices with UDID and status
harmonyos_get_device_info
Get detailed information about a specific device.
Parameters:
deviceId(string): The device UDID
Returns: Device information including model, manufacturer, OS version, etc.
Project Information
harmonyos_get_project_info
Get HarmonyOS project information from app.json5.
Parameters:
projectPath(string): Absolute path to the HarmonyOS project root
Returns: Project metadata including bundleName, version, and modules
harmonyos_list_modules
List all modules in a project with their types (HAP/HSP/HAR).
Parameters:
projectPath(string): Absolute path to the HarmonyOS project root
Returns: Array of modules with name, type, and path
harmonyos_check_build_outputs
Check if build outputs exist and list them.
Parameters:
projectPath(string): Absolute path to the HarmonyOS project root
Returns: Build output information
Application Management
harmonyos_list_installed_apps
List all installed applications on a device.
Parameters:
deviceId(string): The device UDID
Returns: Array of installed applications
harmonyos_get_app_info
Get detailed information about an installed application.
Parameters:
deviceId(string): The device UDIDbundleName(string): The application bundle name
Returns: Detailed application information
Usage Examples
With OpenCode
After configuring the MCP server, you can ask OpenCode questions like:
OpenCode will use the MCP tools to query information and can combine them with bash commands for building and deploying:
Design Philosophy
This MCP server follows the "lightweight query + external operations" pattern:
- MCP tools provide fast, structured queries (device info, project metadata, app status)
- Bash commands handle long-running operations (building, deploying)
- AI assistants intelligently combine both for complete workflows
This design ensures:
- ✅ Fast response times (all queries < 1 second)
- ✅ No timeout issues with long builds
- ✅ Clear error messages and logs
- ✅ Easy to maintain and extend
Development
Build from Source
Project Structure
Troubleshooting
"hdc command not found"
Make sure DevEco Studio is installed and hdc is in your PATH:
"No devices connected"
- Enable Developer Options on your device (tap Build Number 7 times)
- Enable USB Debugging
- Connect device via USB
- Run
hdc list targetsto verify connection
"app.json5 not found"
Make sure you provide the absolute path to the project root directory (where AppScope/app.json5 is located).
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Related Resources
來源:README.md,提交 72f0e79
工具
0版本歷史
1- v1.0.3最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分