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

@ai-arkts/harmony-tools

v1.0.0

Published

MCP server for HarmonyOS development — compilation, device control, hdc log, UI dump, doc search

Readme

@ai-arkts/harmony-tools

npm version License: MIT

MCP (Model Context Protocol) server for HarmonyOS development.
Provides 15 tools for compilation, device control, log collection, UI dump, and documentation search — all accessible via hdc.


Installation

# Run directly (no install needed)
npx @ai-arkts/harmony-tools

Or install globally:

npm install -g @ai-arkts/harmony-tools
harmony-tools

Prerequisites

  • Node.js >= 18
  • DevEco Studio installed (for hdc, hvigorw, SDK)
  • HarmonyOS device connected via USB/Wi-Fi
  • Set DEVECO_HOME environment variable to DevEco Studio install path (auto-detected on Windows)

MCP Configuration

Add to your MCP client config:

{
  "mcpServers": {
    "harmony-tools": {
      "command": "npx",
      "args": ["@ai-arkts/harmony-tools"]
    }
  }
}

Tools

Documentation

| Tool | Description | |---|---| | search_hmos_doc | Search HarmonyOS official documentation by keyword | | fetch_hmos_doc | Fetch a doc page by URL and extract targeted sections | | read_hmos_doc | Read a doc section by object_id and optional section_id |

Build & Deploy

| Tool | Description | |---|---| | hmos_compilation | Compile HarmonyOS project with hvigorw (assembleHap) | | hmos_run | Build → install HAP → launch app in one step |

Device Operations

| Tool | Description | |---|---| | device_tap | Tap at screen coordinates | | device_double_tap | Double tap at coordinates | | device_swipe | Swipe from (x1,y1) to (x2,y2) | | device_press_key | Press key (Home / Back) | | device_input_text | Input text at coordinates (auto-clears existing content) | | device_long_click | Long click at coordinates | | device_start_app | Start an app by bundle name | | device_sleep | Wait for a duration (ms) | | device_dump_ui | Get current page UI tree as JSON (for precise element positioning) |

Diagnostics

| Tool | Description | |---|---| | hdc_log | Collect / clear / list device logs via hilog | | hmos_jscrash_report | Analyze ArkTS/JS crash logs into error type, stack, suspected file |


Key Features

🔑 UI Tree Coordinate Enhancement

Instead of relying solely on model "guessed" coordinates from screenshots, device_dump_ui retrieves the exact UI control tree, enabling precise element targeting by bounds:

1. Call device_dump_ui → get UI tree JSON
2. Search tree for target element by text/type/description
3. Extract bounds: [x1,y1][x2,y2]
4. Click center: ((x1+x2)/2, (y1+y2)/2)

🔑 Log-Based Verification

Combine with hdc_log and hmos_jscrash_report for non-UI functional testing — collect app logs by bundle name (filtered by PID) and verify against expected patterns.


Quick Start

Build and Run an App

hmos_compilation(project_abs_path="D:/MyProject")
hmos_run(project_abs_path="D:/MyProject", build_mode="debug")

Collect App Logs

hdc_log(action="clear")
# ... perform operations ...
hdc_log(action="collect", bundle_name="com.example.app", log_prefix="[MY_APP]")

Analyze a Crash

hdc_log(action="collect", lines=4000)
hmos_jscrash_report(crash_log="<collected logs>")

Search Documentation

search_hmos_doc(keyword="ArkTS @State", catalog="harmonyos-guides")

Environment Variables

| Variable | Required | Description | |---|---|---| | DEVECO_HOME | Auto-detected | DevEco Studio install path | | PATH | — | Must include hdc/hvigorw/node if DEVECO_HOME is not set |

Auto-detection paths (Windows):

  • C:\Program Files\DevEco Studio
  • C:\Program Files (x86)\DevEco Studio
  • %USERPROFILE%\DevEco Studio

Package Contents

bin/run.js              ← CLI entry point (node --import tsx)
src/index.ts            ← MCP server (stdio transport)
src/lib/
├── hmos_env.ts         ← DevEco env detection, hdc path resolution
├── hmos_doc_api.ts     ← HarmonyOS doc API client
├── hmos_doc_cache.ts   ← Doc cache & section parser
└── runCmd.ts           ← Cross-platform subprocess wrapper
src/tools/              ← 15 MCP tool implementations
src/devices/
└── harmony.ts          ← HarmonyDevice: hdc device abstraction

Acknowledgement

Most of the tools in this project are extracted and adapted from the codegenie-test project. Key adaptations:

  • Plugin tool format → MCP protocol: Converted custom tool definitions to standard MCP (Model Context Protocol)
  • Runtime adaptation: Replaced platform-specific APIs with standard Node.js child_process.spawn and fs/promises
  • Reusable device abstraction: Extracted HarmonyDevice class with UI tree dump (device_dump_ui) and PID-based log filtering
  • Added 8 device operation MCP tools: tap, doubleTap, swipe, pressKey, inputText, longClick, startApp, sleep

Related


License

MIT