appium-mcp-server

appium-mcp-server

Enables AI assistants to perform mobile device automation testing via Appium through the Model Context Protocol, supporting Android and iOS devices with 40+ tools.

Category
Visit Server

README

Appium MCP Server

Python 3.9+ License: MIT Code style: black

Appium MCP Server 是一个基于 Model Context Protocol (MCP) 的移动设备自动化测试服务器。它将 Appium 的强大功能通过 MCP 协议暴露给 AI 助手,实现智能化的移动应用测试。

✨ 特性

  • 🤖 AI 友好: 通过 MCP 协议与 Claude、ChatGPT 等 AI 助手无缝集成
  • 📱 跨平台支持: 同时支持 Android 和 iOS 设备及模拟器
  • 🛠️ 丰富的工具集: 提供 40+ 个自动化测试工具
  • 🔄 异步架构: 高性能异步设计,支持并发操作
  • 🎯 易于使用: 5分钟快速上手,详细的文档和示例
  • 🔧 高度可配置: 灵活的配置选项适应不同使用场景

🚀 快速开始

安装

# 安装 Appium MCP Server
pip install appium-mcp-server

# 安装 Appium
npm install -g appium
appium driver install uiautomator2  # Android
appium driver install xcuitest      # iOS (仅 macOS)

基本使用

前置条件检查

# 验证安装是否成功
appium-mcp-server --version  # 应该显示版本号
appium --version              # 应该显示 Appium 版本
  1. 启动 Appium 服务器

    appium --port 4723
    
  2. 配置 Claude Desktop

    {
      "mcpServers": {
        "appium": {
          "command": "appium-mcp-server",
          "args": ["run"]
        }
      }
    }
    

    注意:配置后重启 Claude Desktop,MCP 服务器会自动启动,无需手动运行。

  3. 重启 Claude Desktop

    配置文件修改后,需要重启 Claude Desktop 使配置生效。

  4. 开始对话

    请帮我连接 Android 设备,启动设置应用并截图。
    

🎬 功能演示

📱 设备连接测试

设备连接测试结果

展示完整的设备管理流程:设备发现 → 设备连接 → 信息获取 → 会话管理 → 截图验证

🎯 测试功能展示

  • 设备发现: 自动列出所有可用的Android和iOS设备
  • 设备连接: 成功连接到指定设备并创建会话
  • 信息获取: 获取设备详细信息和会话状态
  • 截图功能: 实时截取设备屏幕状态
  • AI交互: 通过自然语言指令控制设备操作

🛠️ 功能概览

设备管理

  • 设备发现和连接
  • 设备信息获取
  • 应用安装和卸载
  • 设备状态监控

UI 自动化

  • 元素查找和操作
  • 文本输入和清除
  • 手势操作(点击、滑动、拖拽)
  • 多点触控支持

系统操作

  • 截图和录屏
  • 按键操作
  • 设备旋转
  • 系统设置

文件操作

  • 文件传输(推送/拉取)
  • 目录管理
  • 文件权限控制

📚 文档

🎯 使用场景

自动化测试

# Python 客户端示例
import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async def test_login():
    server_params = StdioServerParameters(
        command="appium-mcp-server", args=[]
    )
    
    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()
            
            # 连接设备
            await session.call_tool("connect_device", {
                "device_id": "emulator-5554"
            })
            
            # 启动应用
            await session.call_tool("launch_app", {
                "device_id": "emulator-5554",
                "app_package": "com.example.app"
            })
            
            # 执行登录流程
            # ...

AI 助手对话

用户: 请测试购物应用的结账流程

AI: 我来帮您测试购物应用的结账流程:

1. 首先连接设备并启动应用
2. 添加商品到购物车
3. 进入结账页面
4. 填写收货信息
5. 选择支付方式
6. 完成下单并验证

让我开始执行测试...

🏗️ 架构

graph TB
    subgraph "MCP Client Layer"
        A[AI Assistant]
        B[Claude Desktop]
        C[Custom Client]
    end
    
    subgraph "Appium MCP Server"
        D[MCP Server Core]
        E[Tool Registry]
        F[Device Manager]
        G[Session Manager]
    end
    
    subgraph "Appium Layer"
        H[Appium Python Client]
        I[WebDriver Sessions]
    end
    
    subgraph "Device Layer"
        J[Android Devices]
        K[iOS Devices]
        L[Emulators]
    end
    
    A --> D
    B --> D
    C --> D
    D --> E
    D --> F
    D --> G
    E --> H
    F --> H
    G --> I
    H --> J
    H --> K
    H --> L

🤝 贡献

我们欢迎社区贡献!请查看 贡献指南 了解如何参与项目开发。

开发环境设置

# 克隆项目
git clone https://github.com/1405942836/appium-mcp.git
cd appium-mcp

# 安装开发依赖
pip install -e ".[dev]"

# 安装 pre-commit hooks
pre-commit install

# 运行测试
pytest

📄 许可证

本项目基于 MIT 许可证 开源。

🆘 获取帮助

🙏 致谢


⭐ 如果这个项目对您有帮助,请给我们一个 Star!

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured