harmonyos-dev-mcp

v0.10.0
harmonyos-dev-mcp Checked 1 day ago Published 2 months ago

HarmonyOS 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.

ParameterTypeDescription
project_path *string
build_modestring
hsp_module_names
include_hspboolean
is_cleanboolean
module_name
productstring
targetstring

install_app Install App

Install a HAP or APP artifact on a connected HarmonyOS device.

ParameterTypeDescription
hap_path *string
device_id
hdc_server

run_app Run App

Launch a HarmonyOS application and verify that its window appears.

ParameterTypeDescription
bundle_name *string
ability_name
auto_detectboolean
device_id
hdc_server
module_name

uninstall_app Uninstall App

Uninstall a HarmonyOS application by bundle name.

ParameterTypeDescription
bundle_name *string
device_id
hdc_server

get_ui_tree Get Ui Tree

Capture the UI tree globally or for a validated application window.

ParameterTypeDescription
bundle_name
device_id
hdc_server
window_id

list_windows List Windows

List current HarmonyOS windows, optionally filtered by bundle name.

ParameterTypeDescription
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.

ParameterTypeDescription
bundle_name
device_id
element_id
element_type
hdc_server
interval_msinteger
statestring
text
timeout_msinteger
window_id

list_devices List Devices

List connected HarmonyOS devices and basic device information.

ParameterTypeDescription
hdc_server

query_package Query Package

List packages or query one package's abilities, main ability, or permissions.

ParameterTypeDescription
bundle_name
device_id
hdc_server
info_typestring
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.

ParameterTypeDescription
bundle_name
countinteger
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.

ParameterTypeDescription
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.

ParameterTypeDescription
device_id
direction
from_x
from_y
hdc_server
speedinteger
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.

ParameterTypeDescription
text *string
bundle_name
device_id
element_handle
element_id
element_text
element_type
hdc_server
modestring
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…

ParameterTypeDescription
key *
device_id
hdc_server
modifiers

find_elements Find Elements

Find UI elements and return reusable element handles.

ParameterTypeDescription
bundle_name
device_id
element_id
element_type
hdc_server
text
window_id

screenshot Screenshot

Capture the full display or a rectangular screen region.

ParameterTypeDescription
bottom
device_id
display_idinteger
hdc_server
left
local_path
right
top

drag Drag

Drag from one screen coordinate to another.

ParameterTypeDescription
device_id
from_x
from_y
hdc_server
speedinteger
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.

ParameterTypeDescription
context_linesinteger
device_id
domain
end_time
fallback_to_historicalboolean
hdc_server
include_crashboolean
input_file
input_files
keyword
level
linesinteger
logs
marker_keywords
modestring
package_name
pid
realtime_wait_msinteger
save_path
seconds
start_time
tag
tag_search
time_expr