pcloudy 0.1.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.
- pcloudy-0.1.0/PKG-INFO +471 -0
- pcloudy-0.1.0/README.md +456 -0
- pcloudy-0.1.0/pyproject.toml +26 -0
- pcloudy-0.1.0/setup.cfg +4 -0
- pcloudy-0.1.0/src/__init__.py +0 -0
- pcloudy-0.1.0/src/api/__init__.py +76 -0
- pcloudy-0.1.0/src/api/adb.py +85 -0
- pcloudy-0.1.0/src/api/app_management.py +137 -0
- pcloudy-0.1.0/src/api/auth.py +136 -0
- pcloudy-0.1.0/src/api/device.py +168 -0
- pcloudy-0.1.0/src/api/device_control.py +87 -0
- pcloudy-0.1.0/src/api/file_management.py +250 -0
- pcloudy-0.1.0/src/api/platform.py +66 -0
- pcloudy-0.1.0/src/api/qpilot_appium_control.py +37 -0
- pcloudy-0.1.0/src/api/qpilot_credits.py +29 -0
- pcloudy-0.1.0/src/api/qpilot_project.py +51 -0
- pcloudy-0.1.0/src/api/qpilot_script.py +40 -0
- pcloudy-0.1.0/src/api/qpilot_steps.py +30 -0
- pcloudy-0.1.0/src/api/qpilot_test_case.py +53 -0
- pcloudy-0.1.0/src/api/qpilot_test_suite.py +51 -0
- pcloudy-0.1.0/src/api/services.py +86 -0
- pcloudy-0.1.0/src/api/session.py +216 -0
- pcloudy-0.1.0/src/config.py +40 -0
- pcloudy-0.1.0/src/mcp_server/__init__.py +1 -0
- pcloudy-0.1.0/src/mcp_server/server_main.py +66 -0
- pcloudy-0.1.0/src/mcp_server/shared_mcp.py +4 -0
- pcloudy-0.1.0/src/mcp_server/tools/appium_actions.py +241 -0
- pcloudy-0.1.0/src/mcp_server/tools/appium_sdk.py +242 -0
- pcloudy-0.1.0/src/mcp_server/tools/device_management.py +165 -0
- pcloudy-0.1.0/src/mcp_server/tools/device_services.py +78 -0
- pcloudy-0.1.0/src/mcp_server/tools/files.py +103 -0
- pcloudy-0.1.0/src/mcp_server/tools/get_code.py +43 -0
- pcloudy-0.1.0/src/mcp_server/tools/qpilot.py +120 -0
- pcloudy-0.1.0/src/mcp_server/tools/qpilotcredit.py +29 -0
- pcloudy-0.1.0/src/mcp_server/tools/session_data.py +71 -0
- pcloudy-0.1.0/src/mcp_server/tools/test_case.py +49 -0
- pcloudy-0.1.0/src/mcp_server/tools/test_project.py +44 -0
- pcloudy-0.1.0/src/mcp_server/tools/test_suite.py +43 -0
- pcloudy-0.1.0/src/pcloudy.egg-info/PKG-INFO +471 -0
- pcloudy-0.1.0/src/pcloudy.egg-info/SOURCES.txt +55 -0
- pcloudy-0.1.0/src/pcloudy.egg-info/dependency_links.txt +1 -0
- pcloudy-0.1.0/src/pcloudy.egg-info/entry_points.txt +2 -0
- pcloudy-0.1.0/src/pcloudy.egg-info/requires.txt +8 -0
- pcloudy-0.1.0/src/pcloudy.egg-info/top_level.txt +6 -0
- pcloudy-0.1.0/src/security.py +56 -0
- pcloudy-0.1.0/src/utils.py +39 -0
- pcloudy-0.1.0/tests/test_adb_prefix.py +37 -0
- pcloudy-0.1.0/tests/test_api_adb.py +41 -0
- pcloudy-0.1.0/tests/test_appium_capabilities.py +62 -0
- pcloudy-0.1.0/tests/test_appium_sdk.py +63 -0
- pcloudy-0.1.0/tests/test_auth.py +19 -0
- pcloudy-0.1.0/tests/test_book_device.py +26 -0
- pcloudy-0.1.0/tests/test_get_devices_list.py +22 -0
- pcloudy-0.1.0/tests/test_release_device.py +31 -0
- pcloudy-0.1.0/tests/test_services.py +28 -0
- pcloudy-0.1.0/tests/test_start_performance_data.py +25 -0
- pcloudy-0.1.0/tests/test_startup.py +84 -0
pcloudy-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pcloudy
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: pCloudy MCP Server: Category-based FastMCP tools for device, app, session, Appium automation, and analytics management.
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: aiofiles>=24.1.0
|
|
8
|
+
Requires-Dist: fastapi>=0.115.1
|
|
9
|
+
Requires-Dist: fastmcp>=2.5.1
|
|
10
|
+
Requires-Dist: httpx>=0.27.0
|
|
11
|
+
Requires-Dist: pytest>=8.0.0
|
|
12
|
+
Requires-Dist: pytest-asyncio>=0.23.0
|
|
13
|
+
Requires-Dist: python-dotenv>=1.0.1
|
|
14
|
+
Requires-Dist: appium-python-client>=3.1.0
|
|
15
|
+
|
|
16
|
+
# pCloudy MCP Server (Simplified Action-Based Architecture)
|
|
17
|
+
|
|
18
|
+
This project implements a streamlined MCP server for managing Android and iOS devices on the pCloudy platform. It features a **simplified action-based tool architecture** with clean, intuitive tool names that replace complex naming conventions. The server includes Appium SDK integration, QPilot automation, and comprehensive device management capabilities.
|
|
19
|
+
|
|
20
|
+
**Author**: Rishav Raj
|
|
21
|
+
|
|
22
|
+
## 🎯 Simplified Action-Based Tool Architecture
|
|
23
|
+
|
|
24
|
+
### 📱 Device Management (`device_management`)
|
|
25
|
+
|
|
26
|
+
**Actions**: `list`, `book`, `release`, `detect_platform`, `set_location`
|
|
27
|
+
|
|
28
|
+
- **list**: List available devices (`platform="android"`/`"ios"`)
|
|
29
|
+
- **book**: Book device (`device_name="GalaxyS10"`, `platform="android"`, `auto_start_services=True`)
|
|
30
|
+
- **release**: Release device (`rid="device_id"`)
|
|
31
|
+
- **detect_platform**: Auto-detect device platform (`rid="device_id"`)
|
|
32
|
+
- **set_location**: Set GPS coordinates (`rid="device_id"`, `latitude=48.8566`, `longitude=2.3522`)
|
|
33
|
+
|
|
34
|
+
### � Device Services (`device_services`)
|
|
35
|
+
|
|
36
|
+
**Actions**: `screenshot`, `get_url`, `start_services`, `adb`
|
|
37
|
+
|
|
38
|
+
- **screenshot**: Capture device screenshot (`rid="device_id"`, `skin=True`)
|
|
39
|
+
- **get_url**: Get device page URL and open in browser (`rid="device_id"`)
|
|
40
|
+
- **start_services**: Start device services (`rid="device_id"`, `start_device_logs=True`, `start_performance_data=True`, `start_session_recording=True`)
|
|
41
|
+
- **adb**: Execute ADB command on Android (`rid="device_id"`, `adb_command="logcat"`, `platform="auto"`)
|
|
42
|
+
|
|
43
|
+
### 📦 Files (`files`)
|
|
44
|
+
|
|
45
|
+
**Actions**: `upload`, `list_apps`, `install`, `resign`, `download_cloud`
|
|
46
|
+
|
|
47
|
+
- **upload**: Upload APK/IPA file (`file_path="/path/to/app.apk"`, `force_upload=False`)
|
|
48
|
+
- **list_apps**: List cloud apps (`limit=10`, `filter_type="all"`)
|
|
49
|
+
- **install**: Install and launch app (`rid="device_id"`, `filename="app.apk"`, `grant_all_permissions=True`, `platform="android"`, `app_package_name="com.example.app"`)
|
|
50
|
+
- **resign**: Resign iOS IPA file (`filename="app.ipa"`, `force_resign=False`)
|
|
51
|
+
- **download_cloud**: Download file from cloud (`filename="app.apk"`)
|
|
52
|
+
|
|
53
|
+
### 📊 Session Data (`session_data`)
|
|
54
|
+
|
|
55
|
+
**Actions**: `download_file`, `list_performance`
|
|
56
|
+
|
|
57
|
+
- **download_file**: Download session data (`rid="device_id"`, `filename="optional_specific_file"`, `save_to_disk=True`, `custom_path="optional_directory"`)
|
|
58
|
+
- **list_performance**: List performance data files (`rid="device_id"`)
|
|
59
|
+
|
|
60
|
+
### 🤖 Appium SDK (`appium_sdk`)
|
|
61
|
+
|
|
62
|
+
**Actions**: `get_capabilities`, `setup_appium`
|
|
63
|
+
|
|
64
|
+
- **get_capabilities**: Generate Appium capabilities boilerplate (`language="python"`, `device_name="optional"`)
|
|
65
|
+
- **setup_appium**: Setup Appium environment with capabilities (`language="java"`, `device_name="GalaxyS10"`)
|
|
66
|
+
|
|
67
|
+
### 🚀 QPilot Tools
|
|
68
|
+
|
|
69
|
+
#### QPilot Credits (`qpilotcredit`)
|
|
70
|
+
|
|
71
|
+
- Get remaining QPilot credits for code generation
|
|
72
|
+
|
|
73
|
+
#### Test Project (`test_project`)
|
|
74
|
+
|
|
75
|
+
**Actions**: `create`, `list`
|
|
76
|
+
|
|
77
|
+
- **create**: Create new test project (`project_name="MyProject"`)
|
|
78
|
+
- **list**: List all test projects
|
|
79
|
+
|
|
80
|
+
#### Test Suite (`test_suite`)
|
|
81
|
+
|
|
82
|
+
**Actions**: `create`, `list`
|
|
83
|
+
|
|
84
|
+
- **create**: Create new test suite (`suite_name="MySuite"`)
|
|
85
|
+
- **list**: List all test suites
|
|
86
|
+
|
|
87
|
+
#### Test Case (`test_case`)
|
|
88
|
+
|
|
89
|
+
**Actions**: `create`, `list`
|
|
90
|
+
|
|
91
|
+
- **create**: Create new test case (`testSuiteId="123"`, `testCaseName="MyTest"`, `platform="android"`)
|
|
92
|
+
- **list**: List all test cases
|
|
93
|
+
|
|
94
|
+
#### QPilot Code Generation (`qpilot`)
|
|
95
|
+
|
|
96
|
+
- Generate QPilot automation code steps (`rid="device_id"`, `description="Test description"`, `steps="Step instructions"`)
|
|
97
|
+
|
|
98
|
+
#### Get Code (`get_code`)
|
|
99
|
+
|
|
100
|
+
- Retrieve generated QPilot script code (`hostname="device.pcloudy.com"`, `testCaseId="123"`, `testSuiteId="456"`, `scriptType="pcloudy_appium-js"`)
|
|
101
|
+
|
|
102
|
+
## 📋 Usage Examples
|
|
103
|
+
|
|
104
|
+
### 🔄 Complete Testing Workflow
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
# 1. List available devices
|
|
108
|
+
device_management(action="list", platform="android")
|
|
109
|
+
|
|
110
|
+
# 2. Book a device
|
|
111
|
+
device_management(action="book", device_name="GalaxyS10")
|
|
112
|
+
|
|
113
|
+
# 3. Set GPS location for location-based testing
|
|
114
|
+
device_management(action="set_location", rid="123", latitude=48.8566, longitude=2.3522)
|
|
115
|
+
|
|
116
|
+
# 4. Install and launch app (auto-opens device in browser)
|
|
117
|
+
files(action="install", rid="123", filename="MyApp.apk")
|
|
118
|
+
|
|
119
|
+
# 5. Take a screenshot
|
|
120
|
+
device_services(action="screenshot", rid="123")
|
|
121
|
+
|
|
122
|
+
# 6. Download session data
|
|
123
|
+
session_data(action="download_file", rid="123")
|
|
124
|
+
|
|
125
|
+
# 7. Release device
|
|
126
|
+
device_management(action="release", rid="123")
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 📱 iOS App Testing
|
|
130
|
+
|
|
131
|
+
```python
|
|
132
|
+
# 1. Upload iOS app
|
|
133
|
+
files(action="upload", file_path="MyApp.ipa")
|
|
134
|
+
|
|
135
|
+
# 2. Resign the IPA for deployment
|
|
136
|
+
files(action="resign", filename="MyApp.ipa")
|
|
137
|
+
|
|
138
|
+
# 3. Book iOS device
|
|
139
|
+
device_management(action="book", device_name="iPhone", platform="ios")
|
|
140
|
+
|
|
141
|
+
# 4. Install resigned app
|
|
142
|
+
files(action="install", rid="123", filename="MyApp_resign.ipa")
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### 🐛 Android Debugging
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
# 1. Book Android device
|
|
149
|
+
device_management(action="book", device_name="Pixel")
|
|
150
|
+
|
|
151
|
+
# 2. Execute ADB commands
|
|
152
|
+
device_services(action="adb", rid="123", adb_command="logcat")
|
|
153
|
+
|
|
154
|
+
# 3. List performance data
|
|
155
|
+
session_data(action="list_performance", rid="123")
|
|
156
|
+
|
|
157
|
+
# 4. Download specific log files
|
|
158
|
+
session_data(action="download_file", rid="123", filename="specific_log.txt")
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 🤖 Appium SDK Integration
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
# Generate Appium capabilities for a booked device and uploaded app
|
|
165
|
+
appium_sdk(action="get_capabilities", language="python")
|
|
166
|
+
|
|
167
|
+
# Setup Appium environment
|
|
168
|
+
appium_sdk(action="setup_appium", language="java", device_name="GalaxyS10")
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 🚀 QPilot Automation Workflow
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
# 1. Check QPilot credits
|
|
175
|
+
qpilotcredit()
|
|
176
|
+
|
|
177
|
+
# 2. Create test project
|
|
178
|
+
test_project(action="create", project_name="MyAutomationProject")
|
|
179
|
+
|
|
180
|
+
# 3. Create test suite
|
|
181
|
+
test_suite(action="create", suite_name="LoginTestSuite")
|
|
182
|
+
|
|
183
|
+
# 4. Create test case
|
|
184
|
+
test_case(action="create", testSuiteId="456", testCaseName="ValidLogin", platform="android")
|
|
185
|
+
|
|
186
|
+
# 5. Generate QPilot automation code
|
|
187
|
+
qpilot(rid="123", description="Login test automation", steps="Open app, enter credentials, tap login")
|
|
188
|
+
|
|
189
|
+
# 6. Get generated code
|
|
190
|
+
get_code(hostname="device.pcloudy.com", testCaseId="789", testSuiteId="456", scriptType="pcloudy_appium-js")
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Setup
|
|
194
|
+
|
|
195
|
+
1. **Clone the repository:**
|
|
196
|
+
|
|
197
|
+
```powershell
|
|
198
|
+
git clone <repository_url>
|
|
199
|
+
cd <repository_directory>
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
2. **Create a virtual environment:**
|
|
203
|
+
|
|
204
|
+
```powershell
|
|
205
|
+
python3.13 -m venv .venv
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
3. **Activate the virtual environment:**
|
|
209
|
+
- **Windows (PowerShell):**
|
|
210
|
+
|
|
211
|
+
```powershell
|
|
212
|
+
.venv\Scripts\Activate.ps1
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
- **Linux/macOS:**
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
source .venv/bin/activate
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
4. **Install dependencies:**
|
|
222
|
+
The project requires the following Python packages (see `pyproject.toml`):
|
|
223
|
+
- `aiofiles`
|
|
224
|
+
- `fastapi`
|
|
225
|
+
- `fastmcp`
|
|
226
|
+
- `python-dotenv`
|
|
227
|
+
|
|
228
|
+
Install them using pip:
|
|
229
|
+
|
|
230
|
+
```powershell
|
|
231
|
+
pip install aiofiles fastapi fastmcp python-dotenv
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Or, if you use Poetry or uv:
|
|
235
|
+
|
|
236
|
+
```powershell
|
|
237
|
+
poetry install
|
|
238
|
+
# OR
|
|
239
|
+
uv sync
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
5. **pCloudy API Credentials:**
|
|
243
|
+
- Copy `.env.template` to `.env` and fill in your credentials.
|
|
244
|
+
- The server uses a browser-based authentication flow. You'll be prompted to enter your pCloudy `username` and `api_key` when running any tool if not set in `.env`.
|
|
245
|
+
|
|
246
|
+
## Running the MCP Server
|
|
247
|
+
|
|
248
|
+
### 🚀 **Universal Startup (Recommended)**
|
|
249
|
+
|
|
250
|
+
The easiest way to start the server on **any platform** (Windows, macOS, Linux):
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
python start_server.py
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
This script automatically:
|
|
257
|
+
|
|
258
|
+
- Detects your operating system and Python installation
|
|
259
|
+
- Tries multiple methods: uv → direct python → pip install + run
|
|
260
|
+
- Installs missing dependencies automatically
|
|
261
|
+
- Provides helpful error messages and guidance
|
|
262
|
+
|
|
263
|
+
### ⚙️ **Manual Methods (Advanced)**
|
|
264
|
+
|
|
265
|
+
If you prefer to run the server manually:
|
|
266
|
+
|
|
267
|
+
#### Using uv (recommended if installed)
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
uv run --with fastmcp fastmcp run src/mcp_server/server_main.py
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
#### Using FastMCP directly
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
fastmcp dev src/mcp_server/server_main.py
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
#### Direct Python execution
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
python src/mcp_server/server_main.py
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
The server will listen on `http://localhost:8000` by default (port can be changed via the `PORT` environment variable).
|
|
286
|
+
|
|
287
|
+
## ✅ Enhanced Features
|
|
288
|
+
|
|
289
|
+
### 🎯 Category-Based Architecture Benefits
|
|
290
|
+
|
|
291
|
+
- **Simplified Interface**: 4 meta-tools instead of 17 individual tools
|
|
292
|
+
- **Logical Grouping**: Related operations organized under single tools
|
|
293
|
+
- **Intelligent Routing**: System automatically selects correct method based on action
|
|
294
|
+
- **Cleaner Documentation**: Easier to understand and maintain
|
|
295
|
+
- **Better User Experience**: Less tool discovery, more focused workflows
|
|
296
|
+
|
|
297
|
+
### 🚀 Smart Automation
|
|
298
|
+
|
|
299
|
+
- **Auto-Authentication**: Seamless authentication across all operations
|
|
300
|
+
- **Auto-Service Startup**: Device booking automatically starts logs, performance data, and session recording
|
|
301
|
+
- **Auto-Browser Opening**: App installation and device URL requests automatically open in browser
|
|
302
|
+
- **Auto-Platform Detection**: ADB commands automatically detect device platform
|
|
303
|
+
- **Auto-Session Discovery**: Device release automatically prompts for session data download
|
|
304
|
+
|
|
305
|
+
### 🔧 Advanced Capabilities
|
|
306
|
+
|
|
307
|
+
- **GPS Location Setting**: Simulate location-based testing with precise coordinates
|
|
308
|
+
- **Unified Download System**: Single function handles both individual files and bulk session downloads
|
|
309
|
+
- **iOS App Resigning**: Automatic IPA resigning for iOS deployment
|
|
310
|
+
- **Performance Monitoring**: Real-time performance data collection during app testing
|
|
311
|
+
- **ADB Command Execution**: Full Android debugging capabilities with safety checks
|
|
312
|
+
- **Appium Capabilities Generation**: Instantly generate Appium capabilities for your automation scripts
|
|
313
|
+
|
|
314
|
+
### 🛡️ Security & Validation
|
|
315
|
+
|
|
316
|
+
- **Input Validation**: Comprehensive validation for all parameters
|
|
317
|
+
- **Path Security**: Download directory validation prevents security issues
|
|
318
|
+
- **Platform Compatibility**: Automatic platform detection prevents incompatible operations
|
|
319
|
+
- **Error Handling**: Detailed error messages and graceful failure handling
|
|
320
|
+
|
|
321
|
+
## 📁 Project File Structure
|
|
322
|
+
|
|
323
|
+
The project is organized as follows:
|
|
324
|
+
|
|
325
|
+
```text
|
|
326
|
+
Pcloudy/
|
|
327
|
+
├── .env # Your pCloudy credentials (not committed)
|
|
328
|
+
├── .env.template # Example template for .env
|
|
329
|
+
├── pcloudy_mcp_server.log # Log file for server activity
|
|
330
|
+
├── pyproject.toml # Project metadata and dependencies
|
|
331
|
+
├── README.md # Project documentation
|
|
332
|
+
├── uv.lock # UV lock file for dependency management
|
|
333
|
+
├── src/ # All source code
|
|
334
|
+
│ ├── __init__.py # Package initialization
|
|
335
|
+
│ ├── config.py # Configuration and logging setup
|
|
336
|
+
│ ├── security.py # Security utilities
|
|
337
|
+
│ ├── utils.py # General utility functions
|
|
338
|
+
│ ├── api/ # API classes for pCloudy endpoints
|
|
339
|
+
│ │ ├── __init__.py # API package initialization
|
|
340
|
+
│ │ ├── auth.py # Authentication logic (Auth class)
|
|
341
|
+
│ │ ├── device.py # Device management (Device class)
|
|
342
|
+
│ │ ├── adb.py # ADB command handling (Adb class)
|
|
343
|
+
│ │ ├── app_management.py # App installation and management (AppManagement class)
|
|
344
|
+
│ │ ├── device_control.py # Device control operations (DeviceControl class)
|
|
345
|
+
│ │ ├── file_management.py # File upload/download (FileManagement class)
|
|
346
|
+
│ │ ├── platform.py # Platform detection (Platform class)
|
|
347
|
+
│ │ ├── services.py # Device services management (Services class)
|
|
348
|
+
│ │ ├── session.py # Session data handling (Session class)
|
|
349
|
+
│ │ └── qpilot_*.py # QPilot-related API classes
|
|
350
|
+
│ └── mcp_server/ # Main server and tool definitions
|
|
351
|
+
│ ├── __init__.py # MCP server package initialization
|
|
352
|
+
│ ├── server_main.py # Main entry point for FastMCP server
|
|
353
|
+
│ ├── shared_mcp.py # Shared FastMCP instance
|
|
354
|
+
│ └── tools/ # Simplified action-based tool implementations
|
|
355
|
+
│ ├── device_management.py # Device management operations
|
|
356
|
+
│ ├── device_services.py # Device control and monitoring
|
|
357
|
+
│ ├── files.py # File and app management
|
|
358
|
+
│ ├── session_data.py # Session data operations
|
|
359
|
+
│ ├── appium_sdk.py # Appium SDK integration
|
|
360
|
+
│ ├── qpilotcredit.py # QPilot credits
|
|
361
|
+
│ ├── test_project.py # Test project management
|
|
362
|
+
│ ├── test_suite.py # Test suite management
|
|
363
|
+
│ ├── test_cases.py # Test case management
|
|
364
|
+
│ ├── qpilot.py # QPilot code generation
|
|
365
|
+
│ └── get_code.py # QPilot script retrieval
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
- **.env**: Your pCloudy credentials and environment variables. Use `.env.template` as a starting point.
|
|
369
|
+
- **src/api/**: Contains clean API classes for each pCloudy API area (no more "Mixin" suffixes).
|
|
370
|
+
- **src/mcp_server/tools/**: Each simplified tool with action-based operations.
|
|
371
|
+
- **Token Persistence**: Authentication tokens are automatically saved to `Downloads/pCloudy_Downloads/` with base64 encoding.
|
|
372
|
+
- **src/mcp_server/server_main.py**: The main entry point that registers all tools and starts the FastMCP server.
|
|
373
|
+
- **config.py, utils.py, security.py**: Shared configuration, utility, and security logic.
|
|
374
|
+
- **pcloudy_mcp_server.log**: All logs are written here for debugging and audit.
|
|
375
|
+
|
|
376
|
+
This structure keeps configuration, API logic, and tool implementations modular and easy to maintain.
|
|
377
|
+
|
|
378
|
+
## Notes
|
|
379
|
+
|
|
380
|
+
- **Python Version**: Requires Python 3.13.
|
|
381
|
+
On Ubuntu, you might use:
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
sudo apt install python3.13 python3.13-venv python3.13-dev
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
- **Logs**: Log messages are saved in `pcloudy_mcp_server.log`. Check this file for detailed error messages if issues occur.
|
|
388
|
+
- **Environment**: Place your `.env` file in the project root. Use `.env.template` as a starting point.
|
|
389
|
+
- **Security**: Ensure you secure your credentials. The server runs a local HTTP server on `localhost` for authentication, which shuts down after use. For production, consider using HTTPS and additional security measures.
|
|
390
|
+
- **Troubleshooting**:
|
|
391
|
+
- **Import Errors**: If you encounter "ModuleNotFoundError", ensure you're running the server from the project root directory.
|
|
392
|
+
- **Python Path Issues**: The project includes automatic path resolution for module imports.
|
|
393
|
+
- Verify your network access to `https://device.pcloudy.com/api`.
|
|
394
|
+
- Ensure your pCloudy `username` and `api_key` are correct when prompted during authentication.
|
|
395
|
+
- If authentication fails, check `pcloudy_mcp_server.log` for the raw API response to diagnose the issue (e.g., invalid credentials or API errors).
|
|
396
|
+
- If you encounter port conflicts (e.g., on port 8080 used for authentication), the server will automatically retry with the next available port.
|
|
397
|
+
- For performance data issues, ensure the package name is correct and the app is installed and running.
|
|
398
|
+
- Use `device_management(action="detect_platform", rid="device_id")` if unsure about device platform compatibility.
|
|
399
|
+
- **Windows Users**: Use PowerShell commands as shown in the setup instructions.
|
|
400
|
+
|
|
401
|
+
## Migration from Previous Version
|
|
402
|
+
|
|
403
|
+
If upgrading from the previous complex naming architecture:
|
|
404
|
+
|
|
405
|
+
**Old Approach:**
|
|
406
|
+
|
|
407
|
+
```python
|
|
408
|
+
list_available_devices(platform="android")
|
|
409
|
+
book_device_by_name(device_name="GalaxyS10")
|
|
410
|
+
capture_device_screenshot(rid="123")
|
|
411
|
+
file_app_management(action="upload", file_path="app.apk")
|
|
412
|
+
session_analytics(action="download_session", rid="123")
|
|
413
|
+
appium_capabilities(language="python")
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**New Simplified Approach:**
|
|
417
|
+
|
|
418
|
+
```python
|
|
419
|
+
device_management(action="list", platform="android")
|
|
420
|
+
device_management(action="book", device_name="GalaxyS10")
|
|
421
|
+
device_services(action="screenshot", rid="123")
|
|
422
|
+
files(action="upload", file_path="app.apk")
|
|
423
|
+
session_data(action="download_file", rid="123")
|
|
424
|
+
appium_sdk(action="get_capabilities", language="python")
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
The new approach provides the same functionality with cleaner, more intuitive tool names.
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
## 🔄 Recent Updates (July 9, 2025)
|
|
432
|
+
|
|
433
|
+
### ✅ Major Refactoring & Simplification
|
|
434
|
+
|
|
435
|
+
- **Simplified Tool Names**: Removed complex suffixes and adopted clean, action-based naming
|
|
436
|
+
- `device_control_tool` → `device_services`
|
|
437
|
+
- `file_app_management_tool` → `files`
|
|
438
|
+
- `session_analytics_tool` → `session_data`
|
|
439
|
+
- `appium_capabilities_tool` → `appium_sdk`
|
|
440
|
+
- And many more...
|
|
441
|
+
|
|
442
|
+
- **Removed "Mixin" Suffixes**: All API classes now have clean names
|
|
443
|
+
- `AuthMixin` → `Auth`
|
|
444
|
+
- `DeviceMixin` → `Device`
|
|
445
|
+
- `FileManagementMixin` → `FileManagement`
|
|
446
|
+
- All 16 API classes simplified
|
|
447
|
+
|
|
448
|
+
- **Enhanced Token Persistence**: Authentication tokens now persist in Downloads/pCloudy_Downloads/ with base64 encoding
|
|
449
|
+
- **Cache Prevention**: Added `sys.dont_write_bytecode = True` to prevent `__pycache__` directories
|
|
450
|
+
- **QPilot Integration**: Complete QPilot workflow support with dedicated tools
|
|
451
|
+
- **Appium SDK Actions**: Enhanced Appium integration with `get_capabilities` and `setup_appium` actions
|
|
452
|
+
|
|
453
|
+
### 🏗️ Architecture Improvements
|
|
454
|
+
|
|
455
|
+
- **Action-Based Design**: All tools follow consistent action parameter patterns
|
|
456
|
+
- **Simplified Imports**: Clean, organized import structure in server_main.py
|
|
457
|
+
- **No Functional Changes**: All features work exactly the same with better names
|
|
458
|
+
- **Improved Documentation**: Updated examples and usage patterns throughout
|
|
459
|
+
|
|
460
|
+
### 🛡️ Enhanced Features
|
|
461
|
+
|
|
462
|
+
- **Token Persistence**: Automatic token saving/loading from disk
|
|
463
|
+
- **Better Error Handling**: Improved error messages and validation
|
|
464
|
+
- **Cross-Platform Support**: Enhanced Windows PowerShell compatibility
|
|
465
|
+
- **Modular Design**: Clean separation between API logic and MCP tools
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## Updated: July 9, 2025
|
|
470
|
+
|
|
471
|
+
Major refactoring with simplified action-based architecture, removed "Mixin" suffixes, enhanced QPilot integration, and improved token persistence for better developer experience.
|