Skip to main content
Glama

MCP Appium サーバー

Appium を使用したモバイル アプリ自動化のためのモデル コンテキスト プロトコル (MCP) サーバー実装。

前提条件

  1. Node.js (v14以上)

  2. Java開発キット(JDK)

  3. Android SDK(Android テスト用)

  4. Xcode (iOS テスト用、macOS のみ)

  5. Appiumサーバー

  6. Androidデバイスまたはエミュレータ / iOSデバイスまたはシミュレータ

Related MCP server: MCP Android Agent

環境設定

コマンドを実行する前に、環境変数が適切に設定されていることを確認してください。

  1. .bash_profile 、 .zshrc 、またはその他のシェル構成ファイルに必要な環境変数が含まれていることを確認します。

# Example environment variables in ~/.bash_profile
export JAVA_HOME=/path/to/your/java
export ANDROID_HOME=/path/to/your/android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
  1. MCP-Appium を実行する前に環境ファイルをソースします。

source ~/.bash_profile  # For bash
# OR
source ~/.zshrc         # For zsh

注: システムはドライバーを初期化するときに.bash_profile自動的に取得しようとしますが、新しいターミナル セッションでテストを実行する前に、適切な環境設定を手動で確認することをお勧めします。

Xcode コマンドラインツールの設定

iOS テストでは、適切な Xcode コマンドライン ツールの構成が不可欠です。

  1. Xcode コマンドライン ツールがまだインストールされていない場合はインストールします。

xcode-select --install
  1. インストールを確認し、現在の Xcode パスを確認します。

xcode-select -p
  1. 必要に応じて、正しい Xcode パスを設定します (特に複数の Xcode バージョンがある場合)。

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
  1. Xcode ライセンス契約に同意します:

sudo xcodebuild -license accept
  1. iOS の実際のデバイスをテストする場合は、Xcode で Apple Developer アカウントが適切に設定されていることを確認してください。

    • Xcodeを開く

    • 「設定」>「アカウント」へ移動

    • Apple IDをまだ追加していない場合は追加してください

    • 必要なプロビジョニングプロファイルをダウンロードする

  2. iOS 開発用の環境変数を設定します。

# Add these to your ~/.bash_profile or ~/.zshrc
export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
export PATH="$DEVELOPER_DIR/usr/bin:$PATH"
  1. 更新された構成を取得します。

source ~/.bash_profile  # For bash
# OR
source ~/.zshrc         # For zsh

設定

  1. 依存関係をインストールします:

npm install
  1. Appium サーバーをインストールして起動します。

npm install -g appium
appium
  1. Android デバイス/エミュレータをセットアップします。

    • Androidデバイスで開発者向けオプションを有効にする

    • USBデバッグを有効にする

    • USB経由でデバイスを接続するか、エミュレータを起動します

    • adb devicesを使用してデバイスが接続されていることを確認する

  2. iOS テストの場合 (macOS のみ):

    • Xcode コマンドラインツールがインストールされていることを確認します: xcode-select --install

    • iOSシミュレーターをセットアップするか、実際のデバイスを接続する

    • 実際のデバイスを使用する場合は、iOSデバイスの開発用コンピュータを信頼します

テストの実行

  1. プロジェクトをビルドします。

npm run build
  1. MCP サーバーを起動します。

npm run dev
  1. 新しいターミナルでテストを実行します。

npm test

テスト構成

Androidの設定

サンプルテストでは、Android設定アプリをデモとして使用します。独自のアプリをテストするには、以下の手順に従ってください。

  1. examples/appium-test.tsを編集します。

    • deviceNameデバイスに合わせて更新します

    • APKファイルへのappを設定するか、

    • インストールされたアプリのappPackageとappActivityを更新する

  2. 共通機能の構成:

const capabilities: AppiumCapabilities = {
  platformName: "Android",
  deviceName: "YOUR_DEVICE_NAME",
  automationName: "UiAutomator2",
  // For installing and testing an APK:
  app: "./path/to/your/app.apk",
  // OR for testing an installed app:
  appPackage: "your.app.package",
  appActivity: ".MainActivity",
  noReset: true,
};

