Skip to main content
No Result Found
Get your setup working faster. Join our Discord for optimisation tips from elite testers. Join our DiscordJoin our Discord

Set up the local BrowserStack MCP server

Install and configure the local BrowserStack MCP server for your AI-enabled client.

The BrowserStack Model Context Protocol (MCP) server is a secure local gateway that connects your AI-enabled clients, such as Cursor, or VS Code with GitHub Copilot or Cline, directly to the BrowserStack real device cloud. It acts as a command-line bridge, so you can use natural language prompts to run tests on websites and mobile apps.

Key benefits

Running the MCP server locally gives you the following benefits:

  • Test websites and apps hosted on your local machine or behind a corporate firewall.
  • Test your development and staging environments on thousands of real devices and browsers.
  • Keep your BrowserStack credentials and sensitive project details securely on your machine.

Authentication

The local MCP server uses your BrowserStack username and access key for API key-based authentication. You can provide your credentials in one of the following ways:

  • As environment variables, which we recommend.
  • In plain text in the MCP config file.

Install the MCP server locally

After you complete the prerequisites, you can install the server in one of the following ways:

Global installation

A global installation enables the MCP server for your user account in a specific client. This is the simplest way to get started. You can install the server in your preferred client using either a one-click installation or a manual setup.

One-click installation

We support a one-click installation for VS Code and Cursor. Before you begin, ensure your IDE is already installed. Use the following links to start the installation:

Client One-click link Requirement
VS Code Install in VS Code Requires VS Code. Download VS Code.
Cursor Install in Cursor Requires Cursor. Download Cursor.

Select an IDE below to visit its plugin page and follow the steps to complete the setup:

The following steps use GitHub Copilot as the AI assistant:

  1. Click the Install in VS Code link. VS Code MCP Server: BrowserStack page with the Install button
  2. The plugin page opens in VS Code. Click Install.
  3. In the input field that appears at the top of the IDE, enter your credentials as follows:
    • First, enter your BrowserStack username and press Enter.
    • Next, enter your access key and press Enter.
  4. Click the gear icon on the plugin page and select Start Server.

Video: Install and run the MCP server in VS Code with GitHub Copilot

Manual installation

To install manually, you need to create a configuration file in a user-level directory. Since the exact path is different for each client, choose your IDE below to see the specific instructions.

VS Code supports AI assistants such as GitHub Copilot and Cline. Follow these steps to set up the MCP server configuration file in your user-level VS Code configuration.

Follow the steps below to set up the MCP server configuration file in your user-level VS Code configuration using GitHub Copilot as the AI assistant:

Click the Tools icon in the GitHub Copilot Activity Bar to open the Tools menu.

Alternatively, open the Command Palette by selecting View > Command Palette from the top menu, or by pressing Ctrl+Shift+P on Windows or Linux, or Cmd+Shift+P on macOS. Run the MCP: Add Server command, and then skip to step 3.

Tools icon location in the GitHub Copilot Activity Bar in VS Code

Select Add MCP Server.

Tools menu options in VS Code with the Add MCP Server option

Select Install from an npm package.

npm package installation option in VS Code

For the package name, enter @browserstack/mcp-server.

npm package name input field where you enter @browserstack/mcp-server

Enter your BrowserStack username and access key when prompted, and press Enter.

Start the server in VS Code

To start the BrowserStack MCP server within VS Code, first open its configuration file, mcp.json. On macOS, this file is typically found at ~/Library/Application Support/Code/User/mcp.json.

With the file open, click the Start button provided in the VS Code editor’s interface to initialize the server.

Start button in the mcp.json file to run the BrowserStack MCP server

Video: Install the MCP server in VS Code

Let your agent do the setup

Most AI coding agents can install and configure the server themselves. Copy and paste this prompt into your agent:

Prompt
Copy icon Copy

Add the server with your client’s own command

Many MCP clients have their own command or settings screen for adding a server. Use the following table to find the command or configuration for your client:

Client Command or configuration
Claude Code claude mcp add --scope user browserstack -e BROWSERSTACK_USERNAME=YOUR_USERNAME -e BROWSERSTACK_ACCESS_KEY=YOUR_ACCESS_KEY -- npx -y @browserstack/mcp-server@latest
Codex codex mcp add browserstack --env BROWSERSTACK_USERNAME=YOUR_USERNAME --env BROWSERSTACK_ACCESS_KEY=YOUR_ACCESS_KEY -- npx -y @browserstack/mcp-server@latest
VS Code with GitHub Copilot code --add-mcp '{"name":"browserstack","command":"npx","args":["-y","@browserstack/mcp-server@latest"],"env":{"BROWSERSTACK_USERNAME":"YOUR_USERNAME","BROWSERSTACK_ACCESS_KEY":"YOUR_ACCESS_KEY"}}'
Cursor Add the JSON from the Cursor tab to ~/.cursor/mcp.json, or install the BrowserStack plugin for Cursor with BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY set in your environment.
Claude Desktop Go to Settings > Developer > Edit Config, and then add the JSON from the Claude tab.
Windsurf Go to Cascade > MCP servers > Add Server > Add custom server, with command npx, args ["-y","@browserstack/mcp-server@latest"], and the two credential environment variables.
Cline Go to Manage MCP Servers > gear icon > Configure MCP Servers, and then add the JSON from the VS Code > Cline tab to cline_mcp_settings.json.
Kiro In the Command Palette, run Kiro: Open user MCP config (JSON), and then add {"mcpServers":{"browserstack":{"command":"npx","args":["-y","@browserstack/mcp-server@latest"],"env":{"BROWSERSTACK_USERNAME":"YOUR_USERNAME","BROWSERSTACK_ACCESS_KEY":"YOUR_ACCESS_KEY"}}}} to ~/.kiro/settings/mcp.json.
Smithery Open the BrowserStack MCP server on Smithery, select your client, enter your username and access key, and follow the install command shown.
Any other MCP client Command npx, args ["-y","@browserstack/mcp-server@latest"], and env BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY.

Project-specific installation

A project-specific installation enables the server only for a particular project. This method offers more granular control, and the configuration is stored within the project’s directory. Choose an IDE from the options below to see the setup instructions:

The following steps use VS Code as the IDE and GitHub Copilot as the AI assistant:

  1. Create the file: In your project’s root, create a file at .vscode/mcp.json.

  2. Add the configuration: Paste the following configuration into the file and add your credentials:

.vscode/mcp.json
Copy icon Copy

If you are using NVM to manage multiple Node.js versions, refer to our NVM configuration guide to ensure the MCP server runs with the correct Node.js environment.

Start the server in VS Code with the GitHub Copilot agent

In your mcp.json file, click the Start button to run the server. Start button in the VS Code mcp.json file that starts the BrowserStack MCP server

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle