Skip to main content
Glama

Detox MCP

An MCP (Model Context Protocol) server for integrating the Detox mobile testing framework with Claude Code.

Features

  • Test Execution: Build and run Detox E2E tests with full options

  • Configuration Management: Read, validate, and generate Detox configurations

  • Code Generation: Generate test code, matchers, actions, and expectations

  • Device Management: List iOS simulators and Android emulators

  • Resources: Access configuration, devices, tests, and API reference

  • Prompts: Slash commands for common workflows

Related MCP server: MCP Appium

Installation

npm install -g detox-mcp

Or install locally in your project:

npm install detox-mcp

Usage with Claude Code

Add to Claude Code

# Add globally
claude mcp add detox-mcp

# Or with npx
claude mcp add --transport stdio detox-mcp -- npx detox-mcp

Project Configuration

Create .mcp.json in your project root:

{
  "mcpServers": {
    "detox": {
      "command": "npx",
      "args": ["detox-mcp"],
      "env": {
        "DETOX_PROJECT_PATH": "/path/to/your/react-native/project"
      }
    }
  }
}

Available Tools

Test Execution

Tool

Description

detox_build

Build app for Detox testing

detox_test

Run E2E tests with full options

detox_init

Initialize Detox in a project

Configuration

Tool

Description

detox_read_config

Read and parse .detoxrc.js

detox_list_configurations

List available configurations

detox_validate_config

Validate configuration

detox_create_config

Generate new configuration

Code Generation

Tool

Description

detox_generate_test

Generate complete test file

detox_generate_matcher

Generate element matcher code

detox_generate_action

Generate action code

detox_generate_expectation

Generate expectation code

Devices

Tool

Description

detox_list_devices

List iOS simulators and Android emulators

Resources

Access contextual data via the resource URIs:

URI

Description

detox://config

Current Detox configuration

detox://devices

Available simulators/emulators

detox://tests

Test file listings

detox://api/matchers

Matchers API reference

detox://api/actions

Actions API reference

detox://api/expectations

Expectations API reference

detox://api/device

Device API reference

Prompts (Slash Commands)

Use these prompts in Claude Code for common workflows:

Prompt

Description

/detox-test

Run tests with smart defaults

/detox-generate

Generate test from description

/detox-setup

Initialize Detox in project

/detox-debug

Debug failing tests

Examples

Run Tests

Ask Claude: "Run my Detox tests on iOS simulator"

Claude will use detox_build and detox_test tools to execute your tests.

Generate Test Code

Ask Claude: "Generate a Detox test for the login flow"

Claude will use detox_generate_test to create test code.

Check Configuration

Ask Claude: "What Detox configurations are available?"

Claude will use detox_list_configurations to show available configs.

Requirements

  • Node.js 18+

  • Detox installed in your React Native project

  • For iOS: Xcode and applesimutils

  • For Android: Android SDK and emulator

Environment Variables

Variable

Description

Default

DETOX_PROJECT_PATH

Path to React Native project

Current directory

Development

# Clone the repo
git clone https://github.com/your-username/detox-mcp

# Install dependencies
npm install

# Build
npm run build

# Run in development
npm run dev

License

MIT

Available Tools

12 tools
detox_buildC

Build the app for Detox testing. Runs the build command from your Detox configuration.

Inputs: configuration, configPath, ifMissing, silent, +1 more.

detox_create_configC

Generate a new Detox configuration file for your React Native project.

Inputs: projectPath (required), platforms (required), appName, bundleId, +1 more.

detox_generate_actionC

Generate Detox action code (tap, typeText, scroll, etc.).

Inputs: actionType (required), elementMatcher (required), actionParams.

detox_generate_expectationC

Generate Detox expectation/assertion code (toBeVisible, toHaveText, etc.).

Inputs: expectationType (required), elementMatcher (required), expectedValue, negated, +2 more.

detox_generate_matcherC

Generate Detox matcher code for element selection (by.id, by.text, etc.).

Inputs: elementDescription (required), matcherType, withAncestor, withDescendant, +1 more.

detox_generate_testC

Generate a complete Detox test file from a description.

Inputs: description (required), testName (required), outputPath, includeSetup, +1 more.

detox_initC

Initialize Detox in a React Native project. Creates e2e folder structure and configuration.

Inputs: projectPath (required), testRunner.

detox_list_configurationsB

List all available Detox configurations (e.g., ios.sim.debug, android.emu.debug).

Inputs: projectPath.

detox_list_devicesC

List available iOS simulators and Android emulators.

Inputs: platform, availableOnly.

detox_read_configC

Read and parse the current Detox configuration file (.detoxrc.js or similar).

Inputs: projectPath, configPath.

detox_testC

Run Detox E2E tests with full options for configuration, retries, artifacts, and more.

Inputs: configuration, testFilePaths, testNamePattern, deviceName, +10 more.

detox_validate_configB

Validate Detox configuration for errors and warnings.

Inputs: projectPath, configuration.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 12 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose with no ambiguity. The tools are well-organized around specific Detox operations like building, configuration management, code generation, testing, and device listing. Each tool name directly indicates its unique function, making it easy for an agent to select the correct one.

    Naming Consistency5/5

    All tools follow a consistent 'detox_verb_noun' pattern throughout, such as detox_build, detox_create_config, and detox_generate_action. This uniform naming convention enhances readability and predictability, allowing agents to easily understand and navigate the toolset without confusion.

    Tool Count5/5

    With 12 tools, the count is well-scoped and appropriate for a Detox testing server. Each tool serves a specific, necessary function in the E2E testing workflow, from setup and configuration to test generation and execution, ensuring comprehensive coverage without being overwhelming.

    Completeness5/5

    The toolset provides complete coverage of the Detox domain, including initialization, configuration management, code generation for actions/expectations/matchers/tests, device listing, building, and testing. There are no obvious gaps, and the tools support the full lifecycle of Detox E2E testing workflows.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      A
      maintenance
      Enables AI assistants to automate mobile app testing and development for iOS and Android through natural language interactions. Supports intelligent element identification, session management, automated test generation, and comprehensive device interactions including clicks, swipes, screenshots, and app management.
      32
      14,478 npm
      518
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables automated testing and development of Expo/React Native apps through session-based Expo dev server management and Maestro UI automation tools for tapping, text input, screenshots, and flow execution.
      292,543 npm
      5
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables Claude to interact with physical iOS devices running Expo development builds via USB or network tunnels. It supports capturing screenshots, streaming system logs, managing applications, and retrieving device information through natural language.
      2
      -