iOS 設定

新しい Xcode コマンドライン サポートを使用した iOS テストの場合:

  1. examples/xcode-appium-example.tsの設定例:

const capabilities: AppiumCapabilities = {
  platformName: "iOS",
  deviceName: "iPhone 13", // Your simulator or device name
  automationName: "XCUITest",
  udid: "DEVICE_UDID", // Get this from XcodeCommands.getIosSimulators()
  // For installing and testing an app:
  app: "./path/to/your/app.app",
  // OR for testing an installed app:
  bundleId: "com.your.app",
  noReset: true,
};

利用可能なアクション

MCP サーバーはさまざまな Appium アクションをサポートしています。

  1. 要素の相互作用:

    • 要素を見つける

    • W3C Actions API を使用した要素のタップ/クリック (「W3C 標準ジェスチャ」セクションを参照)

    • テキストを入力

    • W3C Actions API で要素までスクロールする

    • 長押し

  2. アプリ管理:

    • アプリを起動/閉じる

    • アプリをリセット

    • 現在のパッケージ/アクティビティを取得する

  3. デバイスコントロール:

    • 画面の向き

    • キーボード操作

    • デバイスのロック/ロック解除

    • スクリーンショット

    • バッテリー情報

  4. 高度な機能:

    • コンテキスト切り替え(ネイティブ/WebView)

    • ファイル操作

    • 通知

    • カスタムジェスチャー

  5. Xcode コマンドラインツール (iOS のみ):

    • iOS シミュレーターの管理 (起動、シャットダウン)

    • シミュレータ上でのアプリのインストール/アンインストール

    • アプリの起動/終了

    • スクリーンショットを撮る

    • ビデオを録画する

    • シミュレータの作成/削除

    • デバイスの種類とランタイムを取得する

W3C標準ジェスチャー

MCP-Appium ライブラリは、モバイル自動化の最新標準であるタッチ ジェスチャ用の W3C WebDriver Actions API を実装するようになりました。

タップ要素のW3Cアクション

tapElementメソッドは、インテリジェントなフォールバックを備えた W3C Actions API を使用するようになりました。

// The method will try in this order:
// 1. Standard WebdriverIO click()
// 2. W3C Actions API
// 3. Legacy TouchAction API (fallback for backward compatibility)
await appium.tapElement("//android.widget.Button[@text='OK']");
// or using the click alias
await appium.click("//android.widget.Button[@text='OK']");

スクロールのためのW3Cアクション

scrollToElementメソッドは W3C Actions API を使用するようになりました。

// Uses W3C Actions API for more reliable scrolling
await appium.scrollToElement(
  "//android.widget.TextView[@text='About phone']", // selector
  "down", // direction: "up", "down", "left", "right"
  "xpath", // strategy
  10 // maxScrolls
);

カスタム W3C ジェスチャー

executeMobileCommandメソッドを使用して、独自のカスタム W3C ジェスチャを作成できます。

// Create custom W3C Actions API gesture
const w3cActions = {
  actions: [
    {
      type: "pointer",
      id: "finger1",
      parameters: { pointerType: "touch" },
      actions: [
        // Move to start position
        { type: "pointerMove", duration: 0, x: startX, y: startY },
        // Press down
        { type: "pointerDown", button: 0 },
        // Move to end position over duration milliseconds
        {
          type: "pointerMove",
          duration: duration,
          origin: "viewport",
          x: endX,
          y: endY,
        },
        // Release
        { type: "pointerUp", button: 0 },
      ],
    },
  ],
};

// Execute the W3C Actions using executeScript
await appium.executeMobileCommand("performActions", [w3cActions.actions]);

W3C 標準ジェスチャ実装の詳細な例についてはexamples/w3c-actions-swipe-demo.ts参照してください。

Xcodeコマンドラインツールの使用

