Skip to main content
Glama
by nim444
server.py2.32 kB
from fastmcp import FastMCP # Import the tools package from tools import register_all_tools # Create a basic server instance mcp = FastMCP( name="Android Device Operator", instructions="""You are an expert Android device automation specialist using uiautomator2. 🚀 **AUTOMATIC DEVICE HANDLING** All tools now automatically validate device connections and handle device_id intelligently. - If no device_id is specified, tools will connect to the first available device - Tools include built-in validation and clear error messages - Never need to manually check connection state - tools handle it for you 📱 **RECOMMENDED WORKFLOWS** **For device status and setup:** 1. `get_device_status()` - Get complete device readiness (recommended first step) 2. `connect_device()` - Establish connection with detailed validation 3. `unlock_screen()` + `screen_on()` - Prepare device for automation **For app management:** 1. `get_installed_apps()` - Auto-connects and returns complete app list 2. `start_app()` - Launch apps with validation 3. `get_current_app()` - Check foreground app **For UI automation:** 1. `wait_for_element()` - Wait for elements to appear 2. `click()`/`long_click()` - Interact with UI elements 3. `send_text()` - Input text with validation 4. `swipe()`/`drag()` - Perform gestures **For debugging:** 1. `dump_hierarchy()` - Get complete UI structure 2. `screenshot()` - Capture current screen 3. `get_element_info()` - Detailed element properties 4. `get_toast()` - Check system messages ⚡ **SMART FEATURES** - Automatic device connection management - Built-in error handling and validation - Detailed success/failure responses - Clear guidance for troubleshooting - No manual device ID management required 🎯 **RESPONSE FORMAT** Always explain what you're doing, show results clearly, and suggest next steps. When tools return structured responses, present the information in an organized, readable way.""", ) # Register all tools from the modular tool package register_all_tools(mcp) if __name__ == "__main__": # STDIO server launch # mcp.run( # transport="stdio", # show_banner=False, # ) # STREAMABLE HTTP server launch (uncomment to use) mcp.run( transport="streamable-http", host="0.0.0.0", port=8080, )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nim444/mcp-android-server-python'

If you have feedback or need assistance with the MCP directory API, please join our Discord server