website/docs/mcp/configuration.md
This page documents all configuration options for the WebdriverIO MCP server.
The MCP server is configured through the Claude Desktop or Claude Code configuration files.
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"wdio-mcp": {
"command": "npx",
"args": ["-y", "@wdio/mcp"]
}
}
}
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"wdio-mcp": {
"command": "npx",
"args": ["-y", "@wdio/mcp"]
}
}
}
Edit your project's .claude/settings.json:
{
"mcpServers": {
"wdio-mcp": {
"command": "npx",
"args": ["-y", "@wdio/mcp"]
}
}
}
Configure the Appium server connection and other settings via environment variables.
| Variable | Type | Default | Description |
|---|---|---|---|
APPIUM_URL | string | 127.0.0.1 | Appium server hostname |
APPIUM_URL_PORT | number | 4723 | Appium server port |
APPIUM_PATH | string | / | Appium server path |
{
"mcpServers": {
"wdio-mcp": {
"command": "npx",
"args": ["-y", "@wdio/mcp"],
"env": {
"APPIUM_URL": "192.168.1.100",
"APPIUM_URL_PORT": "4724",
"APPIUM_PATH": "/wd/hub"
}
}
}
}
Options available when starting a browser session via the start_browser tool.
headlessbooleanfalseRun Chrome in headless mode (no visible browser window). Useful for CI/CD environments or when you don't need to see the browser.
windowWidthnumber1920400 - 3840Initial browser window width in pixels.
windowHeightnumber1080400 - 2160Initial browser window height in pixels.
navigationUrlstringURL to navigate to immediately after starting the browser. This is more efficient than calling start_browser followed by navigate separately.
Example: Start browser and navigate in one call:
Start Chrome and navigate to https://webdriver.io
Options available when starting a mobile app session via the start_app_session tool.
platformstringiOS | AndroidThe mobile platform to automate.
platformVersionstringThe OS version of the device/simulator/emulator (e.g., 17.0 for iOS, 14 for Android).
automationNamestringXCUITest (iOS), UiAutomator2 | Espresso (Android)The automation driver to use. Defaults to XCUITest for iOS and UiAutomator2 for Android.
deviceNamestringName of the device, simulator, or emulator to use.
Examples:
iPhone 15 Pro, iPad Air (5th generation)Pixel 7, Nexus 5XudidstringUnique Device Identifier. Required for real iOS devices (40-character identifier) and recommended for Android real devices.
Finding UDID:
adb devices in terminalappPathstringPath to the application file to install and launch.
Supported formats:
.app directory.ipa file.apk file*Either appPath must be provided, or noReset: true to connect to an already-running app.
appWaitActivitystringActivity to wait for on app launch. If not specified, the app's main/launcher activity is used.
Example: com.example.app.MainActivity
noResetbooleanfalsePreserve the app state between sessions. When true:
appPath to connect to an already-running appfullResetbooleantrueCompletely reset the app before the session. When true:
Set fullReset: false with noReset: true to preserve app state completely.
newCommandTimeoutnumber60How long (in seconds) Appium will wait for a new command before assuming the client has quit and ending the session. Increase this value for longer debugging sessions.
Examples:
60 - Default, suitable for most automation300 - 5 minutes, for debugging or slower operations600 - 10 minutes, for very long-running testsautoGrantPermissionsbooleantrueAutomatically grant app permissions on install/launch. When true:
:::note Android Only This option primarily affects Android. iOS permissions must be handled differently due to system restrictions. :::
autoAcceptAlertsbooleantrueAutomatically accept system alerts (dialogs) that appear during automation.
Examples of auto-accepted alerts:
autoDismissAlertsbooleanfalseDismiss (cancel) system alerts instead of accepting them. Takes precedence over autoAcceptAlerts when set to true.
You can override the Appium server connection on a per-session basis:
appiumHoststringAppium server hostname. Overrides APPIUM_URL environment variable.
appiumPortnumberAppium server port. Overrides APPIUM_URL_PORT environment variable.
appiumPathstringAppium server path. Overrides APPIUM_PATH environment variable.
Options for the get_visible_elements tool.
elementTypestringinteractableinteractable | visual | allType of elements to return:
interactable: Buttons, links, inputs, and other clickable elementsvisual: Images, SVGs, and visual elementsall: Both interactable and visual elementsinViewportOnlybooleantrueOnly return elements that are visible within the current viewport. When false, returns all elements in the view hierarchy (useful for finding off-screen elements).
includeContainersbooleanfalseInclude container/layout elements in the results. When true:
Android containers included:
ViewGroup, FrameLayout, LinearLayoutRelativeLayout, ConstraintLayoutScrollView, RecyclerViewiOS containers included:
View, StackView, CollectionViewScrollView, TableViewUseful for debugging layout issues or understanding the view hierarchy.
includeBoundsbooleanfalseInclude element bounds/coordinates (x, y, width, height) in the response. Set to true for:
For large pages with many elements, use pagination to reduce token usage:
limitnumber0 (unlimited)Maximum number of elements to return.
offsetnumber0Number of elements to skip before returning results.
Example: Get elements 21-40:
Get visible elements with limit 20 and offset 20
Options for the get_accessibility tool (browser-only).
limitnumber100Maximum number of nodes to return. Use 0 for unlimited (not recommended for large pages).
offsetnumber0Number of nodes to skip for pagination.
rolesstring[]Filter to specific accessibility roles.
Common roles: button, link, textbox, checkbox, radio, heading, img, listitem
Example: Get only buttons and links:
Get accessibility tree filtered to button and link roles
namedOnlybooleantrueOnly return nodes that have a name/label. Filters out anonymous containers and reduces noise in the results.
Options for the take_screenshot tool.
outputPathstringPath where to save the screenshot file. If not provided, returns base64-encoded image data.
Screenshots are automatically processed to optimize for LLM consumption:
| Optimization | Value | Description |
|---|---|---|
| Max dimension | 2000px | Images larger than 2000px are scaled down |
| Max file size | 1MB | Images are compressed to stay under 1MB |
| Format | PNG/JPEG | PNG with max compression; JPEG if needed for size |
This optimization ensures screenshots can be efficiently processed without exceeding token limits.
The MCP server tracks session types to provide appropriate tools and behavior:
| Type | Description | Auto-Detach |
|---|---|---|
browser | Chrome browser session | No |
ios | iOS app session | Yes (if noReset: true or no appPath) |
android | Android app session | Yes (if noReset: true or no appPath) |
The MCP server operates with a single-session model:
| Action | detach: false (Close) | detach: true (Detach) |
|---|---|---|
| Browser | Closes Chrome completely | Keeps Chrome running, disconnects WebDriver |
| Mobile App | Terminates app | Keeps app running in current state |
| Use Case | Clean slate for next session | Preserve state, manual inspection |
The MCP server is optimized for efficient LLM communication using TOON (Token-Oriented Object Notation) format, which minimizes token usage when sending data to Claude.
inViewportOnly: true (default) filters to only visible elementsinViewportOnly: true (default) significantly reduces element countlimit and offset) reduces token usage for screens with many elementsincludeBounds: false (default) omits coordinate data unless needed| Setting | Impact |
|---|---|
inViewportOnly: true | Filters off-screen elements, reducing response size |
includeContainers: false | Excludes layout elements (ViewGroup, etc.) |
includeBounds: false | Omits x/y/width/height data |
limit with pagination | Process elements in batches instead of all at once |
namedOnly: true (accessibility) | Filters anonymous nodes |
Before using mobile automation, ensure Appium is properly configured.
# Install Appium globally
npm install -g appium
# Install drivers
appium driver install xcuitest # iOS
appium driver install uiautomator2 # Android
# Start the server
appium
# Start with custom host and port
appium --address 0.0.0.0 --port 4724
# Start with logging
appium --log-level debug
# Start with specific base path
appium --base-path /wd/hub
# Check installed drivers
appium driver list --installed
# Check Appium version
appium --version
# Test connection
curl http://localhost:4723/status
npm --versionnpx @wdio/mcpcurl http://localhost:4723/statusANDROID_HOME and emulator is runningIf sessions are timing out during debugging:
newCommandTimeout when starting the sessionnoReset: true to preserve state between sessionsdetach: true when closing to keep the app running