Playwright Fetch MCP Server

by ThreatFlux
MIT License

Integrations

  • Integrates with Codecov for code coverage reporting and tracking through CI/CD workflows.

  • Offers pre-built Docker images available through Docker Hub and GitHub Container Registry for containerized deployment.

  • Enables integration with GitHub through container registry support and CI/CD workflows.

剧作家获取 MCP 服务器

一个模型上下文协议 (MLM) 服务器,使用 Playwright 提供 Web 内容抓取功能,实现浏览器自动化。该服务器使 LLM 能够从网页中检索和处理 JavaScript 渲染的内容,并将 HTML 转换为 Markdown 格式,以便于使用。

作者

Wyatt Roersma在 Claude Code 的协助下创建。

主要特点

  • 浏览器自动化:使用 Playwright 呈现具有完整 JavaScript 支持的网页
  • 内容提取:自动识别并提取网页的主要内容区域
  • Markdown 转换:将 HTML 转换为干净、可读的 Markdown
  • 分页支持:通过分页处理大量内容
  • Robots.txt 合规性:尊重 robots.txt 指令以进行自主抓取
  • 代理支持:允许通过代理服务器路由请求
  • Docker Ready :可通过Docker HubGitHub Container Registry获取预构建的 Docker 镜像

可用工具

  • playwright-fetch - 使用 Playwright 浏览器自动化获取 URL 并将其内容提取为 markdown。
    • url (字符串,必需):要获取的 URL
    • max_length (整数,可选):返回的最大字符数(默认值:5000)
    • start_index (整数,可选):从此字符索引开始内容(默认值:0)
    • raw (布尔值,可选):获取不带 markdown 转换的原始内容(默认值:false)
    • wait_for_js (布尔值,可选):等待 JavaScript 执行(默认值:true)

提示

  • 剧作家取回
    • 使用 Playwright 获取 URL 并将其内容提取为 markdown
    • 参数:
      • url (字符串,必需):要获取的 URL

要求

  • Python 3.13.2 或更高版本
  • uv包管理器
  • 已安装 Playwright 浏览器

安装

1.使用uv安装(推荐)

uv pip install git+https://github.com/ThreatFlux/playwright-fetch.git # Install Playwright browsers uv pip exec playwright install

或者,克隆存储库并安装:

git clone https://github.com/ThreatFlux/playwright-fetch.git cd playwright-fetch uv pip install -e . # Install Playwright browsers uv pip exec playwright install

2.使用Docker

您可以使用我们从 Docker Hub 或 GitHub Container Registry 预先构建的 Docker 镜像:

# From Docker Hub docker pull threatflux/playwright-fetch:latest # From GitHub Container Registry docker pull ghcr.io/threatflux/playwright-fetch:latest

或者自己构建:

docker build -t threatflux/playwright-fetch .

配置

为 Claude.app 配置

添加到您的 Claude 设置:

"mcpServers": { "playwright-fetch": { "command": "uvx", "args": ["mcp-server-playwright-fetch"] } }
"mcpServers": { "playwright-fetch": { "command": "docker", "args": ["run", "-i", "--rm", "threatflux/playwright-fetch"] } }

配置 VS Code

对于手动安装,请将以下 JSON 块添加到 VS Code 中的用户设置 (JSON) 文件中。

{ "mcp": { "servers": { "playwright-fetch": { "command": "uvx", "args": ["mcp-server-playwright-fetch"] } } } }
{ "mcp": { "servers": { "playwright-fetch": { "command": "docker", "args": ["run", "-i", "--rm", "threatflux/playwright-fetch"] } } } }

命令行选项

该服务器支持以下命令行选项:

  • --user-agent :自定义 User-Agent 字符串
  • --ignore-robots-txt :忽略 robots.txt 限制
  • --proxy-url :用于请求的代理 URL
  • --headless :以无头模式运行浏览器(默认值:True)
  • --wait-until :何时认为导航成功(选项:“load”、“domcontentloaded”、“networkidle”、“commit”,默认值:“networkidle”)

示例用法

# Run with default settings uv run mcp-server-playwright-fetch # Run with a custom user agent and proxy uv run mcp-server-playwright-fetch --user-agent="MyCustomAgent/1.0" --proxy-url="http://myproxy:8080" # Run with visible browser for debugging uv run mcp-server-playwright-fetch --headless=false

调试

您可以使用 MCP 检查器来调试服务器:

npx @modelcontextprotocol/inspector uvx mcp-server-playwright-fetch

与标准 Fetch Server 的区别

此实现与标准获取 MCP 服务器有以下不同:

  1. 浏览器自动化:使用 Playwright 渲染 JavaScript 密集型页面
  2. 内容提取:尝试从常见的页面结构中提取主要内容
  3. 等待选项:可配置页面加载策略(等待加载、DOM内容、网络空闲)
  4. 可见浏览器选项:可以使用可见浏览器运行以进行调试

执照

本项目遵循 MIT 许可证。详情请参阅LICENSE文件。

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

使用 Playwright 浏览器自动化提供 Web 内容获取功能,使 LLM 能够从网页检索和处理 JavaScript 呈现的内容,并将 HTML 转换为 markdown 以便于使用。

  1. Author
    1. Key Features
      1. Available Tools
        1. Prompts
          1. Requirements
            1. Installation
              1. 1. Install with uv (recommended)
              2. 2. Using Docker
            2. Configuration
              1. Configure for Claude.app
              2. Configure for VS Code
            3. Command Line Options
              1. Example Usage
                1. Debugging
                  1. Differences from Standard Fetch Server
                    1. License

                      Related MCP Servers

                      • A
                        security
                        A
                        license
                        A
                        quality
                        This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.
                        Last updated -
                        1
                        43,046
                        JavaScript
                        MIT License
                        • Linux
                        • Apple
                      • A
                        security
                        A
                        license
                        A
                        quality
                        A Model Context Protocol server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.
                        Last updated -
                        13
                        9,719
                        3,179
                        TypeScript
                        MIT License
                        • Linux
                        • Apple
                      • A
                        security
                        F
                        license
                        A
                        quality
                        A server that enables browser automation using Playwright, allowing interaction with web pages, capturing screenshots, and executing JavaScript in a browser environment through LLMs.
                        Last updated -
                        12
                        9,719
                        1
                        TypeScript
                      • A
                        security
                        F
                        license
                        A
                        quality
                        Enables LLMs to perform browser automation through the Playwright framework with Chrome DevTools Protocol support, connecting to existing Chrome instances for advanced web interactions and JavaScript execution.
                        Last updated -
                        12
                        9
                        TypeScript

                      View all related MCP servers

                      ID: rzykt9yco6