Metadata-Version: 2.5
Name: element-mcp
Version: 0.1.0
Summary: Sub-10ms local UI vision MCP stdio server for Android & iOS agents. Powered by ONNX Runtime and clean-room YOLOv8-nano.
Project-URL: Homepage, https://github.com/Bradprobert/element
Project-URL: Documentation, https://bradprobert.github.io/element/
Project-URL: Repository, https://github.com/Bradprobert/element
Project-URL: Issues, https://github.com/Bradprobert/element/issues
Author-email: Bradley Probert <bradprobert96@gmail.com>
License-Expression: Apache-2.0
Keywords: android,computer-vision,ios,mcp,mobile-agents,onnxruntime,ui-detection
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27
Requires-Dist: mcp>=1.2.0
Requires-Dist: numpy>=1.26
Requires-Dist: onnxruntime>=1.18.0
Requires-Dist: pillow>=10.0
Requires-Dist: pydantic>=2.6
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# element-mcp

**Sub-10ms, zero-token local UI vision over MCP `stdio` for Android & iOS agents.**

`element-mcp` locates 13 mobile UI element classes (`button`, `text_input`, `checkbox`, `radio`, `toggle`, `icon`, `text_label`, `image`, `tab`, `list_item`, `card`, `dropdown`, `spinner`) and returns device-scaled `(x, y)` tap coordinates plus compact prompt lists (`215` tokens vs `1,545+` for cloud screenshot prompts, `-86.1%`).

- **Apache-2.0 clean-room**: Trained exclusively on open-source UI libraries & Figma designs (`4,000` train + `300` unseen-engine OOD screens).
- **Zero PyTorch at runtime**: Lightweight `onnxruntime` + `pillow` + `numpy` engine (`5.8 MB` QDQ INT8 ONNX, `7.4 ms` CPU p50 on Apple M5 Pro, `1.000` val / `0.891` OOD mAP@50) with automatic `CoreML` / `CUDA` / `DirectML` / `CPU` provider selection.
- **Zero-config weights**: Automatically downloads & SHA-256 verifies [`v0.1.0`](https://github.com/Bradprobert/element/releases/tag/v0.1.0) ONNX weights from [`Bradprobert/element`](https://github.com/Bradprobert/element) on first run.
- **No ADB coupling**: Returns coordinates only; your agent or device runner decides how to tap.

## Install & Run

```bash
# Run directly with uvx
uvx element-mcp

# Or install with pip
pip install element-mcp
element-mcp
```

Optional CLI flags & environment overrides:

```bash
# Pre-fetch v0.1.0 INT8 weights + manifest.json into ~/.cache/element-mcp
element-mcp --download-weights

# Or point at a local exported weights directory
element-mcp --model-dir /path/to/element/figma-ui-trainer/artifacts/v0.1.0
```

## Client Configuration (Claude Desktop / Cursor / Windsurf / Antigravity)

```json
{
  "mcpServers": {
    "element": {
      "command": "uvx",
      "args": ["element-mcp"]
    }
  }
}
```

Or if installed via `pip install element-mcp`:

```json
{
  "mcpServers": {
    "element": {
      "command": "element-mcp"
    }
  }
}
```

## Exposed MCP Tools

- **`find_interactable_elements`**: Accepts `image_path` or `image_base64`, optional `device_width`/`device_height`, `platform` (`android` | `ios`), `scale_factor` (`3.0` for `@3x` iOS pt), `min_confidence`, `merge`, and `output_format` (`compact` | `tap_only` | `json`).
- **`get_model_info`**: Reports loaded `manifest.json`, active ONNX Runtime execution provider, input shape (`[384, 640]`), and latency profile.
- **`render_wireframe_svg`**: Returns an annotated SVG wireframe overlay of detected elements for visual debugging.

## Links

- **GitHub Repository**: https://github.com/Bradprobert/element
- **Live Interactive Showcase**: https://bradprobert.github.io/element/
- **Pre-Trained Weights (`v0.1.0`)**: https://github.com/Bradprobert/element/releases/tag/v0.1.0
