ui-locate-mcp 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md ADDED
@@ -0,0 +1,111 @@
1
+ # ui-locate-mcp
2
+
3
+ [简体中文](README.md) · English · [npm](https://www.npmjs.com/package/ui-locate-mcp)
4
+
5
+ Find on-screen UI text locally and return pixel coordinates for desktop interaction. Combined tools can locate, click, type, scroll and attempt to verify the result.
6
+
7
+ Detection, OCR and actions run locally. Initial setup downloads Python dependencies and a detection model of about 80 MB. A persistent service runs inference; a lightweight MCP process forwards requests.
8
+
9
+ ## Quick start
10
+
11
+ 1. Enter `ui-locate-mcp` in DSH **Plugins → Add plugin**, then enable it.
12
+ 2. Open **ui-locate runtime** in Settings, choose paths and a backend, and prepare the environment. The Host tool `ui_locate_setup` provides the same preparation path.
13
+ 3. After preparation, connect or re-enable `mcp-ui-locate`. Restart if DSH requests it.
14
+ 4. Call `health`, then try `locate_text(text="Save")`.
15
+
16
+ The bundle contains an MCP client, a Host runtime-management plugin and a Client settings page. npm installation supplies the code; Python dependencies and the model require separate setup.
17
+
18
+ ### Requirements
19
+
20
+ - The current bundle's MCP executable path is configured for **Windows**. Cross-platform Python code does not imply a cross-platform bundle configuration.
21
+ - The Python project requires **Python 3.12+**. The settings preparation uses a Python runtime located by the host to create a dedicated environment. Check the desktop installation's bundled runtime if no interpreter can be found.
22
+ - **DirectML** is the default backend; `cuda` and `cpu` are alternatives. CUDA needs the corresponding NVIDIA environment and larger dependencies. Changing backends requires rebuilding the environment.
23
+ - package.json currently declares no `engines.dsh` range. This is not a guarantee of compatibility with every DSH version: the bundle needs tool registration, an MCP client and settings services.
24
+
25
+ For a Web profile:
26
+
27
+ ~~~sh
28
+ dsh plugin --profile web add ui-locate-mcp
29
+ ~~~
30
+
31
+ Stop the instance before CLI changes and restart afterwards. Prefer the Plugins page on Desktop; managing its desktop profile requires that installation's CLI and the same DSH_HOME.
32
+
33
+ ## Tools
34
+
35
+ | Tool | Purpose |
36
+ | --- | --- |
37
+ | `locate_text` | Find matching UI text and its center coordinates |
38
+ | `find_all` | Return multiple matching candidates |
39
+ | `detect_elements` | Enumerate detected elements |
40
+ | `ui_locate_act` | Locate, perform an action and attempt verification |
41
+ | `ui_locate_steps` | Run ordered steps and identify failures |
42
+ | `ui_locate_frames` / `ui_locate_frame` | List or retrieve recent action frames |
43
+ | `list_monitors` | Display sizes, origins and indices |
44
+ | `health` | Check service readiness |
45
+ | `ui_locate_setup` | Prepare or rebuild Python dependencies and models |
46
+
47
+ The first nine entries come from MCP; the last two are Host tools. The host may prefix tool names with a namespace.
48
+
49
+ ~~~python
50
+ locate_text(text="Save", monitor="primary")
51
+ ui_locate_act(text="Save", action="click", monitor="primary")
52
+ ~~~
53
+
54
+ Coordinates are absolute screen coordinates and may be negative on secondary displays. `monitor` accepts `primary`, an index string or `all`. Locate again after the UI moves.
55
+
56
+ ## Configuration and data
57
+
58
+ The Host row ID is `ui-locate-update`; the MCP row is `mcp-ui-locate`.
59
+
60
+ | Host setting | Default | Meaning |
61
+ | --- | --- | --- |
62
+ | `pythonSync` | `true` | Synchronize the Python package with the bundle's declared version |
63
+ | `runtimeDir` | Empty | Python environment, state and logs |
64
+ | `modelDir` | Empty | Model directory; existing models can be reused |
65
+ | `backend` | Empty | Reuse the saved selection; DirectML on first preparation |
66
+
67
+ The default home follows `UI_LOCATE_HOME` → `DSH_HOME/ui-locate` → `LOCALAPPDATA/ui-locate`. Empty directory settings follow portable DSH data; explicit absolute paths require maintenance.
68
+
69
+ The Python service also reads `UI_LOCATE_MODEL`, `UI_LOCATE_MODEL_DIR`, `UI_LOCATE_PROVIDER` and `UI_LOCATE_PORT`; see [config.py](src/ui_locate/config.py). MCP connects to local port 7788 by default.
70
+
71
+ ## Updates
72
+
73
+ **The plugin itself is updated by the DSH plugin page; this package no longer ships
74
+ an updater of its own.** The dependency is a registry spec (`ui-locate-mcp`), so that
75
+ row grows a native update button backed by the host's own plugin manager.
76
+
77
+ What this package still owns is the half the host does not: after npm swaps the
78
+ package, the copy inside the venv is still the old one. Every startup compares the
79
+ two versions and reinstalls with `pip install --no-deps` when they differ (turn it
80
+ off with `pythonSync`). Running it at startup is also self-healing — a failure here
81
+ does not undo the JS side, and the next start tries again.
82
+
83
+ Before 0.5.x this repository carried a whole updater of its own (read a version
84
+ list, then call `installBundle`). It was removed because it was a second update path
85
+ running alongside the plugin page: the two disagreed about what was latest, and its
86
+ installs rewrote the dependency back to `github:`, which made the plugin page's
87
+ button disappear. See the [update audit](docs/update-audit.md).
88
+
89
+ ## Troubleshooting and limits
90
+
91
+ - If MCP will not start, check environment preparation and the virtual-environment Python before reconnecting.
92
+ - `ok` means the action pipeline completed; inspect verification separately. `verified: false` or `null` is not confirmation that the intended action succeeded.
93
+ - Desktop permissions, focus, DPI and application frameworks affect input and capture. Locating a target does not guarantee it accepts synthetic input.
94
+ - ONNX Runtime backend wheels share the same Python package name; rebuild rather than installing competing backends together.
95
+ - OCR can miss or misread text. Inspect the screen or target text after important actions.
96
+
97
+ ## Development and references
98
+
99
+ ~~~sh
100
+ python tests/check_bundle.py
101
+ node --test tests/
102
+ python -m unittest discover -s tests -p "test_*.py"
103
+ ~~~
104
+
105
+ Python tests need their dependencies; real-model and desktop smoke tests need a prepared environment. Historical measurements and algorithm notes are in [technical notes](docs/technical-notes.md), not a performance guarantee for other machines.
106
+
107
+ The current [release.yml](.github/workflows/release.yml) publishes on version tags or manual dispatch with a tag. Keep package.json and pyproject.toml versions aligned when releasing.
108
+
109
+ ## License
110
+
111
+ [MIT](LICENSE)