使用 skrape.ai 将网页转换为干净、适合LLM处理的Markdown。这是一个MCP服务器,可以无缝集成网络抓取与Claude Desktop和其他兼容MCP的应用程序。
get_markdown - 将任意网页转换为适合LLM处理的Markdown
要通过Smithery自动安装Skrape MCP服务器到Claude Desktop:
npx -y @smithery/cli install @skrapeai/skrape-mcp --client claude
从skrape.ai获取你的API密钥
安装依赖项:
npm install
npm run build
在MacOS上:
nano ~/Library/Application\ Support/Claude/claude_desktop_config.json
在Windows上:
notepad %APPDATA%/Claude/claude_desktop_config.json
添加以下配置(替换路径和API密钥为你自己的值):
{
"mcpServers": {
"skrape": {
"command": "node",
"args": ["path/to/skrape-mcp/build/index.js"],
"env": {
"SKRAPE_API_KEY": "your-key-here"
}
}
}
}
这里是如何使用该服务器与Claude或其他LLM模型:
将此网页转换为markdown: https://example.com
Claude将这样使用MCP工具:
<use_mcp_tool>
<server_name>skrape</server_name>
<tool_name>get_markdown</tool_name>
<arguments>
{
"url": "https://example.com",
"options": {
"renderJs": true
}
}
</arguments>
</use_mcp_tool>
生成的Markdown将是干净、结构化且准备好供LLM处理。
get_markdown工具接受这些参数:
url(必需):要转换的任意网页URLreturnJson(可选):设置为true以获取完整的JSON响应,而不仅仅是markdownoptions(可选):额外的抓取选项
renderJs:是否在抓取前渲染JavaScript(默认:true)带有所有选项的例子:
<use_mcp_tool>
<server_name>skrape</server_name>
<tool_name>get_markdown</tool_name>
<arguments>
{
"url": "https://example.com",
"returnJson": true,
"options": {
"renderJs": false
}
}
</arguments>
</use_mcp_tool>
为了开发时自动重建:
npm run watch
由于MCP服务器通过stdio通信,调试可能会很困难。我们推荐使用MCP Inspector:
npm run inspector
Inspector会提供一个URL,以便你在浏览器中访问调试工具。