selenium_mcp

andbet39/selenium_mcp

3.2

If you are the rightful owner of selenium_mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

A TypeScript implementation of an MCP server that provides Selenium WebDriver automation capabilities.

Tools
8
Resources
0
Prompts
0

MCP Selenium Server

A TypeScript implementation of an MCP (Model Context Protocol) server that provides Selenium WebDriver automation capabilities.

Overview

This MCP server provides web automation tools using Selenium WebDriver. It follows the official MCP TypeScript SDK patterns and uses stdio transport for communication.

Installation

# Install dependencies
npm install

# Build TypeScript
npm run build

# Run server
npm start

Development

# Watch mode (rebuilds on changes) 
npm run dev

# Build only
npm run build

Usage

The server runs with stdio transport by default:

node ./dist/server.js

Features

  • ✅ All essential Selenium WebDriver operations
  • ✅ Support for Chrome, Firefox, and Edge browsers
  • ✅ Simple state management (single browser session)
  • ✅ Full TypeScript type safety
  • ✅ Modern MCP SDK patterns
  • ✅ Clean, maintainable code structure

Available Tools

Browser Management

  • start_browser - Launch Chrome, Firefox, or Edge browser
  • close_session - Close the current browser session
  • get_session_info - Get information about current session

Navigation & Page Actions

  • navigate - Navigate to a URL
  • take_screenshot - Capture page screenshots

Element Interaction

  • click_element - Click on elements
  • send_keys - Type text into elements
  • get_element_text - Extract text from elements

Element Locator Strategies

All element interaction tools support these locator strategies:

  • id - Find by element ID
  • css - Find by CSS selector
  • xpath - Find by XPath
  • name - Find by name attribute
  • tag - Find by tag name
  • class - Find by class name

Example Usage

  1. Start a browser:
{
  "browser": "chrome",
  "options": {
    "headless": false
  }
}
  1. Navigate to a website:
{
  "url": "https://example.com"
}
  1. Click an element:
{
  "by": "id",
  "value": "submit-button"
}

Architecture

This server follows the MCP TypeScript SDK documentation patterns:

  • Uses McpServer class for server creation
  • Uses StdioServerTransport for communication
  • Simple state management without complex session handling
  • Clean tool registration with proper schemas
  • Proper error handling and cleanup