新しいXcodeCommandsクラスは、iOS テスト用の強力なツールを提供します。

import { XcodeCommands } from "../src/lib/xcode/xcodeCommands.js";

// Check if Xcode CLI tools are installed
const isInstalled = await XcodeCommands.isXcodeCliInstalled();

// Get available simulators
const simulators = await XcodeCommands.getIosSimulators();

// Boot a simulator
await XcodeCommands.bootSimulator("SIMULATOR_UDID");

// Install an app
await XcodeCommands.installApp("SIMULATOR_UDID", "/path/to/app.app");

// Launch an app
await XcodeCommands.launchApp("SIMULATOR_UDID", "com.example.app");

// Take a screenshot
await XcodeCommands.takeScreenshot("SIMULATOR_UDID", "/path/to/output.png");

// Shutdown a simulator
await XcodeCommands.shutdownSimulator("SIMULATOR_UDID");

クリック機能の使用

click()メソッドはtapElement()のより直感的な代替手段を提供します。

// Using the click method
await appium.click("//android.widget.Button[@text='OK']");

// This is equivalent to:
await appium.tapElement("//android.widget.Button[@text='OK']");

トラブルシューティング

  1. デバイスが見つかりません:

    • adb devicesの出力を確認する

    • USBデバッグが有効になっていることを確認する

    • デバイスを再接続してみてください

  2. アプリがインストールされません:

    • APKパスが正しいことを確認する

    • デバイスに十分なストレージがあるか確認する

    • アプリがデバッグ用に署名されていることを確認する

  3. 要素が見つかりません:

    • Appium Inspectorを使用してセレクタを検証する

    • 画面上に要素が表示されているかどうかを確認する

    • さまざまなロケーター戦略を試す

  4. 接続の問題:

    • Appiumサーバーが実行中であることを確認する

    • ポートの競合を確認する

    • 正しい機能が設定されていることを確認する

  5. iOS シミュレータの問題:

    • Xcodeコマンドラインツールがインストールされていることを確認します: xcode-select -p

    • xcrun simctl list devicesを使用してシミュレータのUDIDが正しいことを確認します。

    • シミュレータが応答しなくなった場合は閉じて再起動してください

貢献

追加機能やバグ修正に関する問題やプル リクエストをお気軽に送信してください。

ライセンス

マサチューセッツ工科大学

Available Tools

110 tools
appium-screenshotC

Take a screenshot using Appium

Inputs: name (required).

capture-ui-locatorsC

Capture all UI elements and their locators for future use

Inputs: elementType, saveToFile, refreshSource.

clear-elementC

Clear text from an input element

Inputs: selector (required), strategy.

close-appB

Close the app associated with the current Appium session

Inputs: no named parameters.

close-appiumB

Close the current Appium driver session

Inputs: no named parameters.

element-existsC

Check if an element exists on the current page

Inputs: selector (required), strategy.

execute-adb-commandC

Execute a custom ADB command

Inputs: command (required).

execute-mobile-commandC

Execute a custom mobile command for iOS or Android

Inputs: command (required), args.

extract-locatorsC

Extract element locators from UI XML source

Inputs: xmlSource (required), elementType, maxResults.

find-by-ios-class-chainC

Find an element using iOS class chain (iOS only)

Inputs: classChain (required), timeoutMs.

find-by-ios-predicateB

Find an element using iOS predicate string (iOS only)

Inputs: predicateString (required), timeoutMs.

find-by-textC

Generate XPath to find element by text

Inputs: text (required), platformName (required), exactMatch, elementType.

find-elements-by-textC

Find all elements containing specific text

Inputs: text (required).

generate-element-locatorsC

Generate multiple types of locators for an element

Inputs: selector (required), strategy.

generate-test-scriptC

Generate Appium test script from actions

Inputs: platformName (required), actions (required), appPackage, bundleId.

get-battery-infoB

Get the device battery information

Inputs: no named parameters.

get-contextsB

Get all available contexts (NATIVE_APP, WEBVIEW, etc.)

