harmonyos-dev-mcp
v0.10.0HarmonyOS MCP service for device automation, app deployment, UI interaction, E2E support, and log validation.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
build_app Build App
Build HarmonyOS artifact.
| Parameter | Type | Description |
|---|---|---|
project_path * | string | |
build_mode | string | |
hsp_module_names | ||
include_hsp | boolean | |
is_clean | boolean | |
module_name | ||
product | string | |
target | string |
install_app Install App
Install a HAP or APP artifact on a connected HarmonyOS device.
| Parameter | Type | Description |
|---|---|---|
hap_path * | string | |
device_id | ||
hdc_server |
run_app Run App
Launch a HarmonyOS application and verify that its window appears.
| Parameter | Type | Description |
|---|---|---|
bundle_name * | string | |
ability_name | ||
auto_detect | boolean | |
device_id | ||
hdc_server | ||
module_name |
uninstall_app Uninstall App
Uninstall a HarmonyOS application by bundle name.
| Parameter | Type | Description |
|---|---|---|
bundle_name * | string | |
device_id | ||
hdc_server |
get_ui_tree Get Ui Tree
Capture the UI tree globally or for a validated application window.
| Parameter | Type | Description |
|---|---|---|
bundle_name | ||
device_id | ||
hdc_server | ||
window_id |
list_windows List Windows
List current HarmonyOS windows, optionally filtered by bundle name.
| Parameter | Type | Description |
|---|---|---|
bundle_name | ||
device_id | ||
hdc_server |
wait_for_element Wait For Element
Wait until a UI element appears or disappears within a strict wall-clock budget. The timeout includes device queries, polling sleeps, and stability confirmation. A zero timeout returns immediately without querying the device.
| Parameter | Type | Description |
|---|---|---|
bundle_name | ||
device_id | ||
element_id | ||
element_type | ||
hdc_server | ||
interval_ms | integer | |
state | string | |
text | ||
timeout_ms | integer | |
window_id |
list_devices List Devices
List connected HarmonyOS devices and basic device information.
| Parameter | Type | Description |
|---|---|---|
hdc_server |
query_package Query Package
List packages or query one package's abilities, main ability, or permissions.
| Parameter | Type | Description |
|---|---|---|
bundle_name | ||
device_id | ||
hdc_server | ||
info_type | string | |
keyword |
click Click
Dispatch one or two clicks to a UI target. ``dispatched=true`` confirms command delivery. ``effect_verified`` remains false because a generic click cannot prove an application-level outcome.
| Parameter | Type | Description |
|---|---|---|
bundle_name | ||
count | integer | |
device_id | ||
element_handle | ||
element_id | ||
element_type | ||
hdc_server | ||
text | ||
x | ||
y |
long_press Long Press
Dispatch a long press to a UI target. ``dispatched=true`` confirms command delivery. ``effect_verified`` remains false because a generic long press cannot prove an application-level outcome.
| Parameter | Type | Description |
|---|---|---|
bundle_name | ||
device_id | ||
element_handle | ||
element_id | ||
element_type | ||
hdc_server | ||
text | ||
x | ||
y |
swipe Swipe
Swipe by direction or explicit start and end coordinates.
| Parameter | Type | Description |
|---|---|---|
device_id | ||
direction | ||
from_x | ||
from_y | ||
hdc_server | ||
speed | integer | |
to_x | ||
to_y |
input_text Input Text
Set an input field to UTF-8 text, or append at the end when mode is ``append``. For reliable automation, first call find_elements/wait_for_element and pass its element_handle. Handle and unique-search modes verify foreground focus before dispatching text, then re-read the field and verify the exact final value. Coordinates cannot be re-read and therefore remain best-effort with verified=false. Replace mode is the default, and an empty replacement clears the field.
| Parameter | Type | Description |
|---|---|---|
text * | string | |
bundle_name | ||
device_id | ||
element_handle | ||
element_id | ||
element_text | ||
element_type | ||
hdc_server | ||
mode | string | |
x | ||
y |
press_key Press Key
Press one logical key, optionally with Ctrl, Alt, Shift, or Meta modifiers. Use ``input_text`` to enter strings. Use this tool for system keys and shortcuts such as key="Home" or key="V", modifiers=["Ctrl"]. ``key`` accepts every official HarmonyOS ``KEYCODE_*`` name and numeric value. Names are case- and separator-insensitive: ``Tab``, ``KEYCODE_TAB``, ``page-up``, and ``page_up`` are valid. Use ``Backspace`` for KEYCODE_DEL and ``Delete`` for KEYCODE_FORWARD_DEL. The result returns the canonical key name, its numeric code, and the exact key codes sent in the single HarmonyOS keyEvent. ``dis…
| Parameter | Type | Description |
|---|---|---|
key * | ||
device_id | ||
hdc_server | ||
modifiers |
find_elements Find Elements
Find UI elements and return reusable element handles.
| Parameter | Type | Description |
|---|---|---|
bundle_name | ||
device_id | ||
element_id | ||
element_type | ||
hdc_server | ||
text | ||
window_id |
screenshot Screenshot
Capture the full display or a rectangular screen region.
| Parameter | Type | Description |
|---|---|---|
bottom | ||
device_id | ||
display_id | integer | |
hdc_server | ||
left | ||
local_path | ||
right | ||
top |
drag Drag
Drag from one screen coordinate to another.
| Parameter | Type | Description |
|---|---|---|
device_id | ||
from_x | ||
from_y | ||
hdc_server | ||
speed | integer | |
to_x | ||
to_y |
logs_query Logs Query
Query HarmonyOS logs for errors or business markers. Default mode focuses on actionable errors. Use ``mode="markers"`` to confirm success or failure markers such as picker save results.
| Parameter | Type | Description |
|---|---|---|
context_lines | integer | |
device_id | ||
domain | ||
end_time | ||
fallback_to_historical | boolean | |
hdc_server | ||
include_crash | boolean | |
input_file | ||
input_files | ||
keyword | ||
level | ||
lines | integer | |
logs | ||
marker_keywords | ||
mode | string | |
package_name | ||
pid | ||
realtime_wait_ms | integer | |
save_path | ||
seconds | ||
start_time | ||
tag | ||
tag_search | ||
time_expr |