Model Context Protocol server for Mahoraga - AI-powered mobile automation agent
Project description
Mahoraga MCP - AI-Powered Mobile Automation
A Model Context Protocol (MCP) server for mobile automation testing with Mahoraga. Control Android devices and run automated tests from any MCP-compatible host using natural language.
Features
- ๐ค AI-Powered Automation: Control your Android device using plain English
- ๐ฑ Device Connection: Works with emulators and physical devices
- โ๏ธ Flexible Configuration: Customize AI model, temperature, vision, reasoning, and more
- ๐ Real-Time Execution: Live progress streaming during task execution
- ๐ฏ Suite Execution: Run multiple tasks in sequence with retry logic
- ๐ Usage Tracking: Monitor API costs and token usage
- ๐ Secure: API key authentication via Mahoraga platform
Installation
pip install mahoraga-mcp
All dependencies (including ADB tools, LLM frameworks, and image processing) are automatically installed.
Quick Start
1. Get Your API Key
- Visit mahoraga.app (or your deployment URL)
- Sign in with Google
- Go to Dashboard โ API Keys
- Create a new API key
2. Add to Your MCP Host
Mahoraga MCP works with any MCP-compatible host. Use your host's CLI to add it:
Claude Code
claude mcp add mahoraga mahoraga-mcp
Amp
amp mcp add mahoraga -- mahoraga-mcp
VS Code (Cline)
code --add-mcp '{"name":"mahoraga","command":"mahoraga-mcp"}'
Manual Configuration
If your MCP host doesn't have a CLI, manually add to config file:
Config file locations:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"mahoraga": {
"command": "mahoraga-mcp"
}
}
}
Then restart your MCP host.
3. Start Automating
Ask your AI assistant (via your MCP host):
"Setup Mahoraga and connect to my Android device"
"Configure with my API key: mhg_xxxx..."
"Execute task: Open Settings and enable WiFi"
Available Tools
1. build
Setup and verify all dependencies.
Example:
Can you run the build tool to setup my system for Mahoraga?
2. connect
Connect to an Android device or emulator.
Parameters:
device_serial(optional): Device serial number
Example:
Connect to my Android device
3. configure
Configure agent execution parameters.
Parameters:
mahoraga_api_key: Your Mahoraga API key from the web portalmodel: LLM model (e.g., "anthropic/claude-sonnet-4", "openai/gpt-4o")temperature: 0-2 (default: 0.2)max_steps: Maximum execution steps (default: 15)vision: Enable screenshots (default: false)reasoning: Enable multi-step planning (default: false)reflection: Enable self-improvement (default: false)debug: Verbose logging (default: false)
Example:
Configure Mahoraga with my API key mhg_xxx, use Claude Sonnet 4, and enable vision
4. execute
Run an automation task on the device.
Parameters:
task: Natural language task description
Example:
Execute task: Open Settings and navigate to WiFi settings
5. runsuite
Execute multiple tasks in sequence with retry logic.
Parameters:
suite_name: Name of the test suitetasks: Array of tasks with retry and failure handling options
Example:
Run a test suite with these tasks: [
{"prompt": "Open Settings", "type": "setup"},
{"prompt": "Enable WiFi", "type": "test", "retries": 2},
{"prompt": "Close Settings", "type": "teardown"}
]
6. usage
View API usage statistics and costs.
Example:
Show me my Mahoraga usage statistics
Complete Workflow Example
User: "Setup Mahoraga on my machine"
โ Runs build tool
โ Returns: All dependencies installed โ
User: "Connect to my Android emulator"
โ Runs connect tool
โ Returns: Connected to emulator-5554 โ
User: "Configure to use Claude Sonnet 4 with vision and my API key is mhg_xxx..."
โ Runs configure tool
โ Returns: Configuration set โ
User: "Execute task: Open Instagram and go to my profile"
โ Runs execute tool with live streaming
โ Returns: Task completed โ
User: "Show me my usage statistics"
โ Runs usage tool
โ Returns: Total cost: $0.15, 10 executions โ
Requirements
- Python 3.11+ - Required for the MCP server
- Android Device - Emulator or physical device with USB debugging enabled
- Mahoraga API Key - Get from mahoraga.app
Dependencies automatically installed:
- Android Debug Bridge (ADB) - via
adbutils - Mahoraga Portal APK - via
apkutils - LLM frameworks - via
llama-index - Image processing - via
pillow
Architecture
mahoraga-mcp/
โโโ src/
โ โโโ server.py # Main MCP server entry point
โ โโโ backend_client.py # API communication with Mahoraga platform
โ โโโ llm_wrapper.py # LLM integration layer
โ โโโ state.py # Session state management
โ โโโ usage_tracker.py # Usage and cost tracking
โ โโโ tools/
โ โโโ build.py # Dependency checker and installer
โ โโโ connect.py # Device connectivity
โ โโโ configure.py # Agent configuration
โ โโโ execute.py # Task execution
โ โโโ runsuite.py # Suite execution
โ โโโ usage.py # Usage statistics
โโโ pyproject.toml
Troubleshooting
"No devices found"
- Start Android emulator via Android Studio > AVD Manager
- Connect physical device with USB debugging enabled
- For WiFi debugging:
adb tcpip 5555 && adb connect <device-ip>:5555
"Portal not ready"
- The
connecttool automatically installs the Portal APK - If it fails, manually enable the Mahoraga Portal accessibility service in Settings > Accessibility
"Invalid API key"
- Make sure you've run
configurewith a valid API key from mahoraga.app - API keys start with
mhg_prefix - Check your API key hasn't been revoked in the web portal
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mahoraga_mcp-0.2.0.tar.gz.
File metadata
- Download URL: mahoraga_mcp-0.2.0.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
069addf74723d1cc1d0b41690d17ad877cbca97b04ed9c736f42ae72f7b8f954
|
|
| MD5 |
9807f33f008f9e72fab52cf52ec90b9a
|
|
| BLAKE2b-256 |
d86f180d75c8542f9e8a8c8004aaaf2d2fd13996cb0850295c95d64d1bba5b85
|
File details
Details for the file mahoraga_mcp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mahoraga_mcp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 28.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4c2bbb5278f68b9e31fe07129138e5bd37c070932a6cf444c517d539316b52d
|
|
| MD5 |
3238c3ca2ba2f99c5ac39012b4e0507c
|
|
| BLAKE2b-256 |
f17c1820ed25aca47fe67354278e007cfddf11cd52bbb65dd6d0f9e37e31f955
|