
一款由Playwright支持的高级网页浏览服务器,支持模型上下文协议(MCP),通过灵活且安全的API实现无头浏览器交互。
概览
一款由Playwright支持的高级网页浏览服务器,支持模型上下文协议(MCP),通过灵活且安全的API实现无头浏览器交互。 - : 访问任何带有SSL证书验证绕过功能的网站 - : 检索完整的HTML内容,包括动态加载的JavaScript - : 创建、管理和在多个浏览器标签页之间切换 - : - 提取文本内容 - 点击页面元素 - 将文本输入表单字段 - 截图截取 - 提取具过滤功能的页面链接 - 任意方向滚动页面 - 在页面上执行JavaScript - 刷新页面 - 等待导航完成 - : 在闲置后自动清理未使用的资源 - : 获取当前页面的详细元数据 - SSL证书验证绕过 - 安全的浏览器上下文管理 - 自定义用户代理配置 - 错误处理和全面日志记录 - 可配置超时设置 - CSP绕过控制 - 防止Cookie盗取 - :自动......
概述(AI 翻译)
一款由Playwright支持的高级网页浏览服务器,支持模型上下文协议(MCP),通过灵活且安全的API实现无头浏览器交互。
🌐 特色
- 无头网页浏览:访问任何带有SSL证书验证绕过的网站
- 全页内容提取:检索完整的HTML内容,包括动态加载的JavaScript
- 多标签页支持:创建、管理和切换多个浏览器标签页
- 高级网页交互工具:
- 提取文本内容
- 点击页面元素
- 将文本输入表单字段
- 截图截图
- 提取具有过滤功能的页面链接
- 任意方向滚动页面
- 在页面上执行JavaScript
- 刷新页面
- 等待导航完成
- 资源管理:闲置资源后自动清理
- 增强版页面信息:获取当前页面的详细元数据
🚀 快速启动
先决条件
- Python 3.10+
- MCP SDK
- 剧作家
安装
Claude Desktop 配置
在你的claude_desktop_config.json中添加:
💡 使用示例
基础网页导航
网络互动
截图截图
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
MCP Web Browser Server
An advanced web browsing server for the Model Context Protocol (MCP) powered by Playwright, enabling headless browser interactions through a flexible, secure API.
🌐 Features
- Headless Web Browsing: Navigate to any website with SSL certificate validation bypass
- Full Page Content Extraction: Retrieve complete HTML content, including dynamically loaded JavaScript
- Multi-Tab Support: Create, manage, and switch between multiple browser tabs
- Advanced Web Interaction Tools:
- Extract text content
- Click page elements
- Input text into form fields
- Capture screenshots
- Extract page links with filtering capabilities
- Scroll pages in any direction
- Execute JavaScript on pages
- Refresh pages
- Wait for navigation to complete
- Resource Management: Automatic cleanup of unused resources after inactivity
- Enhanced Page Information: Get detailed metadata about the current page
🚀 Quick Start
Prerequisites
- Python 3.10+
- MCP SDK
- Playwright
Installation
# Install MCP and Playwright
pip install mcp playwright
# Install browser dependencies
playwright install
Configuration for Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"web-browser": {
"command": "python",
"args": [
"/path/to/your/server.py"
]
}
}
}
💡 Usage Examples
Basic Web Navigation
# Browse to a website
page_content = browse_to("https://example.com")
# Extract page text
text_content = extract_text_content()
# Extract text from a specific element
title_text = extract_text_content("h1.title")
Web Interaction
# Navigate to a page
browse_to("https://example.com/login")
# Input text into a form
input_text("#username", "your_username")
input_text("#password", "your_password")
# Click a login button
click_element("#login-button")
Screenshot Capture
# Capture full page screenshot
full_page_screenshot = get_page_screenshots(full_page=True)
# Capture specific element screenshot
element_screenshot = get_page_screenshots(selector="#main-content")
Link Extraction
# Get all links on the page
page_links = get_page_links()
# Get links matching a pattern
filtered_links = get_page_links(filter_pattern="contact")
Multi-Tab Browsing
# Create a new tab
tab_id = create_new_tab("https://example.com")
# Create another tab
another_tab_id = create_new_tab("https://example.org")
# List all open tabs
tabs = list_tabs()
# Switch between tabs
switch_tab(tab_id)
# Close a tab
close_tab(another_tab_id)
Advanced Interactions
# Scroll the page
scroll_page(direction="down", amount="page")
# Execute JavaScript on the page
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"web-browser": {
"command": "python",
"args": [
"/path/to/your/server.py"
]
}
}
}