Inputs: no named parameters.

get-current-activityB

Get the current Android activity name

Inputs: no named parameters.

get-current-contextC

Get the current context

Inputs: no named parameters.

get-current-packageB

Get the current active app package name

Inputs: no named parameters.

get-device-timeB

Get the current device time

Inputs: no named parameters.

get-element-attributesC

Get all available attributes of an element

Inputs: selector (required), strategy.

get-element-textC

Get text content from a UI element

Inputs: selector (required), strategy.

get-element-treeC

Get a hierarchical view of the UI elements (similar to Appium Inspector)

Inputs: maxDepth.

get-orientationB

Get the current device orientation

Inputs: no named parameters.

get-page-sourceB

Get the XML representation of the current UI

Inputs: no named parameters.

has-text-in-screenA

Check if specific text exists anywhere on the current screen

Inputs: text (required).

hide-keyboardB

Hide the keyboard if it's currently visible

Inputs: no named parameters.

initialize-appiumC

Initialize an Appium driver session for mobile automation

Inputs: platformName (required), deviceName (required), udid, app, +8 more.

inspect-and-actC

Inspect UI to identify element locators and then perform an action

Inputs: action (required), elementIdentifier, text, longPressMs, +4 more.

inspect-and-tapC

Inspect an element using one locator, then tap using the best available locator

Inputs: selector (required), strategy, preferredOrder.

inspect-elementC

Get detailed information about an element (for debugging)

Inputs: selector (required), strategy.

install-appC

Install an Android application APK

Inputs: deviceId (required), apkPath (required).

is-device-lockedA

Check if the device is currently locked

Inputs: no named parameters.

launch-appC

Launch an app on an Android device

Inputs: deviceId (required), packageName (required), activityName.

launch-appium-appB

Launch the app associated with the current Appium session

Inputs: no named parameters.

list-devicesB

List all connected Android devices

Inputs: no named parameters.

list-installed-packagesB

List all installed packages on an Android device

Inputs: deviceId (required).

list-ios-simulatorsB

Get list of available iOS simulators

Inputs: no named parameters.

lock-deviceC

Lock the device screen

Inputs: durationSec.

long-pressC

Perform a long press gesture on an element

Inputs: selector (required), duration, strategy.

open-notificationsB

Open the notifications panel (Android only)

Inputs: no named parameters.

perform-element-actionC

Perform a specific action on an element using various locator strategies

Inputs: action (required), locatorType (required), locatorValue (required), actionParams, +1 more.

perform-touch-idC

Simulate Touch ID fingerprint (iOS only)

Inputs: match (required).

perform-w3c-gestureB

Perform touch gestures using the W3C Actions API (more reliable than TouchAction API)

Inputs: actionType (required), startX (required), startY (required), endX, +6 more.

press-key-codeC

Press an Android key code

Inputs: keycode (required).

pull-fileC

Pull a file from the device

Inputs: path (required).

push-fileC

Push a file to the device

Inputs: path (required), data (required).

reset-appB

Reset the app (terminate and relaunch) associated with the current Appium session

Inputs: no named parameters.

save-ui-hierarchyC

Save UI hierarchy XML to a file

Inputs: xmlSource (required), filePath (required).

scroll-screenC

Scroll the screen in a specified direction

Inputs: direction (required), distance.

scroll-to-elementC

Scroll until an element becomes visible

Inputs: selector (required), direction, strategy, maxScrolls.

send-key-eventC

Send a key event to the device (e.g., HOME, BACK)

Inputs: keyEvent (required).

send-keysC

Send text input to a UI element

Inputs: selector (required), text (required), strategy.

send-keys-by-ios-class-chainC

Send text to an element using iOS class chain (iOS only)

Inputs: classChain (required), text (required), timeoutMs.

send-keys-by-ios-predicateB

Send text to an element using iOS predicate string (iOS only)

Inputs: predicateString (required), text (required), timeoutMs.

send-keys-to-deviceC

Send keys directly to the device without focusing on any element

Inputs: text (required).

set-orientationC

Set the device orientation

Inputs: orientation (required).

shake-deviceB

Simulate shake gesture (iOS only)

Inputs: no named parameters.

smart-tapB

Intelligently tap an element trying different locator strategies in a specific order

Inputs: elementIdentifier (required), text, timeoutMs.

start-recordingC

Start recording the screen

Inputs: videoType, timeLimit, videoQuality, videoFps.

stop-recordingC

Stop recording the screen and get the recording data

Inputs: outputPath (required).

swipeC

Perform a swipe gesture on the screen

Inputs: startX (required), startY (required), endX (required), endY (required), +1 more.

switch-contextC

Switch between contexts (e.g., NATIVE_APP, WEBVIEW)

Inputs: context (required).

take-screenshotC

Take a screenshot on an Android device

Inputs: deviceId (required), outputPath (required).

tap-by-ios-class-chainC

Tap on an element using iOS class chain (iOS only)

Inputs: classChain (required), timeoutMs.

tap-by-ios-predicateB

Tap on an element using iOS predicate string (iOS only)

Inputs: predicateString (required), timeoutMs.

tap-elementB

Tap on a UI element identified by a selector

Inputs: selector (required), strategy.

tap-element-by-textC

Tap on an element containing specific text

Inputs: text (required).

uninstall-appC

Uninstall an Android application

Inputs: deviceId (required), packageName (required).

unlock-deviceB

Unlock the device screen

Inputs: no named parameters.

wait-for-elementC

Wait for an element to be visible on screen

Inputs: selector (required), strategy, timeoutMs.

xcode_add_media_to_simulatorC

Add photos/videos to a simulator

Inputs: udid (required), mediaPaths (required).

xcode_boot_simulatorC

Boot an iOS simulator

Inputs: udid (required).

xcode_check_cli_installedB

Check if Xcode command line tools are installed

Inputs: no named parameters.

xcode_clear_simulator_locationC

Clear the location of a simulator

Inputs: udid (required).

xcode_configure_simulator_preferencesB

Configure simulator preferences in batch

Inputs: udid (required), preferences (required).

xcode_copy_to_simulatorC

Copy files to a simulator (limited to media files)

Inputs: udid (required), sourcePath (required), destinationPath (required).

xcode_create_simulatorC

Create a new iOS simulator

Inputs: name (required), deviceTypeId (required), runtimeId (required).

xcode_delete_simulatorC

Delete an iOS simulator

Inputs: udid (required).

xcode_erase_simulatorC

Erase all data from a simulator

Inputs: udid (required).

xcode_get_device_typesB

Get available device types for simulators

Inputs: no named parameters.

xcode_get_ios_simulatorsB

Get a list of available iOS simulators

Inputs: no named parameters.

xcode_get_pathB

Get the path to the Xcode installation

Inputs: no named parameters.

xcode_get_privacy_permissionC

Get privacy permission status for an app

Inputs: udid (required), bundleId (required), service (required).

xcode_get_runtimesB

Get available runtimes for simulators

Inputs: no named parameters.

xcode_get_simulator_infoC

Get detailed information about a specific simulator

Inputs: udid (required).

xcode_get_simulator_logsC

Get logs from a simulator

Inputs: udid (required), predicate.

xcode_get_simulator_statusB

Get the status of all simulators

Inputs: no named parameters.

xcode_get_system_infoC

Get system information from a simulator

Inputs: udid (required).

xcode_grant_privacy_permissionC

Grant privacy permission to an app

Inputs: udid (required), bundleId (required), service (required).

xcode_install_appC

Install an app on a simulator

Inputs: udid (required), appPath (required).

xcode_install_cliA

Install Xcode command line tools (requires user interaction)

Inputs: no named parameters.

xcode_launch_appC

Launch an app on a simulator

Inputs: udid (required), bundleId (required), args, waitForDebugger.

xcode_list_installed_appsC

List all installed apps on a simulator

Inputs: udid (required).

