- Home
- MCP servers
- Selenium
Selenium
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"nixon-suarez-mcp-selenium-webdriver": {
"command": "python",
"args": [
"server.py"
]
}
}
}You run an MCP server that orchestrates browser automation through Selenium, with stealth features, multi‑browser support, and robust session management to automate web tasks reliably across environments.
How to use
You start by launching the server in development mode or via the MCP CLI, then you create a browser session, navigate to pages, and interact with elements just like you would with Selenium. Use stealth options when you need to evade basic bot detection, and enable human‑like delays and scrolling for more realistic automation. You can manage multiple sessions at once, store cookies, and take screenshots for debugging.
How to install
Prerequisites you need before installing are Python 3.8 or higher and a browser installed (Chrome and/or Firefox). You also need basic system dependencies for Selenium.
# Clone or download the server package
# Example folder name shown here; use your actual path
cd mcp_selenium_server
# Install Python dependencies
pip install -r requirements.txt
Configuration and usage notes
The server supports predefined configurations for different scenarios: a default setup, a stealth mode tuned for evasion, and a performance‑oriented profile. You can also configure proxy settings to route traffic through HTTP, HTTPS, or SOCKS proxies. When using stealth, enable undetected chrome and randomized user agents and viewports to reduce detection risk. Use human‑like delays and scrolling to mimic real user interactions.
# Default configuration snippet
DEFAULT_CONFIG = ServerConfig(
max_sessions=10,
session_timeout=3600,
default_browser="chrome",
browser_options=BrowserOptions(
headless=False,
window_width=1920,
window_height=1080,
incognito=True
)
)
# Stealth configuration snippet
STEALTH_CONFIG = ServerConfig(
browser_options=BrowserOptions(
headless=True,
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36...",
disable_images=True,
custom_args=[
"--disable-blink-features=AutomationControlled",
"--disable-dev-shm-usage",
"--no-first-run"
]
),
detection_evasion=DetectionEvasionConfig(
use_undetected_chrome=True,
stealth_mode=True,
randomize_user_agent=True,
randomize_viewport=True
)
)
Usage patterns
-
Start a browser session and choose the desired options. The final start command can be a Python invocation such as
python server.pyin development mode. If you are using the MCP CLI, you can initiate your server withmcp dev server.pyor install withmcp install server.pyto prepare the environment for usage. -
From a client, create a session, then perform navigation, element interaction, keyboard input, and file uploads. Capture screenshots for verification, and close the browser when your workflow completes.
Examples of common workflows
# Start a browser session
result = start_browser(
browser_type="chrome",
options={"headless": False, "window_width": 1920, "window_height": 1080},
detection_evasion={"use_undetected_chrome": True, "stealth_mode": True}
)
session_id = result["session_id"]
# Navigate to a URL
navigate_to_url(session_id, "https://example.com")
# Find and interact with elements
element = find_element(session_id=session_id, strategy="css_selector", value="input[name='search']")
type_text(session_id=session_id, strategy="css_selector", value="input[name='search']", text="selenium automation")
click_element(session_id=session_id, strategy="css_selector", value="button[type='submit']")
# Take a screenshot
take_screenshot(session_id=session_id, file_path="/path/to/screenshot.png")
# Close the session
close_browser(session_id)
Available tools
start_browser
Starts a new browser session with the specified browser type and options.
close_browser
Closes a specific browser session by its session_id.
detect_available_browsers
Detects browsers installed on the host and returns a list of available options.
get_recommended_browser
Returns the browser recommended for the current environment.
check_browser_support
Verifies if the requested WebDriver is supported by the server.
navigate_to_url
Navigates the active browser session to a specified URL.
get_page_info
Retrieves information about the current page, such as title and URL.
execute_script
Executes a JavaScript snippet in the context of the active page.
find_element
Finds elements using various strategies (id, css_selector, xpath, etc.). Supports multiple elements.
click_element
Clicks on a located element.
type_text
Types text into an input or editable element.
upload_file
Uploads a file to an input of type file.
perform_mouse_action
Performs advanced mouse actions like hover, drag and drop, right-click, and double-click.
send_keys
Sends special keys (Enter, Tab, arrows, etc.) to the focused element.
take_screenshot
Takes a full page or element screenshot and saves it to a file.
apply_stealth_mode
Applies stealth techniques to reduce automation detection.
randomize_user_agent
Switches to a random user agent for the browser session.
randomize_viewport
Changes the browser viewport size to emulate different devices.
simulate_human_typing
Types with realistic typing delays to mimic human input.
scroll_like_human
Scrolls gradually to imitate natural user scrolling.
add_random_delay
Introduces random delays between actions to simulate human pacing.
list_active_sessions
Returns a list of currently active browser sessions.
get_session_info
Provides detailed information about a specific session.
close_all_sessions
Closes all active sessions.
cleanup_expired_sessions
Removes sessions that have exceeded their timeout.
manage_cookies
Manages cookies for the current session, including adding and removing cookies.
get_server_status
Returns the current status of the MCP server.
update_server_config
Updates server configuration using presets or custom values.