Selenium MCP Server
Automates Mozilla Firefox for web testing and interaction, including launching browser sessions, navigating pages, interacting with elements, taking screenshots, and executing custom scripts.
Automates Google Chrome for web testing and interaction, including launching browser sessions, navigating pages, clicking and filling elements, taking screenshots, and executing JavaScript in the page.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Selenium MCP Server Navigate to example.com and take a screenshot"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Selenium MCP Server π
A production-grade Model Context Protocol (MCP) server providing comprehensive browser automation capabilities powered by Selenium WebDriver communicating over standard I/O (stdio).
Designed for seamless integration with LLMs, AI agents, and IDEs including Antigravity IDE, Claude Desktop, Cursor, Windsurf, and any MCP-compliant client.
π Key Highlights
β‘ Multi-Browser Support: Chrome, Firefox, Microsoft Edge (headless or visible window).
π― Intelligent Locators: CSS Selectors, XPath, ID, Name, Tag, Class, Exact Text, and Partial Text matching.
π±οΈ Full Interaction Suite: Click, type/fill, clear, hover, dropdown selection, keyboard shortcuts, and form submissions.
πΈ Visual Intelligence: Full viewport screenshots or element-level screenshots returned directly as PNG images.
π§ Smart Content Extraction: Clean text, full HTML source, or interactive semantic DOM structures tailored for LLM reasoning.
π‘οΈ Advanced Automation: Explicit wait conditions, JavaScript execution in page context, multi-tab switching, frame switching, and cookie session management.
π€ Auto Driver Management: Utilizes Selenium 4+ built-in driver management (no manual driver installation required).
Related MCP server: Selenium MCP Server
π¬ Demo
https://github.com/AbyvargheseMandapathel/Selenium-MCP-Server/raw/main/demo.mp4
ποΈ Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI Agent / MCP Client β
β (Claude Desktop / Antigravity IDE / Cursor) β
βββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β stdio (JSON-RPC 2.0)
βββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ
β Selenium MCP Server (Node.js/TS) β
β β
β βββ WebDriverManager (Session lifecycle, locators, auto-exit)
β βββ Browser Tools (launch, navigate, history, resize) β
β βββ Interaction Tools(click, fill, hover, select, keys) β
β βββ Content Tools (extract, inspect, screenshot) β
β βββ Advanced Tools (scripting, waits, tabs, cookies) β
βββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ
β WebDriver Wire Protocol / CDP
βββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββ
β Browser (Chrome / Edge / Firefox) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββπ Prerequisites
Node.js: v18.0.0 or higher (Download Node.js)
Web Browser: At least one supported browser installed (Google Chrome, Firefox, or Microsoft Edge).
π¦ Installation & Build
Clone or navigate to the project directory:
cd "c:/Users/ABY/Desktop/project/selenium - mcp"Install dependencies:
npm installBuild the TypeScript source to JavaScript (
dist/):npm run build(Optional) Run the automated smoke test to verify stdio communication:
npm run test:smoke
βοΈ MCP Client Configuration
1. Antigravity IDE / Gemini IDE
Add the server to your .agents/mcp_config.json or global config:
{
"mcpServers": {
"selenium": {
"command": "node",
"args": ["c:/Users/ABY/Desktop/project/selenium - mcp/dist/index.js"],
"env": {
"SELENIUM_HEADLESS": "false",
"SELENIUM_BROWSER": "chrome"
}
}
}
}2. Claude Desktop
Add to %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"selenium": {
"command": "node",
"args": ["c:/Users/ABY/Desktop/project/selenium - mcp/dist/index.js"],
"env": {
"SELENIUM_HEADLESS": "false"
}
}
}
}ποΈ Headless vs. Visible (Headful) Mode
You can control whether the browser runs in the background (headless) or opens as a visible window on your screen:
Option A: Via AI Prompt / Tool Call
Simply ask your AI agent to run in visible or headless mode:
Visible mode: The agent calls
launch_browser({ headless: false })β Chrome/Edge/Firefox will pop up on your desktop so you can watch live clicks and typing.Headless mode: The agent calls
launch_browser({ headless: true })β Runs silently in the background with zero desktop interruption.
Option B: Server-Wide Default (via env)
Set the environment variable SELENIUM_HEADLESS in your MCP client config:
"SELENIUM_HEADLESS": "false": All browser sessions open as visible windows by default."SELENIUM_HEADLESS": "true"(default): All sessions run silently in headless mode.
3. Cursor
In Cursor Settings -> Features -> MCP Servers -> Add New MCP Server:
Name:
seleniumType:
commandCommand:
node "c:/Users/ABY/Desktop/project/selenium - mcp/dist/index.js"
π οΈ Complete Tools Reference
π 1. Browser Lifecycle & Navigation
Tool | Parameters | Description |
|
| Launch a new browser session with custom viewport, flags, and configuration. |
| (none) | Closes the active browser session and frees system resources. |
|
| Navigates the browser to the specified URL. |
| (none) | Returns current page URL and document title. |
|
| Navigates backward/forward in history or reloads the page. |
|
| Resizes the active browser window dimensions. |
π±οΈ 2. User Interactions
Tool | Parameters | Description |
|
| Scrolls element into view, waits until clickable, and clicks it. |
|
| Types text into an input field or textarea. |
|
| Clears all text from an input or textarea element. |
|
| Moves the mouse cursor over the target element. |
|
| Selects an option inside a standard HTML |
|
| Sends special keyboard keys to the page or target element. |
π 3. Content Inspection & Visuals
Tool | Parameters | Description |
|
| Extracts text, raw HTML, or interactive semantic DOM hierarchy. |
|
| Inspects matching elements and returns tag, text, classes, IDs, hrefs, and visibility. |
|
| Reads an HTML attribute (e.g. |
|
| Captures a high-resolution PNG screenshot of the full viewport or a specific element. |
β‘ 4. Advanced Execution & Flow
Tool | Parameters | Description |
|
| Runs custom JavaScript in the browser context with arguments and returns output. |
|
| Explicitly waits for an element to satisfy a condition. |
|
| Tab management: list open tabs, switch by index, create tab, or close current tab. |
|
| Full cookie session manipulation. |
|
| Changes driver execution context between iframes and parent documents. |
π― Locator Strategies Guide
When targeting elements, specify the strategy parameter:
Strategy | Example Selector | Notes |
|
| Standard CSS selector |
|
| Full XPath 1.0 support |
|
| Matches |
|
| Matches |
|
| Matches exact visible text |
|
| Matches substring of text |
|
| Matches class name |
|
| Matches HTML tag name |
π‘ Example AI Automation Prompt
Once configured in your MCP client, you can give high-level automation instructions like:
"Launch Chrome in visible mode, go to https://news.ycombinator.com, find the top 5 articles, extract their titles and URLs, and take a screenshot of the top story."
The LLM will automatically chain:
launch_browser({ browser: "chrome", headless: false })navigate({ url: "https://news.ycombinator.com" })find_elements({ selector: ".titleline > a", strategy: "css", limit: 5 })take_screenshot({ selector: ".athing:first-child", strategy: "css" })
π Project Structure
selenium - mcp/
βββ package.json # Package metadata and scripts
βββ tsconfig.json # TypeScript configuration
βββ mcp_config.example.json # Ready-to-use client config
βββ LICENSE # MIT License
βββ README.md # Complete documentation
βββ scripts/
β βββ smoke-test.js # Automated stdio JSON-RPC smoke test
βββ src/
βββ index.ts # Stdio server entry point
βββ driver/
β βββ manager.ts # WebDriverManager lifecycle & locators
βββ tools/
βββ index.ts # Central MCP tool registration
βββ browser.ts # Browser launch, navigation & history
βββ interaction.ts # Click, type, hover, select, keys
βββ content.ts # Text, HTML, elements & screenshots
βββ advanced.ts # JavaScript, waits, tabs, cookies, framesπ License
This project is licensed under the MIT License.
Available Tools
21 toolsclear_elementA
Clear text from an input or textarea element.
Inputs: selector (required), strategy, timeoutMs.
click_elementC
Click an element matching selector strategy (css, xpath, id, name, text, partialText).
Inputs: selector (required), strategy, timeoutMs.
close_browserA
Close the active Selenium browser session and free resources.
Inputs: no named parameters.
execute_scriptA
Execute arbitrary JavaScript code in the browser page context and return the result.
Inputs: script (required), args.
fill_elementA
Type text into an input or textarea element.
Inputs: text (required), selector (required), strategy, timeoutMs, +2 more.
find_elementsA
Find and inspect elements matching a selector, returning tag, text, attributes, and visibility.
Inputs: selector (required), limit, strategy.
get_current_urlA
Get current page URL and page title.
Inputs: no named parameters.
get_element_attributeA
Retrieve specific attribute or property (e.g. href, src, value, class) from an element.
Inputs: selector (required), attributeName (required), strategy, timeoutMs.
get_page_contentA
Retrieve text, full HTML source, or interactive structure outline of current page.
Inputs: format, maxLength.
hover_elementB
Hover mouse over a target element.
Inputs: selector (required), strategy, timeoutMs.
launch_browserA
Launch a browser instance (Chrome, Firefox, Edge) with optional headless mode, viewport dimensions, proxy, and custom arguments.
Inputs: args, proxy, width, height, +3 more.
manage_cookiesC
Manage browser cookies: get_all, get, set, delete, or delete_all.
Inputs: action (required), name, path, value, +3 more.
manage_tabsA
Manage browser tabs: list active tabs, switch tab, open new tab, or close tab.
Inputs: action (required), url, tabIndex.
press_keyA
Send special keyboard keys (ENTER, TAB, ESCAPE, BACK_SPACE, ARROWS, etc.) to page or element.
Inputs: key (required), selector, strategy.
select_dropdownB
Select an option in a HTML dropdown by value, visible text, or index.
Inputs: selectBy (required), selector (required), optionValue (required), strategy, +1 more.
set_window_sizeA
Set browser window width and height in pixels.
Inputs: width (required), height (required).
switch_frameB
Switch execution context to an iframe, parent frame, or default document.
Inputs: target (required), selector, strategy, frameIndex.
take_screenshotA
Take a screenshot of the current page viewport or a specific element and return PNG image data.
Inputs: selector, strategy.
wait_for_elementB
Wait until an element satisfies condition (present, visible, clickable, invisible).
Inputs: selector (required), strategy, condition, timeoutMs.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 21 tools
Each tool targets a distinct browser automation action: lifecycle, navigation, element interaction, query, and context management. Even similar tools like get_page_content, find_elements, and get_element_attribute are clearly separated by page-level, element-level, and attribute-level scope.
All tool names follow a consistent snake_case verb_noun pattern, such as launch_browser, click_elament, manage_tabs, and switch_frame. The single deviation, navigate_istory, still preserves the verb-object structure.
With 21 tools, the set falls into the 16-25 heavy range. While each tool represents a real Selenium operation, some could be consolidated (e.g., clear_element into fill_element), making the collection feel slightly over-scoped for an MCP server.
The tool surface covers the full browser lifecycle: launch, navigate, interact, query, and close, plus tabs, cookies, frames, wait conditions, and script execution. Missing advanced features like alert handling or drag-and-drop are workable via execute_cript or represent edge cases, but they are notable omissions.
Maintenance
Related MCP Connectors
Web scraping, browser automation, screenshots and AI data extraction for AI agents via MCP.
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Stealth web browser for agents: search, fetch, click, download and type in persistent MCP sessions.
Stealth web automation for AI agents. Login, signup, navigate, screenshot.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables browser automation using the Selenium WebDriver through MCP, supporting browser management, element location, and both basic and advanced user interactions.432MIT
- AlicenseCqualityBmaintenanceEnables AI assistants to automate web browser interactions through Selenium WebDriver. Supports multi-browser automation, element interaction, navigation, and web testing capabilities.56131 npm6MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to automate browser interactions using Selenium WebDriver, supporting multiple browsers and tools for navigation, clicking, typing, screenshots, and more.MIT
- AlicenseAqualityBmaintenanceEnables AI agents to control a real web browser (Firefox) via Selenium WebDriver, supporting page navigation, interaction, and inspection through natural language.434MIT