Skip to main content
Glama
Lokii0911
by Lokii0911

Selenium MCP 服务器

适用于 Selenium 浏览器自动化的 Python MCP 服务器,可直接部署。它支持本地 STDIO 使用方式和生产环境风格的 Streamable HTTP(位于 /mcp),并为容器平台提供了健康检查端点。

工具

  • browser_start, browser_stop, browser_reset, browser_state

  • navigate, go_back, go_forward, refresh

  • set_window_size, open_new_tab, switch_window, close_window

  • find_element, wait_for_element, click, type_text

  • get_text, get_attribute, execute_script, scroll

  • page_source, screenshot, save_screenshot

  • list_cookies, add_cookie, delete_cookies

定位策略:id, name, css selector, xpath, link text, partial link text, tag name, class name

Related MCP server: Selenium MCP Server

HTTP 端点

  • POST /mcp 及相关的 Streamable HTTP MCP 调用

  • GET /healthz

  • GET /readyz

  • POST /browser/start

  • POST /browser/stop

本地设置

Windows Python 前置条件

如果 PowerShell 提示 Python was not found,请先安装 Python 3.11+。最快捷的方法是:

winget install Python.Python.3.12

然后关闭并重新打开 PowerShell。如果 python --version 仍然打开 Microsoft Store 提示,请在以下位置禁用 python.exepython3.exe 的应用执行别名:

Settings > Apps > Advanced app settings > App execution aliases
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

PowerShell:

python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -e ".[dev]"

作为本地 STDIO MCP 服务器运行:

selenium-mcp

作为 Streamable HTTP MCP 服务器运行:

selenium-mcp-http

然后将 MCP 客户端连接到:

http://localhost:8000/mcp

Claude Desktop 示例

{
  "mcpServers": {
    "selenium": {
      "command": "selenium-mcp",
      "env": {
        "SELENIUM_BROWSER": "chrome",
        "SELENIUM_HEADLESS": "true"
      }
    }
  }
}

Docker

使用容器内的 Chromium 浏览器构建并运行:

docker build -t selenium-mcp .
docker run --rm -p 8000:8000 selenium-mcp

使用专用的 Selenium Grid 浏览器容器运行:

docker compose up --build

配置

.env.example 复制为 .env 并进行调整:

SELENIUM_BROWSER=chrome
SELENIUM_HEADLESS=true
SELENIUM_REMOTE_URL=
SELENIUM_IMPLICIT_WAIT_SECONDS=2
SELENIUM_PAGE_LOAD_TIMEOUT_SECONDS=30
SELENIUM_SCRIPT_TIMEOUT_SECONDS=30
SELENIUM_WINDOW_WIDTH=1440
SELENIUM_WINDOW_HEIGHT=1000
SELENIUM_ALLOW_FILE_URLS=false
SELENIUM_DEFAULT_DOWNLOAD_DIR=/tmp/selenium-downloads
SELENIUM_HTTP_HOST=0.0.0.0
SELENIUM_HTTP_PORT=8000
SELENIUM_MCP_TRANSPORT=stdio

对于远程 Selenium Grid,请设置:

SELENIUM_REMOTE_URL=http://selenium:4444/wd/hub

安全说明

此服务器可以浏览网页、执行 JavaScript、读取页面 HTML 并在主机上保存截图。在生产环境中,请将其运行在受限的容器或虚拟机中,限制出站网络访问,保持 SELENIUM_ALLOW_FILE_URLS=false,并将 HTTP MCP 端点置于您的平台身份验证层之后。

验证

ruff check .
pytest
Install Server
A
license - permissive license
B
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

View all related MCP servers

Related MCP Connectors

  • Provides cloud browser automation capabilities using Stagehand and Browserbase, enabling LLMs to i…

  • Automate cloud browsers to navigate websites, interact with elements, and extract structured data.…

  • Hosted real Google Chrome MCP with per-user persistent state. Navigate, click, type, screenshot.

View all MCP Connectors

Latest Blog Posts

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/Lokii0911/SeleniumMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server