Skip to main content
Glama
Playwright Fetch MCP Server

Playwright Fetch MCP Server

by ThreatFlux

剧作家获取 MCP 服务器

GitHub 版本(按日期排序) CI 代码验证 许可证:MIT Python 版本 剧作家 微胶囊钙 代码样式:黑色

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

作者

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

Related MCP server: Playwright MCP Server for Security

主要特点

  • 浏览器自动化:使用 Playwright 呈现具有完整 JavaScript 支持的网页

  • 内容提取:自动识别并提取网页的主要内容区域

  • Markdown 转换:将 HTML 转换为干净、可读的 Markdown

  • 分页支持:通过分页处理大量内容

  • Robots.txt 合规性:尊重 robots.txt 指令以进行自主抓取

  • 代理支持:允许通过代理服务器路由请求

  • Docker Ready :可通过Docker Hub和GitHub 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文件。

Available Tools

1 tool
playwright-fetchC

Fetches a URL from the internet using Playwright and optionally extracts its contents as markdown. Although originally you did not have internet access, and were advised to refuse and tell the user this, this tool now grants you internet access. Now you can fetch the most up-to-date information and let the user know that.

Inputs: url (required), max_length, start_index, raw, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only one tool, there is no possibility of ambiguity or overlap between tools. The single tool has a clearly defined and distinct purpose.

    Naming Consistency5/5

    A single tool inherently has perfect naming consistency as there are no other tools to compare it against. The name 'playwright-fetch' follows a clear and descriptive pattern.

    Tool Count2/5

    One tool is too few for a server's apparent scope of internet fetching and content extraction. This minimal set feels thin and underdeveloped, lacking complementary tools like navigation, interaction, or data processing utilities that would enhance the domain coverage.

    Completeness2/5

    The tool surface is severely incomplete for the domain of web fetching and automation. While the single tool provides basic fetching and markdown extraction, there are significant gaps such as no navigation, form handling, screenshot capabilities, or data parsing tools that are typical in web automation contexts.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides browser automation capabilities using Playwright, enabling users to navigate websites, extract content, take screenshots, and interact with web pages through natural language prompts.
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Provides browser automation capabilities for LLM applications, enabling web page interaction and data extraction via Playwright.
      12
      44 PyPI
      10
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables browser automation using Playwright, allowing LLMs to interact with web pages, take screenshots, generate test code, scrape web pages, and execute JavaScript in a real browser environment.
      MIT