需要本机有可用的 Chromium/Chrome 浏览器供 DrissionPage 驱动;需在 Codex 的 config.toml 或 MCP 客户端 JSON 中手动添加服务器配置并重启客户端;文件上传与下载受 DP_MCP_UPLOAD_ROOT、DP_MCP_DOWNLOAD_ROOT 环境变量限制。
Drissionpage-MCP-Server
jumodada活跃维护基于 DrissionPage 的 MCP 浏览器自动化服务,让 Claude Code、Codex 等 MCP 客户端直接操控浏览器完成网页操作与数据抓取。
DrissionPage MCP Server · Browser automation for Claude Code, Codex, and MCP clients
python -m pip install -U "drissionpage-mcp>=0.9.0"
drissionpage-mcp doctorREADME 未说明显存或 CPU 要求;浏览器执行依赖 Chromium/Chrome,集成测试基于 Chrome/Chromium 运行。
把 DrissionPage 的浏览器自动化能力封装成 69 个类型化 MCP 工具,供 Codex、Claude Code 等客户端直接调用
基于 DrissionPage 的 MCP 浏览器自动化服务,让 Claude Code、Codex 等 MCP 客户端直接操控浏览器完成网页操作与数据抓取。
核心能力
- 暴露 69 个类型化 MCP 工具,覆盖导航、标签页、元素交互与页面操作
- 提供 direct 与 natural 两种指针轨迹,natural 为确定性 24 步缓动路径
- 优先用 CSS/XPath 结构化选择器,视觉场景可回退到坐标点击
- 所有工具带 Pydantic 校验与类型提示,结果返回坐标、按钮等元数据
- 支持多标签页并发,同一标签页内动作串行执行
容易踩的坑
- v0.8.8最新正式版2026-09-09 · 2026-09-09 14:41 UTC
DrissionPage MCP Changelog · 0.8.0–0.8.8
中文
0.8.8 · 2026-09-08 — 网络监听稳定性
- 新增每次启动独立的
listener_token,用于关联监听等待和停止操作;过期令牌返回稳定的LISTENER_NOT_FOUND错误,避免误操作替换后的监听器。 - 监听结果新增状态、累计消费数量、单调递增的数据包索引、
next_cursor、启动计时、等待耗时及剩余超时预算。 - 修复取消等待时已被底层监听器消费的数据包丢失问题,后续等待可继续获取。
- 关闭标签页前关闭并清理该标签页拥有的监听器。
- 补充超时、取消、过期令牌、类型化输出、schema、脱敏及 100 次生命周期循环回归测试;发布记录包含真实 Chromium 双标签页隔离及 100 次启停验证。
0.8.7 · 2026-08-31 — 多标签页并发
- 63 个标签页作用域工具新增可选
tab_id,接受 MCP 和原生 DrissionPage 标签页 ID,成功结果统一返回稳定的 MCP ID。 - 调用开始时固定目标标签页,避免并发
tab_switch将执行中的操作重定向。 - 标签页操作改用独立锁:不同标签页可并行执行,同一标签页保持串行。
page_navigate(new_tab=true)新增background、new_window和临时独立上下文new_context选项。- 新增
TAB_NOT_FOUND、TAB_CLOSED生命周期错误;关闭标签页时拒绝新操作并等待已接纳的操作结束,浏览器清理时等待所有受管标签页的操作结束。 - 浏览器同步和后台创建标签页时保留 MCP 当前标签页;关闭临时上下文标签页时一并释放上下文。
- 产物导出和点击下载的操作去重指纹绑定目标标签页,跨标签页复用操作键时返回冲突,避免错误重放其他标签页的回执。
0.8.6 · 2026-08-30 — 安全脱敏与监听并发修复
- 统一公开响应脱敏边界,覆盖 URL、凭据、请求头、Cookie 写入结果、网络正文、错误、回执及文本镜像。
- 请求头和 Cookie 写入结果保留名称及有限元数据,值替换为
<redacted>;存储和 Cookie 读取仍可通过显式include_values=true返回值。 network_listen_wait不再占用全局操作锁,每个标签页的监听启动、等待和停止通过独立状态锁同步。- 修复取消等待时底层工作线程尚未结束就提前释放监听生命周期锁的问题。
0.8.5 · 2026-08-21 — 官方分发支持
- 新增 PyPI README 中的官方 MCP Registry 所有权标记,以及描述 PyPI 包和
stdio传输的版本化server.json。 - 新增版本标签触发的发布流程:校验元数据,通过可信发布上传 PyPI,等待包可用,再通过 GitHub OIDC 发布 Registry 条目。
- 补充官方 Registry、Cursor Directory 和 TRAE 安装链接的分发指引。
- 本版本未改变 MCP 工具、Prompts、资源、schema、浏览器行为或 Skills。
0.8.4 · 2026-08-20 — 跨域 iframe 可观测性
frame_list和内嵌 frame 摘要增加boundary、document_access及外层 iframe 证据,包括 CSS 展示状态、3D 祖先变换和坐标可操作性。- 元素几何结果新增
viewport_coordinate_space;element_scroll_into_view增加滚动前后几何信息和scroll_method。 - 保留旧的
rect.coordinate_space="target_document"字段,同时明确顶层和目标文档的视口坐标。 - 更新
cross-origin-iframe-probe和turnstile-testingSkills,依据当前能力选择 DOM、外层几何、滚动、指针、键盘和验证路径。 - Skills 目录固定到
skills-manager的v0.8.4,上述两个 Skills 升级至0.2.0并更新 SHA-256 元数据。 - 增加正常、隐藏、视口外、延迟及 3D 变换跨域组件的本地测试与十轮基准,并提供官方 Turnstile 测试密钥的可选验证;记录令牌是否存在及长度,不保留令牌内容。
- 未新增提供方专用公开工具,提供方工作流决策仍由外部 Skills 承担。
0.8.3 · 2026-08-17 — Skills 版本与完整性管理
- Skills 目录新增版本化 schema,包含每个 Skill 的版本、MCP 兼容范围、工具依赖、测试夹具、验证状态、固定来源版本及 SHA-256 完整性信息。
- 新增
playground/validate_skills.py,无需启动浏览器即可校验 frontmatter、目录路径、公开工具依赖、固定来源 URL 和内容哈希。 - 示例 Skill 来源固定到
skills-manager的v0.8.3,替代可变的mainURL。 - 可选目录资源的载荷上限扩展至 8192 字符,以容纳版本、依赖和完整性元数据。
- 更新发布文档、兼容说明、工具契约和 CI 校验;目录读取保持静态且独立于浏览器,Skills 不进入 wheel/sdist。
- 未新增公开工具、Prompts、浏览器行为或工具输入输出 schema,也未引入服务端 Skill 执行。
0.8.2 · 2026-08-14 — Skills 示例与使用文档
- 新增跨域 iframe 诊断、授权 Turnstile 测试及有界小红书风格内容研究的仓库 Skills 示例。
- 新增
docs/skills.md,说明 Skill 契约、目录、安全边界和干净发布环境中的测试夹具验证方式。 - 更新
drissionpage://skills/catalog,提供描述、路径、来源 URL 及repository_example状态。 - 更新中英文 README,说明宿主加载的 Markdown Skills 与原子 MCP 核心的职责。
- Linux 浏览器边界 CI 显式解析
CHROME_PATH,并在严格 Chromium 测试前验证浏览器启动。 - 未新增 MCP 工具、Prompts、浏览器能力或输入输出 schema;Skills 不由服务端导入或执行,也不进入 wheel/sdist。
0.8.1 · 2026-08-13 — 安装诊断与版本一致性
- 统一包、运行时、README、playground 和故障排查文档中的版本信息。
drissionpage-mcp doctor新增导入包路径、源码目录识别、已安装发行包元数据及公开接口数量检查。- 明确要求使用干净环境中的构建 wheel 或 sdist 进行发布验证,
doctor会显式标记源码目录运行。 - 未新增工具名称,也未改变输入输出 schema、浏览器行为、网络或下载能力。
0.8.0 · 2026-07-31 — 隐私保护与下载可靠性
storage_get默认隐藏非空 localStorage 和 sessionStorage 值,需显式设置include_values=true才返回原值。keyboard_press和键盘触发下载的结果返回脱敏输入元数据,不再回显输入文本或按键序列。element_click_and_download保留全部选择器和无障碍定位形式,新增严格的坐标及键盘触发方式。- 优先识别
BrowserConnectError和原生弹窗错误,保留稳定的启动失败及DIALOG_PENDING恢复码,同时隐藏底层本地化错误和 CDP 细节。 - 坐标与键盘下载触发在同一标签页内串行执行并共享截止时间;完善终止路径上的状态恢复、操作键重放和冲突检测,并新增 250 ms 防护窗口以取消结果不确定后的迟到下载任务。
- 将 mypy 纳入 CI 必检项,并补充安全、响应契约、下载成功与失败、超时、清理、重放、真实 Chromium 和 schema 回归验证。
升级关注点
- 依赖请求头或 Cookie 写入结果原值的调用方,需要适配 0.8.6 的
<redacted>返回值。 - 多标签页并发操作可显式传入
tab_id;网络监听可传入listener_token,确保操作关联到预期标签页和监听器实例。 - Skills 由宿主加载并独立分发,不随 Python wheel/sdist 打包,也不由 MCP 服务端执行。
- 本文整理已有发布记录,未重新执行其中列出的测试。
English
0.8
- 新增每次启动独立的
- 0.8.0v0.8.02026-08-03 · 2026-08-03 03:18 UTC
查看更新说明
DrissionPage MCP 0.7.2 to 0.8.0 Changelog
English
Highlights
- 0.7.2 - Core cleanup: Removed form, challenge, batch-action, and convenience workflow tools. Reusable procedures moved to clients or optional external Skills.
- 0.7.3 - Browser reliability: Improved repeated native input and added verified cross-origin iframe and closed Shadow DOM support.
- 0.7.4-0.7.5 - Browser state: Added Cookie mutation, request headers, user-agent control, cache clearing, and URL blocking.
- 0.7.6 - Better targeting: Added structured selector/accessibility targets, accessibility snapshots, dialog observation, and element state inspection.
- 0.7.7 - Browser-owned capabilities: Added permission controls, PDF/MHTML export, file-chooser upload, and isolated HTTP authentication.
- 0.7.8-0.7.9 - Compatibility and stability: Pinned the MCP SDK to 1.x, expanded doctor diagnostics, hardened public errors and JSON responses, and improved dialog, network wait, screenshot, timeout, and drag behavior.
- 0.8.0 - Contract stabilization: Added coordinate and keyboard download triggers, safer per-tab download cleanup and replay, redacted keyboard results, opt-in Web Storage values, improved browser error classification, and required mypy checks in CI.
中文
主要变化
- 0.7.2 - 核心精简: 移除表单、验证挑战、批量动作和便利流程工具, 可复用流程改由客户端或外部可选 Skills 组合。
- 0.7.3 - 浏览器可靠性: 改善重复原生输入,并验证跨源 iframe 和 closed Shadow DOM 支持。
- 0.7.4-0.7.5 - 浏览器状态: 新增 Cookie 修改、请求 header、user-agent、 cache 清理和 URL 屏蔽。
- 0.7.6 - 更强的定位能力: 新增结构化 selector/accessibility target、 accessibility 快照、dialog 观察和元素状态查询。
- 0.7.7 - 浏览器所有能力: 新增权限控制、PDF/MHTML 导出、 文件选择器上传和隔离 HTTP 认证。
- 0.7.8-0.7.9 - 兼容与稳定: 锁定 MCP SDK 1.x,扩展 doctor 诊断, 加固公开错误和 JSON 输出,并改善 dialog、网络等待、截图、timeout 和拖拽。
- 0.8.0 - 合同稳定: 新增坐标/键盘下载触发,加固按 tab 的下载 清理与 replay,键盘结果默认脱敏,Web Storage value 改为显式选择返回, 改善浏览器错误分类,并在 CI 中强制 mypy。
- 0.7.2v0.7.22026-07-22 · 2026-07-22 02:57 UTC
查看更新说明
新增
- 新增
page_dialog_respond,用于处理 alert、confirm 和 prompt 原生对话框:- 使用 DrissionPage 原生能力探测;
- Prompt 内容不会出现在公开结果或历史记录中;
- 返回与操作关联的
ActionReceipt。
- 新增
element_click_and_download,用于原子执行元素点击并等待对应下载:- 支持操作键重放保护,避免重复点击和重复下载;
- 校验文件大小和 SHA-256;
- 返回安全相对路径、
ArtifactRef和ActionReceipt; - 下载文件限制在
DP_MCP_DOWNLOAD_ROOT下。
page_pointer_drag新增最多 6 个有序waypoints,支持画布路径、地图拖动、 框选和可视化编辑器连接。element_click新增左键、右键、中键以及单击、双击语义。
变更
- 公开工具数量从 58 个调整为 53 个。
- 指针执行模型简化为两个确定性 profile:
direct:默认值,一步移动到精确目标;natural:固定 24 步的缓动三次贝塞尔轨迹;- 所有移动和拖动都会精确到达最终目标;
- 拖动失败后仍会尝试释放鼠标按键。
- 移除随机抖动、随机反应时间、overshoot、
preciseprofile 和显式合成 起始坐标,使指针行为可复现、更容易测试。 - 普通工具调用围绕共享浏览器上下文串行执行;
page_dialog_respond可以并发 响应阻塞中的原生对话框。 cleanup()会等待正在执行的工具调用结束,并阻止清理期间创建或使用新的 浏览器上下文,减少资源释放竞争。- 未知工具和无效参数会在浏览器初始化之前被拒绝。
- 保存截图时,公开结果只返回相对于
DP_MCP_SCREENSHOT_ROOT的规范化路径。 - MCP 引导面收敛为 0 个 MCP Prompt 和 1 个静态
drissionpage://skills/catalogResource。 - Action Receipt 和 Artifact 状态仅保留在下载、原生对话框等需要严格关联 时序和副作用的能力中。
- 可复用表单和视觉工作流迁移至 Python 分发包之外的可选 Skills。
修复
- 修复 Linux headless Chromium 下重复输入文本时清空失败的问题,改用 DrissionPage 跨平台清空路径后再执行真实输入。
- 修复原生对话框触发操作与响应操作之间可能发生的并发阻塞。
- 修复工具执行与服务器 cleanup 并发时的上下文释放竞争。
- 修复下载取消过程中可能遗留的异步任务和文件描述符状态。
安全性
- 下载策略拒绝会在点击、操作声明和文件分配之前执行。
- 下载文件使用稳定、禁止跟随符号链接的文件描述符进行哈希验证,降低路径 替换竞争风险。
- 公开 URL 会移除凭据、查询参数、fragment、本地路径和不安全协议。
- 截图、上传和下载结果仅公开安全相对路径。
- 对不确定的下载或对话框结果不会自动重试,避免重复外部副作用。
移除和兼容性变化
0.7.2 相比 0.6.1 移除以下 7 个公开工具,不提供兼容别名或占位工具:
已移除工具 推荐组合方式 form_inspectpage_snapshot、element_find_all、element_find和属性、文本读取form_fill_preview显式组合 element_type、element_select、element_check和状态读取page_detect_challengespage_observe、page_snapshot、聚焦元素读取和可选 Skill 分类page_click_xy_batch逐次调用 element_click或page_click_xy,每次操作后重新观察和验证page_wait_challenge_resultwait_until加 URL、文本、属性或 property 后置条件browser_open_and_snapshotpage_navigate后显式调用page_snapshot或page_observebrowser_extract_links使用有界的 element_find_all完成链接发现0.7.0 中曾加入、但最终未保留在 0.7.2 公开注册表中的
form_fill和form_submit,同样需要通过原子输入、激活、等待和状态读取工具组合实现。运行兼容性
- Python:
>=3.10。 - DrissionPage:
>=4.1.1.4,<5。 - MCP Python SDK:
>=1.0.0。 - 不支持 DrissionPage 5.x。
- 新增
- 0.6.1v0.6.12026-07-14 · 2026-07-14 03:30 UTC
查看更新说明
- 0.5.4v0.5.42026-07-03 · 2026-07-03 05:48 UTC
查看更新说明
Full Changelog: https://github.com/jumodada/Drissionpage-MCP-Server/compare/0.5.0...0.5.4
- 默认不再添加 --no-sandbox
- DP_NO_SANDBOX=1 仍会添加
- DP_NO_SANDBOX=0/false/no/off 不添加
- doctor 会提示 sandbox 被关闭
- README 不再在普通配置示例里建议关闭 sandbox
- 0.5.4 版本元数据一致性检查
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
DrissionPage MCP Server
Professional browser automation for Codex, Claude Code, and MCP clients, powered by DrissionPage.
DrissionPage is a Python web automation library built around direct Chromium/CDP control with requests-style HTTP session support. This server exposes its browser-facing capabilities as typed, atomic MCP tools.
Open the interactive Browser Lab to replay bounded natural pointer motion, drag controls, and verify observable state.
Official Repositories: GitHub | GitCode
🖱️ Atomic Browser Control with Natural Pointer Motion
DrissionPage MCP 0.9.0 exposes 69 typed browser capabilities. The MCP server provides accurate low-level observation and interaction; the client or an optional Skill composes those capabilities for a site, component library, challenge, or business workflow.
The model decides what to do; the MCP executes the requested browser operation exactly.
Screenshot / page observation
↓
Multimodal model identifies viewport coordinates
↓
page_click_xy(x=442, y=369, profile="natural")
↓
24-step eased cubic path → exact target → press → release
↓
Observe and verify the resulting page state
Core interaction guarantees
- Two bounded profiles:
directemits one exact move;naturalemits a deterministic 24-step eased cubic path with reproducible 8-14ms intervals and exact final arrival. - No hidden randomness: the same start, target, and profile produce the same path; there is no jitter, overshoot, or anti-detection logic. Pointer position is stateful, so a repeated call can begin from the previous endpoint.
- Explicit sequences: click is the selected move profile, optional caller-specified delay, press, release; drag keeps one press across the selected path and ordered waypoints.
- Failure-safe input: a pressed pointer button is released if execution fails after the press.
- Fresh browser evidence: selector geometry is resolved immediately before selector-backed drag operations.
- Typed results: outputs report the executed coordinates, button, step count, and explicit delay metadata.
Use structured DOM targets when reliable selectors exist. Use coordinates, natural motion, and explicit drag waypoints for canvas controls, editors, maps, charts, and other visual-only surfaces. Component-specific target discovery, challenge observation, multi-click sequencing, login procedures, and other business policy belong in the client or an optional Skill.
{
"x": 442,
"y": 369,
"profile": "natural",
"button": "left",
"element": "visually identified control"
}
Designed for authorized browser automation, testing, accessibility workflows, and technical research. The core does not provide challenge-specific or site-specific workflows.
🧭 Client Setup Navigation
- Atomic browser control
- Install + screenshot walkthrough
- Codex CLI/IDE quick setup
- Codex CLI/IDE integration example
- Skills and reusable procedures
- Claude Code setup
- Cursor setup
- Claude Desktop setup
- Troubleshooting
🚀 What is DrissionPage MCP?
DrissionPage MCP Server is a local Model Context Protocol (MCP) server that brings DrissionPage browser automation tools to Codex CLI/IDE, Claude Code, Claude Desktop, and other MCP clients.
The standalone server exposes 69 typed tools, zero MCP prompts, and one static optional-Skills catalog resource. Version 0.9.0 keeps that registry stable while tightening opt-in navigation policy matching and rejecting denied destinations before browser startup. Every tool loads by default; there is no capability profile or opt-in full mode. Models compose these atomic capabilities, while reusable challenge and site procedures live outside the distribution as optional Skills. Browser execution is powered by DrissionPage.
🌟 Why Choose DrissionPage MCP?
- Structured-First, Vision-Ready: Uses DOM structure when available and multimodal coordinates when visual interaction is the better tool
- Deterministic: Reliable element selection with CSS/XPath normalization for LLM-friendly selectors
- Natural Pointer Motion: Offers exact direct movement and a bounded deterministic 24-step eased trajectory from the same atomic tools
- Fast & Lightweight: Built on DrissionPage's efficient engine with minimal overhead
- Type-Safe: Full type hints and Pydantic validation for all tools
- Open-source Friendly: Includes compatibility notes, troubleshooting, and CI checks for maintainable contributions
- Easy Integration: Simple
pip install+ Codex TOML or MCP JSON configuration
✅ Quality and Real-World Validation
DrissionPage MCP is backed by a strict regression suite and browser-backed scenario checks:
- Strict automated tests: unit, protocol, schema snapshot, response-contract, resource, release-metadata, security-policy, browser-integration, and coverage checks run in CI.
- 95% coverage floor: CI enforces the current 95% coverage threshold and uploads coverage reports.
- Real browser verification: Chrome/Chromium-backed integration tests exercise the same MCP tools exposed to clients.
- Document-boundary verification: focused browser tests prove cross-origin OOPIF reads and DrissionPage-exposed closed Shadow DOM lookup without JavaScript piercing fallbacks.
- Challenge-surface verification: local fixtures cover normal, hidden, off-viewport, delayed, and CSS 3D cross-origin widgets; official Turnstile dummy keys cover visible, invisible, pass, fail, and forced-interactive callbacks without retaining tokens.
- Scenario validation: the playground MCP Lab covers realistic forms, commerce pages, social feeds, timelines, dynamic waits, iframe cases, and recovery paths without depending on public demo websites.
⚡ First Success Path
0.9.0 is currently a local candidate. Until it is published, validate it from a
source checkout with python -m pip install -e . or install a locally built wheel.
The PyPI version command below applies after publication.
# Install or update Codex CLI (macOS/Linux)
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# Install from PyPI
python -m pip install -U "drissionpage-mcp>=0.9.0"
# Verify package and environment
drissionpage-mcp --version
drissionpage-mcp doctor
The official installer updates an existing Codex CLI installation as well. For Windows and the Codex desktop app, see the official Codex CLI and app documentation.
Then add the Codex or MCP client configuration below and restart your client.
📦 Setup in Codex CLI/IDE (30 seconds)
Codex supports local stdio MCP servers through config.toml; the CLI and IDE extension share the same MCP configuration.
-
Edit Codex configuration:
- User-level:
~/.codex/config.toml - Project-level:
.codex/config.tomlinside a trusted project
- User-level:
-
Add this configuration:
[mcp_servers.drissionpage] command = "drissionpage-mcp" startup_timeout_sec = 20 tool_timeout_sec = 60 -
Restart Codex. In the TUI, run
/mcp; from a shell, runcodex mcp list.
For Claude Code, Claude Desktop, and other JSON-based MCP clients, see Integration Examples.
🎯 Quick Examples
Navigate and Screenshot
"Visit https://example.com and take a screenshot for me"
Search and Extract
"Go to Wikipedia, search for Python, and get the first paragraph"
Form Automation
"Fill out the form at https://httpbin.org/forms/post and submit it"
Data Scraping
"Get the top 10 news headlines from news.ycombinator.com"
🛠️ 69 Typed Browser Tools
All 63 tab-scoped tools accept an optional tab_id. Omit it to capture the MCP
current tab once at call start, or pass an MCP/native DrissionPage tab id to
target explicitly. Successful tab-scoped results return the resolved MCP
tab_id; independent tabs can run concurrently while actions on one tab remain
serialized.
🌐 Navigation (5 tools)
page_navigate- Navigate to any URL; target an existingtab_id, or combinenew_tab=truewith optionalbackground,new_window, ornew_context;observereturns a change summarypage_navigate_with_http_auth- Navigate through a scoped HTTP auth challenge in a dedicated disposable Chromium context without returning credentialspage_go_back- Navigate backward in browser historypage_go_forward- Navigate forward in browser historypage_refresh- Reload current page
🗂️ Tab Operations (3 tools)
tab_list- List open browser tabs with stable MCP tab IDstab_switch- Switch to a tab returned bytab_listtab_close- Reject new work, drain in-flight actions, then close one tab without closing the whole browser
🎯 Element Interaction & Extraction (16 tools)
element_find- Find one element by CSS selector or XPath; bare selectors likeh1are treated as CSSelement_find_all- Extract bounded repeated elements with text, attributes, and recommended selectorselement_click- Click any element with additive left/right/middle and single/double-click semanticselement_click_and_download- Correlate one selector, coordinate, or keyboard trigger with one integrity-checked artifact underDP_MCP_DOWNLOAD_ROOTelement_type- Input text into elementselement_upload_file- Useelement_upload_file(paths=[...])to upload files fromDP_MCP_UPLOAD_ROOTtoinput[type=file]element_click_and_upload- Arm Chromium's file chooser, click its trigger, inject approved files, and clean interception without an operating-system pickerelement_scroll_into_view- Bring an element into the viewport before actingelement_hover- Hover an element to trigger menu/tooltip stateselement_select- Select an option by value, text, or indexelement_check- Check or uncheck checkbox/radio controlselement_get_text- Get element or page textelement_get_attribute- Get an HTML attributeelement_get_property- Get a live DOM property such as an input valueelement_get_html- Get element or page HTMLelement_state_get- Read live DrissionPage state flags and document/viewport geometry for one element
📸 Page Operations (18 tools)
page_screenshot- Capture an inline full-page or viewport screenshotpage_screenshot_save- Save a screenshot underDP_MCP_SCREENSHOT_ROOTpage_export_artifact- Generate a managed PDF or MHTML artifact underDP_MCP_ARTIFACT_ROOTwith SHA-256 and receipt evidencepage_snapshot- Return a bounded page outline with headings, links, buttons, inputs, forms, and selector recommendationspage_accessibility_snapshot- Return a bounded Chromium accessibility tree for the page or a scoped element, with field values redacted unless explicitly requestedpage_observe- Return a compact page fingerprint with URL, title, counts, visible text samples, active element, and recent console summarypage_evaluate- Run bounded JavaScript in the current page and return a JSON-safe resultpage_scroll- Usepage_scroll(pixels=...)for relative scrolling, or passx/yfor an absolute positionkeyboard_press- Send keys to the active element/page without echoing the input in resultspage_resize- Adjust browser windowpage_pointer_move- Move to exact viewport CSS coordinates withdirector bounded deterministicnaturalmotionpage_pointer_drag- Perform one failure-safe coordinate drag through up to six optional ordered waypoints with the selected profilepage_pointer_drag_element- Resolve source and destination geometry immediately before dragging; supports CSS/XPath in the top document or one same-origin iframe, plus CSS paths through nested open Shadow DOM hostspage_click_xy- Move withdirectornaturalmotion, optionally wait for an explicit delay, then press and release at the exact targetpage_close- Close browserpage_get_url- Get current URLpage_dialog_observe- Wait for and inspect a pending native alert, confirm, or prompt without handling itpage_dialog_respond- Usepage_dialog_respond(action="accept")(or"dismiss") for one pending alert, confirm, or prompt
🧱 Frame / Shadow DOM (5 tools)
frame_list- List iframe/frame contexts without changing global frame stateframe_snapshot- Useframe_snapshot(frame_selector="...")orframe_indexto inspect one iframe with bounded outline dataframe_find- Find an element inside a selected iframeshadow_find- Find one element inside a shadow root exposed by the current supported DrissionPage runtime, including tested closed rootsshadow_find_all- Extract repeated elements from a DrissionPage-exposed shadow root
🌍 Browser Environment (6 tools)
browser_headers_set- Replace extra request headers and return names with redacted values; an empty object clears thembrowser_user_agent_set- Override the user agent and optional platform, returning both the accepted and previous user agentsbrowser_cache_clear- Clear HTTP cache while preserving Cookies, localStorage, and sessionStoragebrowser_permission_get- Query one browser permission for the current document origin without opening an OS promptbrowser_permission_set- Usebrowser_permission_set(setting="granted")(or"denied"/"prompt") for an exact origin/current Chromium contextbrowser_permissions_reset- Reset permission overrides for the current Chromium context
🍪 Cookies & Storage (7 tools)
browser_cookies_get- Read normalized cookies with values redacted by defaultbrowser_cookies_set- Set up to 100 cookies in one call and return accepted metadata with redacted valuesbrowser_cookies_delete- Delete one named cookie with optional URL/domain/path scopebrowser_cookies_clear- Clear all browser cookiesstorage_get- Read localStorage/sessionStorage by key or as a map, with values redacted unlessinclude_values=truestorage_set- Set one localStorage/sessionStorage item without echoing the valuestorage_clear- Clear one storage key or an entire storage area
🧪 Debug / Observability (1 tool)
page_console_logs- Read bounded browser console messages with level filtering, cursor pagination, and limits
⏱️ Wait Operations (4 tools)
wait_for_element- Wait for element to appear (with timeout)wait_for_url- Usewait_for_url(url_pattern="...")until the current URL contains the supplied textwait_until- Usewait_until(condition="text_contains", value="...")or another documented condition/value pairwait_time- Delay execution
🌐 Network Control & Observation (4 tools)
network_listen_start- Start bounded HTTP/XHR/Fetch observation through DrissionPagenetwork_listen_wait- Wait for bounded packet metadata with optional redacted headers or body excerptsnetwork_listen_stop- Stop observation and optionally clear queued packetsnetwork_blocked_urls_set- Usenetwork_blocked_urls_set(urls=[...])to replace blocked URL patterns; an empty list clears them
🧩 Optional Skills Discovery
- Resource:
drissionpage://skills/catalog - Prompts: none
- Repository examples:
cross-origin-iframe-probe,turnstile-testing, andxiaohongshu-content-research - Entry point:
skills/<skill-name>/SKILL.md; catalog schema v2 includes Skill/MCP versions, required tools, fixture, fixedv0.8.4source revision, verification status, and SHA-256 - Skills are Markdown procedures for the MCP host. They are not Python modules, are not executed by the server, and are excluded from wheel/sdist packages.
Validate a source checkout with python playground/validate_skills.py --json.
Install the fixed catalog release from
[email protected]
with python install.py install --client codex --json or
python install.py install --client claude --json.
📖 Skills and Reusable Procedures
The MCP core exposes atomic browser operations. Skills provide reusable, reviewable procedures outside the server:
| Example Skill | What it demonstrates | Stop boundary |
|---|---|---|
cross-origin-iframe-probe | Frame discovery, cross-origin diagnosis, coordinate fallback, and outside verification | Cannot read the inner DOM of a cross-origin iframe |
turnstile-testing | Cloudflare test fixtures, authorized production challenge interaction, coordinate geometry, and parent-page checks | Use the documented support matrix and verify the resulting page state |
xiaohongshu-content-research | Bounded read-only note research and the deterministic social-notes fixture | Stop on robots, login, captcha, safety page, or rate limit |
Read the full Skills guide before publishing a new procedure.
Skills must use existing typed tools, collect fresh evidence, verify
postconditions, redact secrets, and state unsupported cases. They do not add
new MCP tools or override the server's navigation and safety policy. Multi-tab
Skills should carry the returned MCP tab_id into later tab-scoped calls rather
than relying on mutable current-tab state.
📚 Documentation
| Guide | Description |
|---|---|
| README.md | Installation, tools, and architecture |
| docs/compatibility.md | Supported Python, DrissionPage, MCP, and browser versions |
| docs/tool-contract.md | Public MCP tool names, inputs, annotations, and response shape |
| docs/troubleshooting.md | Doctor command, browser startup, and client setup fixes |
| CHANGELOG.md | Release notes |
🏗️ Architecture
Built with clean, modular design:
DrissionMCP/
├── drissionpage_mcp/
│ ├── cli.py # Process entry point
│ ├── server.py # MCP transport and request routing
│ ├── context.py # Browser and tab lifecycle facade
│ ├── runtime.py # Operation keys, receipts, artifacts, and capability state
│ ├── tool_outputs.py # Typed public result contracts
│ ├── browser/ # Focused DrissionPage capabilities and page scripts
│ └── tools/ # 69 typed MCP tool definitions and thin adapters
├── tests/ # Unit tests
└── playground/ # MCP Lab business-scenario playground
Key Principles:
- ✅ Type-safe Pydantic models for all tools
- ✅ Async/await throughout
- ✅ Clean separation of concerns
- ✅ Comprehensive error handling
- ✅ Unit and protocol test coverage for core tool registration/response behavior
🔧 Configuration
Codex CLI / IDE (Recommended)
[mcp_servers.drissionpage]
command = "drissionpage-mcp"
startup_timeout_sec = 20
tool_timeout_sec = 60
# Optional browser/runtime environment variables:
# [mcp_servers.drissionpage.env]
# CHROME_PATH = "/custom/path/to/chrome"
# DP_HEADLESS = "1"
You can also add it with the Codex CLI:
codex mcp add drissionpage -- drissionpage-mcp
If Codex/Cursor/Claude Desktop is launched from a GUI and cannot see your shell
PATH or virtualenv, use the absolute Python executable instead:
[mcp_servers.drissionpage]
command = "/absolute/path/to/python"
args = ["-m", "drissionpage_mcp.cli"]
startup_timeout_sec = 20
tool_timeout_sec = 60
JSON MCP Clients
{
"mcpServers": {
"drissionpage": {
"command": "drissionpage-mcp"
}
}
}
Advanced JSON Setup
{
"mcpServers": {
"drissionpage": {
"command": "drissionpage-mcp",
"args": ["--log-level", "DEBUG"],
"env": {
"CHROME_PATH": "/custom/path/to/chrome"
}
}
}
}
Absolute-Python fallback for GUI clients:
{
"mcpServers": {
"drissionpage": {
"command": "/absolute/path/to/python",
"args": ["-m", "drissionpage_mcp.cli"],
"env": {
"CHROME_PATH": "/custom/path/to/chrome",
"DP_HEADLESS": "1"
}
}
}
}
📋 Requirements
- Python 3.10+ (3.11+ recommended)
- Chrome or Chromium browser
- Any MCP-compatible client: Codex CLI/IDE, Claude Code, Claude Desktop, Cursor, VS Code, etc.
🧪 Testing
Verify Installation
# Environment diagnostics; add --launch-browser for a browser startup check
drissionpage-mcp doctor
drissionpage-mcp doctor --launch-browser
# Source checkout tests
python -m pip install -e ".[dev]"
python -m pytest tests/
# Coverage report (CI enforces the current 95% floor and uploads coverage.xml)
python -m pytest tests/ --cov=drissionpage_mcp --cov-report=term-missing --cov-report=xml
# Browser-backed MCP Lab scenario checks
DP_HEADLESS=1 python playground/run_mcp_lab.py --all --json
GitHub Actions runs lint, unit, protocol, package, browser integration, and
coverage jobs. Codecov is configured through codecov.yml and the CI workflow.
Try It Out
# No-browser MCP registry check
python playground/run_mcp_lab.py --case registry
# Local deterministic site check
python playground/run_mcp_lab.py --case site
# Browser-backed form inspection scenario
DP_HEADLESS=1 python playground/run_mcp_lab.py --case form-inspect
🚀 Use Cases
✅ Automated Testing - Test web applications ✅ Data Scraping - Extract structured data from websites ✅ Form Automation - Fill and submit forms ✅ Monitoring - Check for updates or changes ✅ Screenshot Verification - Capture and verify page state ✅ Content Analysis - Analyze web content programmatically
🐛 Troubleshooting
Tools Not Loading?
drissionpage-mcp --version
Should output the installed package version, for example drissionpage-mcp 0.9.0.
drissionpage-mcp doctor must also report both mcp_supported and
mcp_server_wiring as ok; package-version output alone does not prove that an
MCP client can initialize the server.
Browser Issues?
# Check browser installation
which google-chrome # Linux
which chromium # macOS
Codex / MCP Client Not Finding Server?
- Codex: run
codex mcp list; in the TUI, run/mcp - JSON clients: verify config file path and JSON syntax
- Restart Codex or your MCP client after changes
- Check logs:
drissionpage-mcp --log-level DEBUG
See docs/troubleshooting.md for the complete troubleshooting guide.
📊 Project Status
| Component | Status |
|---|---|
| Core Features | ✅ Complete |
| Testing | ✅ Strict unit/protocol/schema checks plus browser-backed scenarios |
| Documentation | ✅ Setup, compatibility, troubleshooting, and public tool contracts |
| Package | ✅ PyPI metadata and build checks |
| Status | 🟡 Beta; real browser behavior depends on local Chrome/Chromium and target sites |
Version: 0.9.0 development candidate | License: Apache 2.0 | Maintained: ✅ Active
🗺️ Roadmap
Current candidate (v0.9.0)
- 69 atomic navigation, tab/frame/shadow, accessibility, observation, interaction, browser-environment, network, Cookie/storage, wait, and console tools, all loaded by default
- stdio MCP server integration
- Doctor diagnostics for local setup
- Stable JSON mirror,
structuredContent, and typed per-tool MCPoutputSchema - Structured recovery hints in
error.details.hintsfor common failures - Sanitized browser failures with
DIALOG_PENDING/DIALOG_NOT_FOUNDrecovery and strict standards-compliant JSON for non-finite JavaScript values - Balanced
page_snapshotoutput so link-heavy pages still expose controls and forms - Optional case-insensitive literal
page_snapshot(query=...)search with bounded, replayable continuation cursors tied to one tab and document generation - Atomic type, select, check, click, keyboard, upload, wait, and state-read tools cover native controls and framework-driven widgets without library-specific branches
- Stable optional
tab_idtargeting across 63 tab-scoped tools, per-tab action serialization, target isolation, and draining close/cleanup semantics - Tab management with
tab_list,tab_switch,tab_close, andpage_navigate(new_tab=true, background=..., new_window=..., new_context=...) - Tab-owned network listener tokens, packet cursors, timeout evidence, cancellation-safe packet recovery, and deterministic close cleanup
- Observable actions with
page_observe,page_evaluate,wait_until, and optionalobserve=truechanges on navigation, click, and type - Deadline-bounded
wait_until, includingready_statewaits, and optionalpage_navigate(timeout=...)evidence for final URL/readiness and non-negative navigation, settle, and total timing - Console observability with
page_console_logs, console summary inpage_observe, and console change fields inobserve=true - Form, component-library, challenge, and convenience workflows remain outside the MCP core
- Repository example Skills for cross-origin iframes, authorized Turnstile fixtures, and bounded Xiaohongshu-like research are discoverable through the static catalog and excluded from wheel/sdist packages
- Capability-probed
page_dialog_respond, additive double/context click behavior, and selector/coordinate/keyboard download correlation with safeArtifactRefmetadata - Secret-bearing Web Storage values require
include_values=true; keyboard and keyboard-download results expose redacted metadata only - Per-tab download trigger locking, shared deadlines, cleanup/replay guarantees, and a 250ms fail-closed late-mission guard
- Reproducible W01-W08 public-tool benchmark with ten isolated runs per workload, machine-readable evidence, and zero duplicate side effects
- Network listener beta with
network_listen_start,network_listen_wait, andnetwork_listen_stopfor HTTP/XHR/Fetch observation - Public-response redaction for URLs, credentials, headers, Cookies, network bodies, errors, receipts, and text mirrors; listener waits are isolated from unrelated browser actions
- Browser-only request environment control with redacted header, user-agent, and blocked-URL write results plus cache-only clearing that preserves Cookies and Web Storage
-
directand deterministic boundednaturalprofiles forpage_pointer_move,page_pointer_drag, andpage_click_xy, with exact endpoints and failure-safe release - Optional bounded
page_pointer_drag.waypointsfor one held multi-segment canvas, map, box-selection, or visual-editor gesture - File upload, scrolling, hover, select/check, keyboard, iframe, shadow DOM, cookie, and storage tools for DrissionPage 4.x
- Pure browser Cookie set/get/delete/clear flow, including bounded batch writes whose successful results retain metadata with redacted values
- Ten-cycle controlled and validation input replacement through native DrissionPage input on the supported browser matrix
- Cross-origin OOPIF reads through
frame_*and closed Shadow DOM lookup through DrissionPage-backedshadow_*, with narrower pointer targeting documented separately - Frame boundary/document-access classification plus outer presentation, top-level viewport coordinate, scroll receipt, and coordinate-actionability evidence for production challenge workflows
- Local challenge-surface and opt-in official Turnstile test-key benchmarks with parent-page postconditions, screenshots, and token-safe evidence
- Backward-compatible string or structured selector/accessibility targets across element reads, actions, waits, uploads, and click-download correlation, resolving ordered frames first and then ordered Shadow DOM hosts
- Bounded accessibility snapshots, non-handling native dialog observation, and live element state/geometry for autonomous locate-act-verify loops
- Browser permission observation/set/reset, managed PDF/MHTML artifacts, automatic file chooser interception, and credential-redacted HTTP auth isolated by disposable Chromium context
- Chrome sandbox remains enabled by default;
DP_NO_SANDBOX=1is reserved for restricted container/root environments - No retained action history, generated code snippets, or absolute screenshot paths in public results
- Opt-in local safety policy for navigation and screenshot paths
- One optional-Skills catalog resource with repository example metadata, zero prompts, plus Skills, eval, compatibility, and troubleshooting documentation
- Structured navigation policy checks before browser startup, bounded Skills compatibility, and full-CI release artifact reuse
- Local 0.9.0 package metadata and clean-installed-package smoke coverage
- Publish 0.9.0 to PyPI and the MCP Registry after release gates complete
📖 Integration Examples
Codex CLI / IDE
[mcp_servers.drissionpage]
command = "drissionpage-mcp"
startup_timeout_sec = 20
tool_timeout_sec = 60
Verify with:
codex mcp list
Claude Code
{
"mcpServers": {
"drissionpage": {
"command": "drissionpage-mcp"
}
}
}
Config file: ~/.config/claude-code/mcp_settings.json (macOS/Linux) or
%APPDATA%\claude-code\mcp_settings.json (Windows).
Cursor
{
"mcpServers": {
"drissionpage": {
"command": "drissionpage-mcp"
}
}
}
Config file: ~/.cursor/mcp.json (global) or .cursor/mcp.json (project). You
can also add it from Cursor Settings → Tools & MCPs → New MCP Server.
Claude Desktop
{
"mcpServers": {
"drissionpage": {
"command": "drissionpage-mcp"
}
}
}
Once connected, the tools load automatically:
🤝 Contributing
Contributions are welcome!
- Fork the repository
- Create a feature branch
- Make focused changes
- Run the relevant checks
- Submit a pull request
See CONTRIBUTING.md for setup, validation, and compatibility expectations.
🔒 Security
- Runs locally in your environment
- Uses a local browser that may have access to authenticated sessions, cookies, downloads, and page content
- Can open and interact with any site reachable from the local machine
- Does not require external API credentials
Best Practices:
- Use a dedicated browser profile for sensitive workflows
- Review MCP client prompts before allowing actions on authenticated or production systems
- Respect website terms of service, robots.txt, and rate limits
- See SECURITY.md for reporting and safe-usage guidance
📄 License
Licensed under Apache License 2.0 - see LICENSE
📈 Statistics
🌟 Show Your Support
If you find this project useful, please consider:
- ⭐ Starring on GitHub
- 📤 Sharing with your network
- 💬 Leaving feedback or suggestions
- 🐛 Reporting issues to help improve
Made with ❤️ by Wukunyun
Ready to automate your workflows? Install now: python -m pip install -U drissionpage-mcp
🆕 Current Candidate: v0.9.0
Candidate dated 2026-10-20. This is the current local implementation, not a claim of external publication or a completed hosted multi-platform CI run:
- Opt-in navigation allow/block URL rules use structured origin and path-boundary matching instead of raw string prefixes. Host-only rules continue to include subdomains.
- Denied
page_navigateandpage_navigate_with_http_authcalls returnPOLICY_DENIEDbefore initializing Chromium, creating a tab, or applying auth credentials. - Matching is an operator-side navigation check, not a complete network sandbox: it does not constrain redirects, page scripts, iframes, DNS rebinding, or later browser requests.
- Skills metadata accepts MCP 0.9.0 within bounded compatibility ranges while retaining schema v2, the fixed
skills-managerv0.8.4revision, and existing content hashes. Remote validation currently fails because pinned raw GitHub URLs return HTTP 404. - Release tags run the complete CI workflow before upload and reuse the exact SHA256-verified wheel and sdist artifacts that passed package smoke tests.
- The public surface remains 69 tools, zero prompts, and one static Skills catalog resource. No runtime dependency or capability profile was added.
