Configuration
This page documents all configuration options for the WebdriverIO MCP server.
MCP Server Configurationโ
The MCP server is configured through the configuration files or commands.
Basic Configurationโ
Edit your MCP configuration file (e.g. ./.mcp.json) and add the following:
{
"mcpServers": {
"wdio-mcp": {
"command": "npx",
"args": ["-y", "@wdio/mcp"]
}
}
}
Session Optionsโ
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.
Common Optionsโ
platformโ
- Type
"browser" | "ios" | "android"- Required
Yes
The platform to automate.
providerโ
- Type
"local" | "browserstack" | "saucelabs" | "testmu" | "testingbot"- Default
"local"- Required
No
Where the session runs. Use a cloud provider name for remote devices; each requires its own environment variables. See Cloud Providers for details.
Browser Session Optionsโ
Options for platform: "browser" sessions.
browserโ
- Type
"chrome" | "firefox" | "edge" | "safari"- Required
Yes (for browser platform)
Browser to launch.
browserVersionโ
- Type
string- Default
"latest"- Required
No
Browser version. Cloud providers only (default: latest).
os / osVersionโ
- Type
string- Required
No
Operating system for cloud provider browser sessions. Examples: os: "Windows", osVersion: "11" or os: "OS X", osVersion: "Sequoia".
headlessโ
- Type
boolean- Default
true- Required
No
Run browser in headless mode (no visible window). Set to false to see the browser.
windowWidthโ
- Type
number- Default
1920- Required
No
- Range:
400-3840
Initial browser window width in pixels.
windowHeightโ
- Type
number- Default
1080- Required
No
- Range:
400-2160
Initial browser window height in pixels.
navigationUrlโ
- Type
string- Required
No
URL to navigate to immediately after starting the browser. More efficient than calling start_session followed by navigate separately.
attachโ
- Type
boolean- Default
false- Required
No
Attach to an existing Chrome instance instead of launching a new one. Use after launch_chrome to connect via CDP.
attachConfigโ
- Type
{ port?: number; host?: string }- Default
{ port: 9222, host: "localhost" }- Required
No
Chrome remote debugging connection config. Only applies when attach: true.
Mobile Session Optionsโ
Options for platform: "ios" or platform: "android" sessions.
deviceNameโ
- Type
string- Required
Yes (for mobile platforms)
Name of the device, simulator, or emulator.
Examples:
- iOS Simulator:
"iPhone 16","iPad Air (5th generation)" - Android Emulator:
"Pixel 7","Nexus 5X" - Real Device: The device name as shown in your system
platformVersionโ
- Type
string- Required
No
OS version of the device/simulator/emulator (e.g., "18.0" for iOS, "14" for Android).
automationNameโ
- Type
"XCUITest" | "UiAutomator2"- Required
No
Automation driver. Defaults to XCUITest for iOS and UiAutomator2 for Android.
udidโ
- Type
string- Required
No (Required for real iOS devices)
Unique Device Identifier. Required for real iOS devices (40-character identifier).
Finding UDID:
- iOS: Connect device, open Finder, click on device โ Serial Number (click to reveal UDID)
- Android: Run
adb devicesin terminal
appPathโ
- Type
string- Required
No
Path to the application file to install and launch.
Supported formats:
- iOS Simulator:
.appdirectory - iOS Real Device:
.ipafile - Android:
.apkfile
Either appPath must be provided, or noReset: true to connect to an already-running app.
appโ
- Type
string- Required
No
Cloud 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.
appWaitActivityโ
- Type
string- Required
No (Android only)
Activity to wait for on app launch. If not specified, the app's main/launcher activity is used.
Example: "com.example.app.MainActivity"
Session State Optionsโ
noResetโ
- Type
boolean- Required
No
Preserve the app state between sessions. When true:
- App data is preserved (login state, preferences, etc.)
- Session will detach instead of close (keeps app running)
- Can be used without
appPathto connect to an already-running app
fullResetโ
- Type
boolean- Required
No
Completely reset the app before the session:
- iOS: Uninstalls and reinstalls the app
- Android: Clears app data and cache
Set fullReset: false with noReset: true to preserve app state completely.
Session Timeoutโ
newCommandTimeoutโ
- Type
number- Default
300- Required
No
How long (in seconds) Appium will wait for a new command before ending the session. Increase for longer debugging sessions.
Automatic Handlingโ
autoGrantPermissionsโ
- Type
boolean- Default
true- Required
No
Automatically grant app permissions on install/launch (camera, microphone, location, etc.).
This option primarily affects Android. iOS permissions must be handled differently due to system restrictions.
autoAcceptAlertsโ
- Type
boolean- Default
true- Required
No
Automatically accept system alerts (dialogs) during automation ("Allow notifications?", etc.).
autoDismissAlertsโ
- Type
boolean- Default
false- Required
No
Dismiss system alerts instead of accepting them. Takes precedence over autoAcceptAlerts when true.
Appium Server Connectionโ
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โ
- Type
{ host?: string; port?: number; path?: string }- Required
No
Appium server connection. Defaults to { host: "127.0.0.1", port: 4723, path: "/" }.
Cloud Provider Optionsโ
Credentialsโ
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โ
- Type
"us-west-1" | "eu-central-1" | "apac-southeast-1"- Default
"eu-central-1"- Required
No
Sauce Labs data center region. Ignored for other providers.
tunnelโ
- Type
boolean | "external"- Default
false- Required
No
Enable 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 only
Before 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.
tunnelNameโ
- Type
string- Required
No
Tunnel identifier name. Required when tunnel: "external" to match the running tunnel. When tunnel: true, a unique name is auto-generated if not provided.
reportingโ
- Type
{ project?: string; build?: string; session?: string }- Required
No
Cloud provider session labels visible in the provider's dashboard. Works identically across BrowserStack, Sauce Labs, TestMu, and TestingBot.
traceโ
- Type
boolean- Default
false- Required
No
Enable trace recording. Produces a Playwright-compatible .trace zip file saved to .trace/ on close_session. View traces at player.vibium.dev.
Element Detection Optionsโ
Options for the get_elements tool.
inViewportOnlyโ
- Type
boolean- Default
false- Required
No
Only return elements visible in the current viewport. Set to true to reduce results on long pages.
includeContainersโ
- Type
boolean- Default
false- Required
No
Include container/layout elements in the results:
Android containers: ViewGroup, FrameLayout, LinearLayout, RelativeLayout, ConstraintLayout, ScrollView, RecyclerView
iOS containers: View, StackView, CollectionView, ScrollView, TableView
includeBoundsโ
- Type
boolean- Default
false- Required
No
Include element bounding box coordinates (x, y, width, height) in the response.
Paginationโ
limitโ
- Type
number- Default
0 (unlimited)- Required
No
Maximum number of elements to return.
offsetโ
- Type
number- Default
0- Required
No
Number of elements to skip before returning results.
Example: Get elements 21โ40:
Get elements with limit 20 and offset 20
Accessibility Tree Optionsโ
Options for the get_accessibility_tree tool (browser-only).
limitโ
- Type
number- Default
0 (unlimited)- Required
No
Maximum number of nodes to return.
offsetโ
- Type
number- Default
0- Required
No
Number of nodes to skip for pagination.
rolesโ
- Type
string[]- Default
All roles- Required
No
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
Screenshotโ
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 |
Session Behaviorโ
Session Typesโ
| 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) |
Single-Session Modelโ
The MCP server operates with a single-session model:
- Only one browser OR app session can be active at a time
- Starting a new session will close/detach the current session
- Session state is maintained globally across tool calls
Detach vs Closeโ
| 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 |
Performance Considerationsโ
Browser Automationโ
- Headless mode is faster but doesn't render visual elements
- Smaller window sizes reduce screenshot capture time
- Element detection is optimized with a single script execution
- Screenshot optimization keeps images under 1MB for efficient processing
Mobile Automationโ
- XML page source parsing uses only 2 HTTP calls (vs 600+ for traditional element queries)
- Accessibility ID selectors are fastest and most reliable
- XPath selectors are slowest; use only as a last resort
- Pagination (
limitandoffset) reduces token usage for screens with many elements
Token Usage Tipsโ
| 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 |
Appium Server Setupโ
Before using mobile automation, ensure Appium is properly configured.
Basic Setupโ
# Install Appium globally
npm install -g appium
# Install drivers
appium driver install xcuitest # iOS
appium driver install uiautomator2 # Android
# Start the server
appium
Custom Server Configurationโ
# 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
Verify Installationโ
# Check installed drivers
appium driver list --installed
# Check Appium version
appium --version
# Test connection
curl http://localhost:4723/status
Troubleshooting Configurationโ
MCP Server Not Startingโ
- Verify npm/npx is installed:
npm --version - Try running manually:
npx @wdio/mcp - Check your harness' logs for errors
Appium Connection Issuesโ
- Verify Appium is running:
curl http://localhost:4723/status - Check
appiumConfiginstart_sessionmatches the Appium server settings - Ensure firewall allows connections on the Appium port
Session Won't Startโ
- Browser: Ensure the target browser is installed
- iOS: Verify Xcode and simulators are available
- Android: Check
ANDROID_HOMEand emulator is running - Review Appium server logs for detailed error messages
Session Timeoutsโ
If sessions are timing out during debugging:
- Increase
newCommandTimeoutwhen starting the session - Use
noReset: trueto preserve state between sessions - Use
detach: truewhen closing to keep the app running