Integrations
Supported as a compatible web browser for WebDriver interaction, allowing the MCP server to automate Firefox browser sessions.
Allows AI agents to control web browser sessions through Selenium WebDriver, enabling web scraping, automated testing, and form filling by providing tools for navigation, element finding, clicking, sending keystrokes, and retrieving page content.
Selenium MCP Server
smithery badge
An MCP server that uses Selenium to interact with a WebDriver instance. Built using the MCP-Server-Starter template.
Overview
This server allows AI agents to control a web browser session via Selenium WebDriver, enabling tasks like web scraping, automated testing, and form filling through the Model Context Protocol.
Core Components
- MCP Server: Exposes Selenium WebDriver actions as MCP tools.
- Selenium WebDriver: Interacts with the browser.
- MCP Clients: AI hosts (like Cursor, Claude Desktop) that can utilize the exposed tools.
Prerequisites
- Node.js (v18 or later)
- npm (v7 or later)
- A WebDriver executable (e.g., ChromeDriver, GeckoDriver) installed and available in your system's PATH.
- A compatible web browser (e.g., Chrome, Firefox).
Getting Started
- Clone the repository:Copy
- Install dependencies:Copy
- Configure WebDriver:
- Ensure your WebDriver (e.g.,
chromedriver
) is installed and in your PATH. - Modify
src/seleniumService.ts
(you'll create this file) if needed to specify browser options or WebDriver paths.
- Ensure your WebDriver (e.g.,
- Build the server:Copy
- Run the server:Alternatively, integrate it with an MCP host like Cursor or Claude Desktop (see Integration sections below).Copy
Tools
This server will provide tools such as:
selenium_navigate
: Navigates the browser to a specific URL.selenium_findElement
: Finds an element on the page using a CSS selector.selenium_click
: Clicks an element.selenium_sendKeys
: Sends keystrokes to an element.selenium_getPageSource
: Retrieves the current page source HTML.- (Add more tools as needed)
TypeScript Implementation
The server uses the @modelcontextprotocol/sdk
and selenium-webdriver
libraries.
Development
- Build:
npm run build
- Run:
npm start
(executesnode build/index.js
) - Lint:
npm run lint
- Format:
npm run format
Debugging
Use the MCP Inspector or standard Node.js debugging techniques.
Integration with MCP Hosts
(Keep relevant sections from the original README for Cursor, Claude Desktop, Smithery, etc., updating paths and commands as necessary)
Cursor Integration
- Build your server:
npm run build
- In Cursor:
Settings
>Features
>MCP
: Add a new MCP server. - Register your server:
- Select
stdio
as the transport type. - Name:
Selenium Server
(or similar). - Command:
node /path/to/selenium-mcp-server/build/index.js
.
- Select
- Save.
Claude Desktop Integration
- Build your server:
npm run build
- Modify
claude_desktop_config.json
:Copy - Restart Claude Desktop.
Best Practices
- Use TypeScript and Zod for type safety and validation.
- Keep tools modular (e.g., one file per tool in
src/tools/
). - Handle WebDriver errors gracefully (e.g., element not found, navigation issues).
- Ensure proper WebDriver shutdown (e.g.,
driver.quit()
on server exit). - Follow MCP best practices for schemas, error handling, and content types.
Learn More
- Model Context Protocol Documentation
- Selenium WebDriver JS Documentation
- MCP TypeScript SDK Documentation
Credits
Based on the template created by Seth Rose:
- Website: https://www.sethrose.dev
- 𝕏 (Twitter): https://x.com/TheSethRose
- 🦋 (Bluesky): https://bsky.app/profile/sethrose.dev
This server cannot be installed
Allows AI agents to control web browser sessions via Selenium WebDriver, enabling web automation tasks like scraping, testing, and form filling through the Model Context Protocol.