xcode_open_urlB

Open a URL on a simulator

Inputs: udid (required), url (required).

xcode_push_notificationC

Push a notification to a simulator

Inputs: udid (required), bundleId (required), payload (required).

xcode_record_videoC

Start recording video of a simulator (returns process info)

Inputs: udid (required), outputPath (required).

xcode_reset_privacy_permissionC

Reset privacy permission for an app

Inputs: udid (required), bundleId (required), service (required).

xcode_revoke_privacy_permissionC

Revoke privacy permission from an app

Inputs: udid (required), bundleId (required), service (required).

xcode_set_hardware_keyboardC

Enable/disable hardware keyboard for a simulator

Inputs: udid (required), enabled (required).

xcode_set_simulator_locationC

Set the location of a simulator

Inputs: udid (required), latitude (required), longitude (required).

xcode_set_simulator_preferenceC

Set a specific simulator preference

Inputs: udid (required), domain (required), key (required), value (required).

xcode_shake_deviceC

Simulate shake gesture on a simulator

Inputs: udid (required).

xcode_shutdown_simulatorB

Shutdown an iOS simulator

Inputs: udid (required).

xcode_take_screenshotC

Take a screenshot of a simulator

Inputs: udid (required), outputPath (required).

xcode_terminate_appC

Terminate an app on a simulator

Inputs: udid (required), bundleId (required).

xcode_trigger_memory_warningC

Trigger memory warning on a simulator

Inputs: udid (required).

xcode_uninstall_appC

Uninstall an app from a simulator

Inputs: udid (required), bundleId (required).

xcode_wait_for_simulatorC

Wait for a simulator to be ready

Inputs: udid (required), timeoutMs.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 110 tools

    Disambiguation2/5

    There is significant overlap and ambiguity between tools, making it difficult for an agent to choose correctly. For example, 'take-screenshot' and 'appium-screenshot' appear redundant, 'close-app' and 'close-appium' are confusingly similar, and many tap/send-keys variants (e.g., 'tap-element', 'smart-tap', 'tap-by-ios-class-chain') have unclear boundaries. The descriptions help somewhat, but the sheer number of overlapping tools increases misselection risk.

    Naming Consistency3/5

    Naming is mixed with inconsistent patterns. Most tools use kebab-case (e.g., 'get-element-text'), but some use snake_case (e.g., 'xcode_add_media_to_simulator'), and verbs vary widely (e.g., 'get-', 'list-', 'perform-', 'execute-'). The xcode_* tools follow a consistent prefix pattern, but overall the conventions are not uniform across the set, reducing predictability.

    Tool Count2/5

    With 110 tools, the count is excessive for an MCP server, likely overwhelming agents and causing decision paralysis. While Appium automation is broad, many tools could be consolidated (e.g., multiple screenshot or tap methods). A well-scoped server should have fewer, more generalized tools, making this set feel bloated and inefficient.

    Completeness5/5

    The tool set provides comprehensive coverage for mobile automation with Appium, including device management, UI interaction, testing, and simulator control. It supports CRUD-like operations for apps, elements, and files, and covers both Android and iOS platforms. No obvious gaps are present; agents can perform end-to-end automation tasks without dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      A Model Context Protocol server that enables scalable mobile automation through a platform-agnostic interface for iOS and Android devices, allowing agents and LLMs to interact with mobile applications using accessibility snapshots or coordinate-based interactions.
      35
      45,799 npm
      10,554
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that enables AI agents to control and automate Android devices through natural language, supporting actions like app management, UI interactions, and device monitoring.
      59
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A Model Context Protocol server that enables scalable mobile automation for iOS and Android through a platform-agnostic interface, allowing LLMs to interact with mobile applications via accessibility snapshots or screenshot-based inputs.
      19
      45,799 npm
      2
      Apache 2.0
    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that provides Android Debug Bridge functionality for automating Android devices, enabling remote device management, screen operations, app management, file operations, and shell command execution.
      20
      12 npm
      1
      MIT