harmonyos-dev-mcp
This server provides a comprehensive set of MCP tools for HarmonyOS application development, covering device management, app build/deployment, UI automation, E2E inspection, and log validation.
Device Management:
list_devices– Discover connected HarmonyOS devices (supports wireless debugging via IP)query_package– Query installed packages/bundles on a device
Build & Deployment:
build_app– Build HarmonyOS artifacts (HAP, HAR, HSP, APP, HNP) with debug/release modes and clean buildsinstall_app– Install a HAP package onto a devicerun_app– Launch an installed app by bundle nameuninstall_app– Remove an installed app from a device
UI Automation:
screenshot– Capture a full or cropped screenshotclick/click_element– Tap a screen coordinate or UI element (single/double click)long_press/long_press_element– Long-press a coordinate or elementinput_text– Type text into a focused or targeted elementswipe– Perform a swipe gesture by direction or coordinatesdrag– Drag from one coordinate to anotherpress_key– Simulate key presses using OpenHarmony InputKitKEYCODE_*definitions
E2E / UI Inspection:
get_ui_tree– Retrieve the full UI element tree of the current screenlist_windows– List all active windows (optionally filtered by bundle)wait_element– Poll until a UI element appears or disappears within a timeoutfind_element– Search for UI elements by text, type, or ID
Log Validation:
logs_query– Query device logs with filtering by level, tag, keyword, domain, PID, package name, time range, and crash inclusion; supportserrorsormarkersmode and reading from files or live device streams
Most device-targeted tools support specifying an hdc_server endpoint for wireless debugging by IP.
Provides tools for HarmonyOS app development, including building, deploying, UI automation, and logging for HarmonyOS devices.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@harmonyos-dev-mcpbuild my project and install on the connected device"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
HarmonyOS Dev MCP
harmonyos_dev_mcp provides HarmonyOS MCP tools for device discovery, app build and deployment, UI automation, E2E inspection, and log validation.
Links
PyPI: harmonyos-dev-mcp
Tool reference: docs/tool_reference.md
Logs query guide: docs/logs_query.md
Related MCP server: lazy-mobile-mcp
What It Provides
The package exposes 18 MCP tools:
0.9.1 highlights
input_textnow selects an IME-safe strategy for digits, Unicode, and ASCII text without changing the active input method.Handle and unambiguous search targets are observed until their exact final value is visible or the verification deadline expires.
Reliable text input verifies both foreground-window state and element focus before any text or shortcut is dispatched.
UI mutations are serialized per HDC endpoint and device, while separate devices remain concurrent.
press_keydistinguishes event dispatch from application-level effect verification.
Parameter notation:
name: requiredname?: optionalname*: conditionally required, depending on the selected mode or target
Device-targeted tools also accept hdc_server? for wireless debugging by IP. Pass the wireless HDC endpoint, for example 192.168.43.34:35215, to route commands as hdc -t 192.168.43.34:35215 .... If both a device SN and an IP endpoint are needed, pass device_id as the SN and hdc_server as the IP endpoint; commands are routed as hdc -t <SN> -s <IP:port> .... You can also set HARMONYOS_HDC_SERVER as a default endpoint.
General tools:
Tool | Parameters |
|
|
|
|
|
|
Build tools:
Tool | Parameters |
|
|
|
|
|
|
|
|
UI tools:
Tool | Parameters |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
press_key accepts all 354 OpenHarmony InputKit KEYCODE_* definitions. Key
names are case- and separator-insensitive, so KEYCODE_PAGE_UP, PageUp, and
page-up are equivalent. Use input_text for strings and Chinese text.
click and long_press report dispatched=true, effect_verified=false when
the device accepts the command. This confirms delivery, not an application
state change.
For reliable text entry, call find_elements or wait_for_element first and
pass the returned element_handle to input_text. A search target is also
verified when it resolves to exactly one element. Coordinate mode cannot read
the target value, so it sends the original text without cleanup tricks and
returns dispatched=true, verified=false.
input_text never toggles the active IME. Internally it uses direct entry for
short ASCII digits, native paste for Unicode or long text, and a verified
sentinel-assisted paste for other ASCII text. The sentinel is removed only
after the exact sentinel-bearing value is observed. Paste strategies may
replace the device clipboard; check clipboard_modified in the result.
Handle and search modes first click the target, then observe both
focused=true and a foreground target window before dispatching text. Set
INPUT_FOCUS_TIMEOUT_MS to change the default 5000ms focus budget. A
background or occluded target that does not acquire focus returns
INPUT_FOCUS_TIMEOUT without dispatching text.
Input verification also uses a deadline rather than a fixed delay. Set
INPUT_VERIFY_TIMEOUT_MS to change the default 15000ms value budget.
Successful observations return immediately. Password fields and some Web/Chromium
accessibility fields may not expose or accept deterministic text operations;
these return a verification error with the last observed actual_text instead
of claiming success. A failed write may still leave partial text in the target.
E2E tools:
Tool | Parameters |
|
|
|
|
|
|
wait_for_element.timeout_ms is a strict wall-clock budget covering device
queries, polling sleeps, and the stability confirmation. When the budget
expires, the tool returns WAIT_TIMEOUT without starting another observation;
timeout_ms=0 returns immediately without querying the device.
build_app supports HarmonyOS HAP, HAR, HSP, APP, and HNP build flows. HSP outputs can also be integrated into a HAP with include_hsp=true.
Detailed validation rules, result fields, errors, and examples are in the tool reference.
Layout
mcp_ho_dev/
|- src/harmonyos_dev_mcp/
| |- build/ # Hvigor build helpers, signing, packaging, and target handlers
| |- device/hdc/ # HDC device, package, app, file, and UI adapters
| |- logs/ # Log query parsing and history support
| |- runtime/ # Server factory and explicit MCP tool registration
| |- tools/ # Public MCP tool entrypoints
| |- ui/ # UI tree parsing, selectors, actions, and normalization
| |- utils/ # Compatibility wrappers
| `- _common/ # Shared runtime infrastructure bundled in this package
|- tests/unit/ # Unit tests grouped by domain
|- docs/ # Public tool and log query documentation
|- scripts/ # Release helpers
|- pyproject.toml # Project metadata and build config
|- uv.lock
|- README.mdRequirements
Python 3.12+
DevEco Studio 5.0+
HarmonyOS SDK toolchains, including
hdcuv
Install
Install from PyPI:
pip install harmonyos-dev-mcpInstall from source for local development:
uv syncUse uv run for development commands so Python resolves this checkout instead
of another globally installed harmonyos-dev-mcp version:
uv run python -c "import harmonyos_dev_mcp; print(harmonyos_dev_mcp.__file__)"Run
uv run harmonyos-dev-mcpCheck connected devices:
hdc list targetsUse wireless debugging by IP:
await list_devices(hdc_server="192.168.43.34:35215")
await install_app(r"C:\path\to\app.hap", hdc_server="192.168.43.34:35215")Or set a default endpoint:
set HARMONYOS_HDC_SERVER=192.168.43.34:35215Documentation
Build Examples
Build a debug HAP:
await build_app(r"C:\path\to\project", target="hap", build_mode="debug", product="default")Build HSP modules and integrate them into a HAP:
await build_app(
r"C:\path\to\project",
target="hap",
build_mode="debug",
product="default",
include_hsp=True,
hsp_module_names=["library_one", "library_two"],
)Build an HNP-injected HAP:
await build_app(r"C:\path\to\project", target="hnp", build_mode="debug", product="default")Development
Run unit tests:
uv run pytest tests/unit -vRun with coverage:
uv run pytest tests/unit -v --cov=harmonyos_dev_mcpBuild package artifacts:
uv build --out-dir dist --clearNotes
build_appis a long-running tool. Set MCPtools/call timeoutto at least60s, and prefer120sfor cold builds.build_app target="hnp"builds a base HAP, injects module HNP packages fromentry/hnp, and signs the HAP through SDK packaging tools.build_app target="hsp"builds shared modules;build_app target="hap" include_hsp=truecan integrate one or more HSP outputs into the HAP.logs_querysupportserrorsandmarkersmodes.The shared infrastructure that used to live in a separate common package is bundled in
harmonyos_dev_mcp._common.
License
Apache License 2.0
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables access to Hanzo APIs and Platform capabilities via MCP, along with development tools for managing and improving projects.Last updated71MIT
- Alicense-qualityBmaintenanceLocal MCP server for Android and iOS mobile automation and performance telemetry, enabling device control (screenshot, tap, swipe, input, app launch) and metric collection (CPU, memory, launch time) via ADB, simctl, and WebDriverAgent with SQLite session history.Last updated371MIT
- Flicense-qualityDmaintenanceProvides Android UI automation tools via MCP, enabling device interaction, UI snapshot, and gesture recording.Last updated
- Alicense-qualityBmaintenanceEnables file operations, npm package management, and configuration checking through MCP.Last updated201MIT
Related MCP Connectors
MCP server for Appcircle mobile CI/CD platform.
Remote MCP for Android CLI agent build gate, structured receipts, audit logs, and reviewer-ready evi
The MCP server for Azure DevOps, bringing the power of Azure DevOps directly to your agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Deslord319/harmonyos-dev-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server