website/docs/mcp/configuration.md
This page documents all configuration options for the WebdriverIO MCP server.
The MCP server is configured through the configuration files or commands.
Edit your MCP configuration file (e.g. ./.mcp.json) and add the following:
{
"mcpServers": {
"wdio-mcp": {
"command": "npx",
"args": ["-y", "@wdio/mcp"]
}
}
}
All session options are passed to the start_session tool. There is a single unified tool for browser and mobile sessions; the platform parameter determines the session type.
platform"browser" | "ios" | "android"The platform to automate.
provider"local" | "browserstack" | "saucelabs" | "testmu" | "testingbot""local"Where the session runs. Use a cloud provider name for remote devices; each requires its own environment variables. See Cloud Providers for details.
Options for platform: "browser" sessions.
browser"chrome" | "firefox" | "edge" | "safari"Browser to launch.
browserVersionstring"latest"Browser version. Cloud providers only (default: latest).
os / osVersionstringOperating system for cloud provider browser sessions. Examples: os: "Windows", osVersion: "11" or os: "OS X", osVersion: "Sequoia".
headlessbooleantrueRun browser in headless mode (no visible window). Set to false 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. More efficient than calling start_session followed by navigate separately.
attachbooleanfalseAttach to an existing Chrome instance instead of launching a new one. Use after launch_chrome to connect via CDP.
attachConfig{ port?: number; host?: string }{ port: 9222, host: "localhost" }Chrome remote debugging connection config. Only applies when attach: true.
Options for platform: "ios" or platform: "android" sessions.
deviceNamestringName of the device, simulator, or emulator.
Examples:
"iPhone 16", "iPad Air (5th generation)""Pixel 7", "Nexus 5X"platformVersionstringOS version of the device/simulator/emulator (e.g., "18.0" for iOS, "14" for Android).
automationName"XCUITest" | "UiAutomator2"Automation driver. Defaults to XCUITest for iOS and UiAutomator2 for Android.
udidstringUnique Device Identifier. Required for real iOS devices (40-character identifier).
Finding UDID:
adb devices in terminalappPathstringPath to the application file to install and launch.
Supported formats:
.app directory.ipa file.apk fileEither appPath must be provided, or noReset: true to connect to an already-running app.
appstringCloud provider app URL (bs://... for BrowserStack, storage:filename= for Sauce Labs, lt://... for TestMu, TestingBot app_url) or customId. Used instead of appPath for cloud mobile sessions.
appWaitActivitystringActivity to wait for on app launch. If not specified, the app's main/launcher activity is used.
Example: "com.example.app.MainActivity"
noResetbooleanPreserve the app state between sessions. When true:
appPath to connect to an already-running appfullResetbooleanCompletely reset the app before the session:
Set fullReset: false with noReset: true to preserve app state completely.
newCommandTimeoutnumber300How long (in seconds) Appium will wait for a new command before ending the session. Increase for longer debugging sessions.
autoGrantPermissionsbooleantrueAutomatically grant app permissions on install/launch (camera, microphone, location, etc.).
:::note Android Only This option primarily affects Android. iOS permissions must be handled differently due to system restrictions. :::
autoAcceptAlertsbooleantrueAutomatically accept system alerts (dialogs) during automation ("Allow notifications?", etc.).
autoDismissAlertsbooleanfalseDismiss system alerts instead of accepting them. Takes precedence over autoAcceptAlerts when true.
Override the Appium server connection on a per-session basis using appiumConfig:
start_session({
platform: "ios",
deviceName: "iPhone 16",
appPath: "/path/to/app.app",
appiumConfig: { host: "192.168.1.100", port: 4724, path: "/wd/hub" }
})
appiumConfig{ host?: string; port?: number; path?: string }Appium server connection. Defaults to { host: "127.0.0.1", port: 4723, path: "/" }.
Each cloud provider requires its own environment variables:
| Provider | Username Variable | Access Key Variable |
|---|---|---|
| BrowserStack | BROWSERSTACK_USERNAME | BROWSERSTACK_ACCESS_KEY |
| Sauce Labs | SAUCE_USERNAME | SAUCE_ACCESS_KEY |
| TestMu | TESTMU_USERNAME | TESTMU_ACCESS_KEY |
| TestingBot | TESTINGBOT_KEY | TESTINGBOT_SECRET |
Set these before starting the MCP server.
region"us-west-1" | "eu-central-1" | "apac-southeast-1""eu-central-1"Sauce Labs data center region. Ignored for other providers.
tunnelboolean | "external"falseEnable local tunnel routing for cloud provider sessions (accessing localhost, staging environments, internal services).
true — Auto-start the tunnel before the session and stop it on close"external" — Tunnel already running externally; sets provider-appropriate flags onlyBefore using true, read the provider's local-binary resource (wdio://browserstack/local-binary, wdio://saucelabs/local-binary, wdio://testmu/local-binary, or wdio://testingbot/local-binary) for setup instructions specific to your OS and architecture.
tunnelNamestringTunnel identifier name. Required when tunnel: "external" to match the running tunnel. When tunnel: true, a unique name is auto-generated if not provided.
reporting{ project?: string; build?: string; session?: string }Cloud provider session labels visible in the provider's dashboard. Works identically across BrowserStack, Sauce Labs, TestMu, and TestingBot.
tracebooleanfalseEnable trace recording. Produces a Playwright-compatible .trace zip file saved to .trace/ on close_session. View traces at player.vibium.dev.
Options for the get_elements tool.
inViewportOnlybooleanfalseOnly return elements visible in the current viewport. Set to true to reduce results on long pages.
includeContainersbooleanfalseInclude container/layout elements in the results:
Android containers: ViewGroup, FrameLayout, LinearLayout, RelativeLayout, ConstraintLayout, ScrollView, RecyclerView
iOS containers: View, StackView, CollectionView, ScrollView, TableView
includeBoundsbooleanfalseInclude element bounding box coordinates (x, y, width, height) in the response.
limitnumber0 (unlimited)Maximum number of elements to return.
offsetnumber0Number of elements to skip before returning results.
Example: Get elements 21–40:
Get elements with limit 20 and offset 20
Options for the get_accessibility_tree tool (browser-only).
limitnumber0 (unlimited)Maximum number of nodes to return.
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
The get_screenshot tool takes no parameters. Screenshots are automatically processed:
| 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 |
| Type | Description | Auto-Detach |
|---|---|---|
browser | 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 browser completely | Keeps browser running, disconnects WebDriver |
| Mobile App | Terminates app | Keeps app running in current state |
| Use Case | Clean slate for next session | Preserve state, manual inspection |
limit and offset) reduces token usage for screens with many elements| 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 |
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/statusappiumConfig in start_session matches the Appium server settingsANDROID_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