Skip to content

Commit 17c7c2d

Browse files
committed
Updated readme for MCP server.
1 parent 99a0adf commit 17c7c2d

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Lets you run Python scripts with or without included binaries on Android.
1212
<img src="https://github.com/user-attachments/assets/1e996b5f-02e5-46bd-9ff4-78bb886bd410" alt="AutoPie extras config" width="47%" height="auto">
1313
</div>
1414

15+
16+
1517
## Installation
1618

1719
1) Build from source yourself or get the prebuilt APK from the releases section.
@@ -21,12 +23,63 @@ Lets you run Python scripts with or without included binaries on Android.
2123
5) AutoPie will try to download an init binary & configuration archive and extract it into the `AutoSec` directory. If it fails, you can download the `autosec.tar.xz` file and extract to the `AutoSec` folder.
2224
6) Optional: Disable Battery Optimization for AutoPie.
2325

26+
2427
## Usage
2528

2629
1) Open AutoPie App
2730
2) There are currently two types of commands. `Share Sheet Commands`, `Folder Observer Commands` and `Cron Commands`.
2831
3) Add your desired Commands in the AutoPie App by clicking on Add Button or Edit an already existing command.
2932

33+
34+
## New MCP Server
35+
AutoPie now comes with your own MCP server that you can use to automate your phone with AI Tools.
36+
37+
The server is easily extensible by adding your scripts to the /ExternalStorage/AutoSec/mcp_modules folder.
38+
39+
The scripts inside this folder will be included as tools in the MCP server.
40+
41+
You can add any kind of functionality on your phone with this by just writing a Python script.
42+
43+
The MCP tool scripts should be in this format.
44+
45+
```py
46+
import os
47+
from typing import Dict, Any
48+
from pydantic import BaseModel
49+
50+
class CreateFileInput(BaseModel):
51+
filepath: str
52+
content: str
53+
54+
55+
class MCPTool:
56+
path = "/create_file"
57+
name = "create_text_file"
58+
methods=["POST"]
59+
60+
async def run(self, input: CreateFileInput) -> Dict[str, Any]:
61+
"""Creates a text file with the specified content."""
62+
try:
63+
# Create directory if it doesn't exist
64+
os.makedirs(os.path.dirname(os.path.abspath(input.filepath)), exist_ok=True)
65+
66+
# Write content to file
67+
with open(input.filepath, "w") as f:
68+
f.write(input.content)
69+
70+
return {
71+
"status": "success",
72+
"message": f"File '{input.filepath}' created successfully"
73+
}
74+
except Exception as e:
75+
return {
76+
"status": "error",
77+
"message": f"Failed to create file: {str(e)}"
78+
}
79+
80+
```
81+
82+
3083
## Troubleshooting
3184
* Check that the `AutoSec` folder contains `observers.json` for Folder Observation Automation, `shares.json` for Share Sheet Configuration and `cron.json` for Cron Configuration. And a `bin` folder with the binaries like `ffmpeg`.
3285

0 commit comments

Comments
 (0)