uiautomator2-mcp-server 0.1.2__tar.gz → 0.2.0__tar.gz
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.
- uiautomator2_mcp_server-0.2.0/CHANGELOG.md +88 -0
- uiautomator2_mcp_server-0.2.0/CODE_OF_CONDUCT.md +23 -0
- uiautomator2_mcp_server-0.2.0/CONTRIBUTING.md +310 -0
- uiautomator2_mcp_server-0.2.0/LICENSE +190 -0
- uiautomator2_mcp_server-0.2.0/MANIFEST.in +11 -0
- uiautomator2_mcp_server-0.2.0/PKG-INFO +738 -0
- uiautomator2_mcp_server-0.2.0/README.md +712 -0
- {uiautomator2_mcp_server-0.1.2 → uiautomator2_mcp_server-0.2.0}/pyproject.toml +52 -45
- {uiautomator2_mcp_server-0.1.2 → uiautomator2_mcp_server-0.2.0}/setup.cfg +4 -4
- uiautomator2_mcp_server-0.2.0/src/u2mcp/.gitignore +1 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/__init__.py +1 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/__main__.py +193 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/background.py +19 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/health.py +67 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/helpers.py +222 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/mcp.py +172 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/middlewares.py +40 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/tools/__init__.py +8 -0
- {uiautomator2_mcp_server-0.1.2 → uiautomator2_mcp_server-0.2.0}/src/u2mcp/tools/action.py +143 -169
- {uiautomator2_mcp_server-0.1.2 → uiautomator2_mcp_server-0.2.0}/src/u2mcp/tools/app.py +232 -231
- uiautomator2_mcp_server-0.2.0/src/u2mcp/tools/clipboard.py +35 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/tools/device.py +307 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/tools/element.py +267 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/tools/input.py +47 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/tools/misc.py +17 -0
- uiautomator2_mcp_server-0.2.0/src/u2mcp/tools/scrcpy.py +142 -0
- uiautomator2_mcp_server-0.1.2/src/u2mcp/_version.py → uiautomator2_mcp_server-0.2.0/src/u2mcp/version.py +34 -34
- uiautomator2_mcp_server-0.2.0/src/uiautomator2_mcp_server.egg-info/PKG-INFO +738 -0
- {uiautomator2_mcp_server-0.1.2 → uiautomator2_mcp_server-0.2.0}/src/uiautomator2_mcp_server.egg-info/SOURCES.txt +12 -1
- {uiautomator2_mcp_server-0.1.2 → uiautomator2_mcp_server-0.2.0}/src/uiautomator2_mcp_server.egg-info/entry_points.txt +1 -0
- uiautomator2_mcp_server-0.2.0/src/uiautomator2_mcp_server.egg-info/requires.txt +5 -0
- uiautomator2_mcp_server-0.1.2/CHANGELOG.md +0 -21
- uiautomator2_mcp_server-0.1.2/LICENSE +0 -620
- uiautomator2_mcp_server-0.1.2/MANIFEST.in +0 -6
- uiautomator2_mcp_server-0.1.2/PKG-INFO +0 -113
- uiautomator2_mcp_server-0.1.2/README.md +0 -88
- uiautomator2_mcp_server-0.1.2/src/u2mcp/.gitignore +0 -1
- uiautomator2_mcp_server-0.1.2/src/u2mcp/__init__.py +0 -2
- uiautomator2_mcp_server-0.1.2/src/u2mcp/__main__.py +0 -82
- uiautomator2_mcp_server-0.1.2/src/u2mcp/mcp.py +0 -61
- uiautomator2_mcp_server-0.1.2/src/u2mcp/tools/__init__.py +0 -3
- uiautomator2_mcp_server-0.1.2/src/u2mcp/tools/device.py +0 -293
- uiautomator2_mcp_server-0.1.2/src/uiautomator2_mcp_server.egg-info/PKG-INFO +0 -113
- uiautomator2_mcp_server-0.1.2/src/uiautomator2_mcp_server.egg-info/requires.txt +0 -2
- {uiautomator2_mcp_server-0.1.2 → uiautomator2_mcp_server-0.2.0}/src/u2mcp/py.typed +0 -0
- {uiautomator2_mcp_server-0.1.2 → uiautomator2_mcp_server-0.2.0}/src/uiautomator2_mcp_server.egg-info/dependency_links.txt +0 -0
- {uiautomator2_mcp_server-0.1.2 → uiautomator2_mcp_server-0.2.0}/src/uiautomator2_mcp_server.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
> 📅 2026-02-05
|
|
6
|
+
|
|
7
|
+
- ⛓️💥 Breaking:
|
|
8
|
+
- CLI now requires explicit subcommand (`http`, `stdio`, `tools`, `info`, `tags`, or `version`). Running `u2mcp` without arguments shows help instead of starting server with default stdio transport. Migrate by appending `stdio` to your command: `u2mcp` → `u2mcp stdio`
|
|
9
|
+
- Change project license from MIT to Apache-2.0
|
|
10
|
+
|
|
11
|
+
- 🆕 New:
|
|
12
|
+
- Add CLI short options: `-l` (log-level), `-i` (include-tags), `-e` (exclude-tags), `-H` (host), `-p` (port), `-t` (token), `-n` (no-token)
|
|
13
|
+
- Add `--show-fastmcp-banner` option to stdio and http commands to control fastmcp banner display
|
|
14
|
+
- Add `save_screenshot` tool to save screenshots to file with format determined by extension
|
|
15
|
+
- Add AI-driven UI testing framework with comprehensive test specification
|
|
16
|
+
- Add Android UI test skill as dual-purpose educational example and production test suite
|
|
17
|
+
- Add CLI utility commands: `u2mcp tools`, `u2mcp info <tool>`, `u2mcp tags`, `u2mcp version`
|
|
18
|
+
- Add tag-based tool filtering with wildcard support (`--include-tags`, `--exclude-tags`)
|
|
19
|
+
- Add `element_bounds` tool to get bounding box coordinates of elements
|
|
20
|
+
- Add clipboard read/write tools: `read_clipboard`, `write_clipboard`
|
|
21
|
+
- Add `hide_keyboard` input tool
|
|
22
|
+
- Add new element interaction tools: `element_get_text`, `element_set_text`
|
|
23
|
+
- Add `purge` device tool to remove all resources from device
|
|
24
|
+
- Add `shell_command` tool to run arbitrary shell commands with timeout
|
|
25
|
+
- Add ADB availability check at startup with `--check-adb/--no-check-adb` option
|
|
26
|
+
- Add `version` CLI option to display version information
|
|
27
|
+
- Add alternative CLI entry points: `uiautomator2-mcp`, `uiautomator2-mcp-server`
|
|
28
|
+
|
|
29
|
+
- ⚙️ Changed:
|
|
30
|
+
- Refactor CLI with cyclopts subcommands (migrated from typer)
|
|
31
|
+
- Move tag parsing and wildcard expansion logic to mcp module
|
|
32
|
+
- Rename `_version.py` to `version.py`
|
|
33
|
+
- Rename `monitor_task_group` to `background_task_group`
|
|
34
|
+
- Rename internal `tags` variable to `tags_map` for clarity
|
|
35
|
+
- Update `shell_command` to return exit code and output
|
|
36
|
+
- Enhance ADB connectivity check with detailed information and platform-specific guidance
|
|
37
|
+
|
|
38
|
+
- 🐛 Fixed:
|
|
39
|
+
- Add `serial_optional=None` parameter to argparse.Namespace in the init tool
|
|
40
|
+
- Improve scrcpy error handling for process exit during startup
|
|
41
|
+
- Correct scrcpy tool name and add Windows executable support
|
|
42
|
+
- Fix `element_bounds` tool - `bounds` is a property, not a method
|
|
43
|
+
- Correct help command reference in breaking changes documentation
|
|
44
|
+
|
|
45
|
+
- 📚 Docs:
|
|
46
|
+
- Add CLAUDE.md with comprehensive project documentation
|
|
47
|
+
- Add CLI utility commands documentation to README
|
|
48
|
+
- Add tool tagging system documentation
|
|
49
|
+
- Add installation guides for uv and pipx
|
|
50
|
+
- Add Chinese translation to README
|
|
51
|
+
- Add code of conduct and contribution guidelines
|
|
52
|
+
- Add ADB troubleshooting guidance
|
|
53
|
+
- Add AI-driven UI testing documentation to README (English and Chinese)
|
|
54
|
+
|
|
55
|
+
- 🧪 Tests:
|
|
56
|
+
- Enhance u2 device mock with comprehensive functionality
|
|
57
|
+
- Add AI-driven UI testing skill with comprehensive test specification
|
|
58
|
+
|
|
59
|
+
- 🐎 Chores:
|
|
60
|
+
- Update check-jsonschema version
|
|
61
|
+
- Add .gitignore file for local config
|
|
62
|
+
- Adjust pre-commit configuration
|
|
63
|
+
|
|
64
|
+
## 0.1.3
|
|
65
|
+
|
|
66
|
+
> 📅 2026-01-23
|
|
67
|
+
|
|
68
|
+
- 🐛 Fixed: Python 3.11 compatibility (added `typing_extensions` dependency)
|
|
69
|
+
|
|
70
|
+
## 0.1.2
|
|
71
|
+
|
|
72
|
+
> 📅 2026-01-09
|
|
73
|
+
|
|
74
|
+
- ⛓️💥 Breaking:
|
|
75
|
+
- http/stdio transport is now a required command line argument, user should choose either `http` or `stdio`, `stdio` is the default.
|
|
76
|
+
|
|
77
|
+
- 🆕 New:
|
|
78
|
+
- Added Authorization bearer token verification
|
|
79
|
+
- Added `--log-level` command line argument
|
|
80
|
+
|
|
81
|
+
- 🗑️ Removed:
|
|
82
|
+
- Removed the feature that http/stdio transports run at the same
|
|
83
|
+
|
|
84
|
+
## 0.1.1
|
|
85
|
+
|
|
86
|
+
> 📅 2026-01-06
|
|
87
|
+
|
|
88
|
+
An early release.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
We value an open, inclusive, and harassment-free community for contributors and users of uiautomator2-mcp-server. All participants are expected to be respectful and professional.
|
|
4
|
+
|
|
5
|
+
## Our Standards
|
|
6
|
+
- Be respectful and considerate in all interactions.
|
|
7
|
+
- Communicate openly and assume good intentions.
|
|
8
|
+
- Avoid demeaning, discriminatory, or harassing behavior and language.
|
|
9
|
+
- Be collaborative and constructive when giving feedback.
|
|
10
|
+
|
|
11
|
+
## Unacceptable Behavior
|
|
12
|
+
Harassment, hateful language, derogatory comments, threats, or other abusive behaviors will not be tolerated.
|
|
13
|
+
|
|
14
|
+
## Reporting and Enforcement
|
|
15
|
+
If you experience or witness unacceptable behavior, please report it to the project maintainers:
|
|
16
|
+
|
|
17
|
+
- Open an issue labeled `code-of-conduct` or
|
|
18
|
+
- Email: tanbro@163.com
|
|
19
|
+
|
|
20
|
+
Reports will be handled promptly and confidentially. Maintainers may take actions including warnings, requested changes, or removal of access when necessary.
|
|
21
|
+
|
|
22
|
+
## Reference
|
|
23
|
+
This policy is aligned with the Contributor Covenant principles. For the full reference see: https://www.contributor-covenant.org/
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# Contributing to uiautomator2-mcp-server
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to uiautomator2-mcp-server! This document provides guidelines and instructions for contributing to the project.
|
|
4
|
+
|
|
5
|
+
## Code of Conduct
|
|
6
|
+
|
|
7
|
+
This project adheres to a code of conduct that all contributors are expected to follow:
|
|
8
|
+
- Be respectful and inclusive
|
|
9
|
+
- Provide constructive feedback
|
|
10
|
+
- Focus on what is best for the community
|
|
11
|
+
- Show empathy towards other community members
|
|
12
|
+
|
|
13
|
+
## Getting Started
|
|
14
|
+
|
|
15
|
+
### Prerequisites
|
|
16
|
+
|
|
17
|
+
- Python 3.11 or higher
|
|
18
|
+
- Git
|
|
19
|
+
- ADB (Android Debug Bridge) - only needed for integration tests
|
|
20
|
+
- An Android device with USB debugging enabled - only needed for integration tests
|
|
21
|
+
|
|
22
|
+
### Setting Up Your Development Environment
|
|
23
|
+
|
|
24
|
+
1. **Fork and clone the repository:**
|
|
25
|
+
```bash
|
|
26
|
+
git clone https://github.com/your-username/uiautomator2-mcp-server.git
|
|
27
|
+
cd uiautomator2-mcp-server
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
2. **Install development dependencies:**
|
|
31
|
+
```bash
|
|
32
|
+
# Install uv (recommended)
|
|
33
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh # Linux/macOS
|
|
34
|
+
# or
|
|
35
|
+
powershell -c "irm https://astral.sh/uv/install.ps1 | iex" # Windows
|
|
36
|
+
|
|
37
|
+
# Install dependencies using uv
|
|
38
|
+
uv sync --dev
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
3. **Activate the virtual environment:**
|
|
42
|
+
```bash
|
|
43
|
+
# Linux/macOS
|
|
44
|
+
source .venv/bin/activate
|
|
45
|
+
|
|
46
|
+
# Windows (PowerShell)
|
|
47
|
+
.venv\Scripts\activate
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
4. **Install pre-commit hooks (highly recommended):**
|
|
51
|
+
```bash
|
|
52
|
+
pre-commit install
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This will automatically run linters and formatters before each commit.
|
|
56
|
+
|
|
57
|
+
## Development Workflow
|
|
58
|
+
|
|
59
|
+
### Running Tests
|
|
60
|
+
|
|
61
|
+
We use pytest for testing. Tests are organized into:
|
|
62
|
+
- **Unit tests** (`tests/unit/`) - Fast tests that don't require external dependencies
|
|
63
|
+
- **Integration tests** (`tests/integration/`) - Tests that require a real Android device
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Run all tests
|
|
67
|
+
pytest
|
|
68
|
+
|
|
69
|
+
# Run only unit tests (fast, no device required)
|
|
70
|
+
pytest -m unit
|
|
71
|
+
|
|
72
|
+
# Run integration tests (requires Android device)
|
|
73
|
+
pytest -m integration
|
|
74
|
+
|
|
75
|
+
# Run with coverage report
|
|
76
|
+
pytest --cov=src/u2mcp --cov-report=html --cov-report=term-missing
|
|
77
|
+
|
|
78
|
+
# Run a specific test file
|
|
79
|
+
pytest tests/unit/test_device.py
|
|
80
|
+
|
|
81
|
+
# Run a specific test
|
|
82
|
+
pytest tests/unit/test_device.py::test_device_list
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Test Markers
|
|
86
|
+
|
|
87
|
+
We use pytest markers to categorize tests:
|
|
88
|
+
- `unit` - Unit tests (fast, no external dependencies)
|
|
89
|
+
- `integration` - Integration tests (require Android device)
|
|
90
|
+
- `slow` - Slow running tests
|
|
91
|
+
- `device` - Tests that require actual Android device
|
|
92
|
+
|
|
93
|
+
### Writing Tests
|
|
94
|
+
|
|
95
|
+
When adding new features, please include appropriate tests:
|
|
96
|
+
|
|
97
|
+
1. **Unit Tests:** Mock external dependencies (uiautomator2, adbutils)
|
|
98
|
+
```python
|
|
99
|
+
from unittest.mock import AsyncMock, MagicMock, patch
|
|
100
|
+
|
|
101
|
+
@pytest.mark.unit
|
|
102
|
+
async def test_my_tool(mock_u2_device: MagicMock):
|
|
103
|
+
# Arrange
|
|
104
|
+
mock_u2_device.some_method.return_value = "expected"
|
|
105
|
+
|
|
106
|
+
# Act
|
|
107
|
+
result = await my_tool(serial="test-device")
|
|
108
|
+
|
|
109
|
+
# Assert
|
|
110
|
+
assert result == "expected"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
2. **Integration Tests:** Test against real device (when applicable)
|
|
114
|
+
```python
|
|
115
|
+
@pytest.mark.integration
|
|
116
|
+
@pytest.mark.device
|
|
117
|
+
async def test_my_tool_real_device():
|
|
118
|
+
# This test requires a connected device
|
|
119
|
+
result = await my_tool(serial="emulator-5554")
|
|
120
|
+
assert result is not None
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Code Style
|
|
124
|
+
|
|
125
|
+
This project uses:
|
|
126
|
+
- **Ruff** for linting and formatting
|
|
127
|
+
- **mypy** for type checking
|
|
128
|
+
- **pre-commit** for automated checks
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Run linter
|
|
132
|
+
ruff check src/
|
|
133
|
+
|
|
134
|
+
# Auto-fix linting issues
|
|
135
|
+
ruff check --fix src/
|
|
136
|
+
|
|
137
|
+
# Format code
|
|
138
|
+
ruff format src/
|
|
139
|
+
|
|
140
|
+
# Type check
|
|
141
|
+
mypy src/
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Pre-commit hooks will automatically run these checks before each commit if you have them installed.
|
|
145
|
+
|
|
146
|
+
### Project Structure
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
src/u2mcp/
|
|
150
|
+
├── __init__.py # Package init, exports version info
|
|
151
|
+
├── __main__.py # Entry point for CLI commands
|
|
152
|
+
├── _version.py # Auto-generated version info (SCM)
|
|
153
|
+
├── mcp.py # MCP server factory and configuration
|
|
154
|
+
├── background.py # Background task management
|
|
155
|
+
├── health.py # ADB availability check
|
|
156
|
+
└── tools/
|
|
157
|
+
├── __init__.py # Tools registry
|
|
158
|
+
├── device.py # Device management tools
|
|
159
|
+
├── action.py # Touch/gesture tools
|
|
160
|
+
├── app.py # App management tools
|
|
161
|
+
├── clipboard.py # Clipboard read/write tools
|
|
162
|
+
├── element.py # Element/UI interaction tools
|
|
163
|
+
├── misc.py # Miscellaneous tools
|
|
164
|
+
└── scrcpy.py # Screen mirroring (scrcpy integration)
|
|
165
|
+
|
|
166
|
+
tests/
|
|
167
|
+
├── conftest.py # Pytest configuration and fixtures
|
|
168
|
+
├── unit/ # Fast unit tests
|
|
169
|
+
└── integration/ # Integration tests requiring real devices
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Adding New Tools
|
|
173
|
+
|
|
174
|
+
To add a new MCP tool:
|
|
175
|
+
|
|
176
|
+
1. **Choose the appropriate module** in `src/u2mcp/tools/` based on functionality
|
|
177
|
+
2. **Create the tool function** with appropriate type hints:
|
|
178
|
+
```python
|
|
179
|
+
from __future__ import annotations
|
|
180
|
+
from typing import Any
|
|
181
|
+
|
|
182
|
+
from u2mcp.mcp import mcp
|
|
183
|
+
from u2mcp.device import get_device
|
|
184
|
+
from anyio import to_thread
|
|
185
|
+
|
|
186
|
+
@mcp.tool("my_tool")
|
|
187
|
+
async def my_tool(serial: str, param: str) -> dict[str, Any]:
|
|
188
|
+
"""
|
|
189
|
+
Brief description of what the tool does.
|
|
190
|
+
|
|
191
|
+
Args:
|
|
192
|
+
serial: Device serial number
|
|
193
|
+
param: Description of parameter
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
Dictionary with result information
|
|
197
|
+
"""
|
|
198
|
+
async with get_device(serial) as device:
|
|
199
|
+
result = await to_thread.run_sync(lambda: device.some_method(param))
|
|
200
|
+
return {"result": result}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
3. **Add tests** for the new tool in `tests/unit/` or `tests/integration/`
|
|
204
|
+
4. **Update documentation** in [README.md](README.md) if needed
|
|
205
|
+
5. **Run tests and linting** to ensure everything passes
|
|
206
|
+
6. **Commit and create a pull request**
|
|
207
|
+
|
|
208
|
+
## Pull Request Process
|
|
209
|
+
|
|
210
|
+
1. **Create a new branch** from `main`:
|
|
211
|
+
```bash
|
|
212
|
+
git checkout -b feature/your-feature-name
|
|
213
|
+
# or
|
|
214
|
+
git checkout -b fix/your-bug-fix
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
2. **Make your changes** following the guidelines above
|
|
218
|
+
|
|
219
|
+
3. **Commit your changes** with clear, descriptive messages:
|
|
220
|
+
```bash
|
|
221
|
+
git add .
|
|
222
|
+
git commit -m "feat: add new tool for XYZ"
|
|
223
|
+
# Use conventional commits: feat:, fix:, docs:, chore:, etc.
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
4. **Push to your fork**:
|
|
227
|
+
```bash
|
|
228
|
+
git push origin feature/your-feature-name
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
5. **Create a Pull Request** on GitHub with:
|
|
232
|
+
- Clear title and description
|
|
233
|
+
- Reference related issues (if any)
|
|
234
|
+
- Screenshots or examples for UI changes (if applicable)
|
|
235
|
+
- Confirmation that all tests pass
|
|
236
|
+
- Confirmation that pre-commit hooks pass
|
|
237
|
+
|
|
238
|
+
### PR Review Checklist
|
|
239
|
+
|
|
240
|
+
Before submitting a PR, ensure:
|
|
241
|
+
- [ ] All tests pass (`pytest`)
|
|
242
|
+
- [ ] Code is formatted (`ruff format`)
|
|
243
|
+
- [ ] No linting errors (`ruff check`)
|
|
244
|
+
- [ ] Type checking passes (`mypy`)
|
|
245
|
+
- [ ] New features include tests
|
|
246
|
+
- [ ] Documentation is updated (if needed)
|
|
247
|
+
- [ ] Commit messages follow conventional commit format
|
|
248
|
+
|
|
249
|
+
## Release Process
|
|
250
|
+
|
|
251
|
+
Releases are managed by the maintainers through GitHub releases:
|
|
252
|
+
|
|
253
|
+
1. Maintainers create a new git tag following PEP 440 versioning
|
|
254
|
+
2. The CI pipeline automatically:
|
|
255
|
+
- Validates the tag format
|
|
256
|
+
- Runs all tests
|
|
257
|
+
- Builds the package
|
|
258
|
+
- Publishes to PyPI
|
|
259
|
+
|
|
260
|
+
Please don't create tags yourself unless you're a maintainer.
|
|
261
|
+
|
|
262
|
+
## Coverage Requirements
|
|
263
|
+
|
|
264
|
+
We aim to maintain good test coverage. Currently:
|
|
265
|
+
- CI runs coverage reports on all tests
|
|
266
|
+
- Coverage is uploaded to Codecov for tracking
|
|
267
|
+
|
|
268
|
+
**Goal:** We're working toward increasing coverage, especially in the `tools/` modules. Contributions that improve test coverage are highly appreciated!
|
|
269
|
+
|
|
270
|
+
## Getting Help
|
|
271
|
+
|
|
272
|
+
If you need help:
|
|
273
|
+
- Check existing [GitHub Issues](https://github.com/tanbro/uiautomator2-mcp-server/issues)
|
|
274
|
+
- Read the [README.md](README.md) for usage documentation
|
|
275
|
+
- Review existing tests for examples
|
|
276
|
+
- Ask questions in a new GitHub Issue with the `question` label
|
|
277
|
+
|
|
278
|
+
## License
|
|
279
|
+
|
|
280
|
+
By contributing to this project, you agree that your contributions will be licensed under the [GPL-3.0-or-later](LICENSE) license.
|
|
281
|
+
|
|
282
|
+
## Style Guidelines
|
|
283
|
+
|
|
284
|
+
### Python Code
|
|
285
|
+
|
|
286
|
+
- Use Python 3.11+ syntax
|
|
287
|
+
- All function signatures must include type hints
|
|
288
|
+
- Use `from __future__ import annotations` for deferred evaluation
|
|
289
|
+
- Use `typing_extensions` for compatibility with Python < 3.12
|
|
290
|
+
- Follow PEP 8 style guide (enforced by ruff)
|
|
291
|
+
|
|
292
|
+
### Documentation
|
|
293
|
+
|
|
294
|
+
- Use docstrings for all public functions, classes, and modules
|
|
295
|
+
- Keep docstrings clear and concise
|
|
296
|
+
- Update README.md when adding user-facing features
|
|
297
|
+
|
|
298
|
+
### Localization & Multi-language Policy
|
|
299
|
+
|
|
300
|
+
- Keep region-specific instructions (for example, Mainland China `pip`/`uv` mirror configuration) inside the corresponding language README (e.g., `README.zh-CN.md`).
|
|
301
|
+
- Do **not** duplicate region-only instructions into the English README. Instead, add a short navigation note in the English README pointing to the language specific file when appropriate (e.g., "See `README.zh-CN.md` for Mainland China-specific mirror instructions").
|
|
302
|
+
- Ensure translations are accurate and avoid adding region-specific content to all language files unless it is globally applicable.
|
|
303
|
+
|
|
304
|
+
### Async/Await
|
|
305
|
+
|
|
306
|
+
- Use `async/await` for all I/O operations
|
|
307
|
+
- Use `to_thread.run_sync()` for CPU-bound operations
|
|
308
|
+
- Use `get_device()` context manager for device access
|
|
309
|
+
|
|
310
|
+
Thank you for contributing to uiautomator2-mcp-server!
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2024-2025 tanbro
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|