selenium-mcp
The selenium-mcp server provides 38 tools for real-browser automation designed for AI agents to control Chrome, Firefox, or Edge via Selenium WebDriver.
Browser Lifecycle: Start/stop sessions with configurable options (browser type, headless mode, window size, timeouts); create, select, list, and destroy multiple parallel sessions.
Navigation: Open URLs, navigate to pages, get current URL and page title.
Element Discovery: Find elements by CSS, XPath, ID, name, class, tag, or link text; wait for visibility; capture page snapshots with stable element references; get page source.
User Interaction: Click (with retry for stale/intercepted elements), double-click, right-click, hover, type text, press keys, upload files.
Reading & Assertions: Get visible text, get attributes/properties; assert text or attribute values (equals, contains, regex); assert element visibility.
Scripting & Batching: Execute arbitrary synchronous JavaScript; batch multiple steps into a single tool call to reduce round-trips.
Selector Hints: Save, retrieve, list, and delete persistent selector hints per domain for more reliable repeat automations.
Windows, Frames & Alerts: List/switch/open/close tabs and windows; switch frame focus (by index, name/ID, selector, parent, or default content); handle alert, confirm, and prompt dialogs.
Cookies: Add, retrieve, and delete cookies with full configuration options.
Screenshots: Take PNG screenshots with optional save to disk and base64 output.
MCP Resources: Live browser/session status (browser-status://current) and accessibility snapshots (accessibility://current).
Observability: Optional NDJSON tracing of all tool calls for debugging and auditing.
Click on "Install 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-mcpOpen Chrome, go to example.com, 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
Selenium MCP server for AI agents — 39 tools for real-browser automation: navigation, clicking, typing, assertions, screenshots, multi-session management, page snapshots with stable element refs, persistent selector hints, and batched multi-step execution.
Built with TypeScript, the official MCP SDK, and Selenium WebDriver — strict zod input validation, explicit waits, and structured responses designed for LLM agents.
One-Click Install
Setup
claude mcp add selenium -- npx -y @gaforov/selenium-mcp@latestAdd to your client's MCP config (e.g. claude_desktop_config.json or .cursor/mcp.json):
{
"mcpServers": {
"selenium": {
"command": "npx",
"args": ["-y", "@gaforov/selenium-mcp@latest"]
}
}
}code --add-mcp '{"name":"selenium","command":"npx","args":["-y","@gaforov/selenium-mcp@latest"]}'goose session --with-extension "npx -y @gaforov/selenium-mcp@latest"Settings → Tools → AI Assistant → Model Context Protocol → Add, with command npx and arguments -y @gaforov/selenium-mcp@latest. Full walkthrough in docs/CLIENT_INTEGRATION.md.
git clone https://github.com/gaforov/selenium-mcp.git
cd selenium-mcp
npm install
npm run buildThen point your MCP client at node /absolute/path/to/selenium-mcp/dist/server.js.
Related MCP server: Selenium MCP Server
Example Usage
Ask your AI agent:
Use selenium-mcp to open Chrome, go to https://example.com, read the page title, take a screenshot, and close the browser.
The agent chains start_browser → navigate → get_title → take_screenshot → stop_browser on its own — no scripting needed.
Requirements
Node.js 20+
Chrome, Firefox, or Edge installed (Selenium Manager provisions the matching driver automatically)
How it compares
Most Selenium MCP servers wrap WebDriver's basic commands. This one adds the layer that makes agents reliable:
Capability | selenium-mcp | Typical Selenium MCP servers |
Page snapshot with stable element refs ( | ✅ | rare |
Persistent per-domain selector memory ( | ✅ | ❌ |
Parallel multi-session browsing | ✅ | rare |
Batched multi-step execution in one call | ✅ | ❌ |
Built-in test assertions | ✅ | some |
Tool-call tracing (NDJSON audit log) | ✅ | ❌ |
Strict input validation + structured errors | ✅ | varies |
Why selenium-mcp
Snapshot-first workflows —
capture_pagereturns a page snapshot with stable element refs the agent can act on directly, no brittle selector guessingSelector hints — persist working locators per domain so repeat automations get faster and more reliable over time
Batched execution —
batch_executeruns constrained multi-step sequences in a single tool call, cutting round-tripsMulti-session — create, select, list, and destroy parallel browser sessions
Agent-friendly errors — every response is structured and validated with zod, so agents can recover instead of stalling
Optional tracing — NDJSON trace of every tool call for debugging and auditing
Tools (39)
Category | Tools |
Browser lifecycle |
|
Navigation |
|
Element discovery |
|
Interaction |
|
Reading |
|
Assertions |
|
Scripting |
|
Selector hints |
|
Windows & context |
|
Cookies |
|
Capture |
|
Full parameter documentation: docs/TOOL_REFERENCE.md
MCP Resources
browser-status://current— live browser/session statusaccessibility://current— accessibility snapshot of the current page
Optional Tracing
Enable lightweight NDJSON tracing of all tool calls:
SELENIUM_MCP_TRACE=true
SELENIUM_MCP_TRACE_PATH=./logs/selenium-mcp-trace.ndjsonIf SELENIUM_MCP_TRACE_PATH is omitted, the default is logs/selenium-mcp-trace.ndjson.
Documentation
Contributing
Contributions are welcome — bug reports, feature requests, and pull requests. See CONTRIBUTING.md to get started.
npm run typecheck
npm run build
npm testLicense
MIT. See LICENSE.
Maintenance
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/gaforov/selenium-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server