ma-pony/mcp-playwright
Playwright MCP Server 一个基于 FastMCP 框架的专业级 Playwright 浏览器自动化 MCP 服务器,为 LLM 应用提供强大的网页交互和数据提取能力。
一个基于 FastMCP 框架的专业级 Playwright 浏览器自动化 MCP 服务器,为 LLM 应用提供强大的网页交互和数据提取能力。
# 从 PyPI 安装(推荐)
pip install mcp-playwright
# 或使用 uv
uv add mcp-playwright
# 安装 Playwright 浏览器
playwright install
# 开发安装(从源码)
git clone https://github.com/ma-pony/mcp-playwright.git
cd mcp-playwright
# 使用 uv 安装依赖(推荐)
uv sync
# 或使用 pip
pip install -e .
# 安装 Playwright 浏览器
uv run playwright install
# 或
playwright install# 使用已安装的包
mcp-playwright
# 或从源码运行
python main.py
# 或使用 uv
uv run python main.py
# 使用 MCP 开发工具
uv run mcp dev main.py将以下配置添加到 Claude Desktop 的 MCP 配置文件中:
{
"mcpServers": {
"playwright": {
"command": "mcp-playwright"
}
}
}或者如果从源码运行:
{
"mcpServers": {
"playwright": {
"command": "uv",
"args": ["run", "python", "/path/to/mcp-playwright/main.py"],
"env": {}
}
}
}# 使用 create_browser_session 工具
await create_browser_session(
browser_type="chromium",
headless=True,
viewport_width=1280,
viewport_height=720
)await navigate_to_url("https://example.com")Loading reviews...