一个用于抓取网页内容并将其转换为Markdown格式的Model Context Protocol (MCP)服务器。
此MCP服务器提供了一个简单的工具,用于抓取网页内容并将其转换为Markdown格式。它使用了以下工具:
该服务器实现了一个单一工具:
scrape_to_markdown:从URL抓取内容并将其转换为Markdown。
url(字符串) - 要抓取的URL。verify_ssl(布尔值) - 是否验证SSL证书(默认:true)。当使用uv时,不需要特定的安装步骤。我们将使用uvx直接运行mcp-playwright-scraper。
或者,你可以通过pip安装mcp-playwright-scraper:
pip install mcp-playwright-scraper
安装后,可以使用以下命令作为脚本运行:
python -m mcp_playwright_scraper
安装后,需要安装Playwright浏览器依赖项:
playwright install --with-deps chromium
在你的claude_desktop_config.json中添加以下内容:
"mcpServers": {
"mcp-playwright-scraper": {
"command": "uvx",
"args": ["mcp-playwright-scraper"]
}
}
</details>
<details>
<summary>使用pip安装</summary>
"mcpServers": {
"m- cp-playwright-scraper": {
"command": "python",
"args": ["-m", "mcp_playwright_scraper"]
}
}
</details>
# 基本语法
$ claude mcp add mcp-playwright-scraper -- uvx mcp-playwright-scraper
# 或者,使用pip安装
$ claude mcp add mcp-playwright-scraper -- python -m mcp_playwright_scraper
<details>
<summary>开发/未发布的服务器配置</summary>
"mcpServers": {
"mcp-playwright-scraper": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp-playwright-scraper",
"run",
"mcp-playwright-scraper"
]
}
}
</details>
在你的Zed settings.json中添加以下内容:
<details> <summary>使用uvx</summary>"context_servers": [
"mcp-playwright-scraper": {
"command": {
"path": "uvx",
"args": ["mcp-playwright-scraper"]
}
}
],
</details>
<details>
<summary>使用pip安装</summary>
"context_servers": {
"mcp-playwright-scraper": {
"command": "python",
"args": ["-m", "mcp_playwright_scraper"]
}
},
</details>
mcp-playwright-scraperstdiouvx mcp-playwright-scraper
</details>
<details>
<summary>使用pip安装</summary>
python -m mcp_playwright_scraper
</details>
一旦在Claude Desktop中配置好,你可以通过提示明确使用抓取器:
使用mcp-playwright-scraper从https://example.com抓取内容并总结。
你可以使用MCP检查器来调试服务器:
npx @modelcontextprotocol/inspector uvx mcp-playwright-scraper
或者,如果你在一个特定目录中安装了包或正在开发它:
cd path/to/mcp-playwright-scraper
npx @modelcontextprotocol/inspector uv run mcp-playwright-scraper
启动后,检查器将在浏览器中显示一个URL,以便开始调试。
为了准备分发包:
uv sync
uv build
这将在dist/目录中创建源和轮子分布。
uv publish
注意:你需要通过环境变量或命令标志设置PyPI凭证:
--token或UV_PUBLISH_TOKEN--username/UV_PUBLISH_USERNAME和--password/UV_PUBLISH_PASSWORD此MCP服务器根据Apache许可证2.0版授权。你可以自由使用、修改和分发软件,但须遵守Apache许可证2.0的条款和条件。更多详情,请参阅项目存储库中的LICENSE文件或访问http://www.apache.org/licenses/LICENSE-2.0。