ScrapeGraph MCP 服务器使用说明

项目简介

ScapeGraph MCP 服务器是一个基于 Model Context Protocol (MCP) 的应用后端,旨在为大语言模型 (LLM) 提供强大的网页抓取和数据提取能力。它集成了 ScrapeGraph AI 的 API,通过标准化的 MCP 协议,让 LLM 能够安全、便捷地调用各种网页数据处理工具。

主要功能

  • Markdown 转换 (markdownify): 将任意网页��换为清晰、结构化的 Markdown 格式。
  • 智能数据抓取 (smartscraper): 利用 AI 技术,从网页中提取结构化数据,满足用户自定义的数据需求。
  • AI 驱动的搜索 (searchscraper): 执行 AI 驱动的网页搜索,并返回结构化的、可操作的结果。

安装步骤

本服务器推荐使用 Smithery 进行自动化安装,或者手动配置到支持 MCP 的客户端,例如 Claude Desktop 或 Cursor。以下是 Claude Desktop 的配置步骤:

  1. 获取 ScrapeGraph API Key:

  2. 配置 Claude Desktop:

    • 打开 Claude Desktop 的配置⽂件 'claude_desktop_config.json' (路径见下方注释)。
    • 在 'mcpServers' 中添加 ScrapeGraph MCP 服务器配置。

服务器配置 (Claude Desktop)

请将以下 JSON 配置添加到 Claude Desktop 的 'claude_desktop_config.json' 文件中。请务必将 'YOUR-SGAI-API-KEY' 替换为您在 ScrapeGraph 仪表板中获取的 API Key。

{
    "mcpServers": {
        "@ScrapeGraphAI-scrapegraph-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@smithery/cli@latest",
                "run",
                "@ScrapeGraphAI/scrapegraph-mcp",
                "--config",
                "{\"scrapegraphApiKey\":\"YOUR-SGAI-API-KEY\"}"
            ]
        }
    }
}

配置参数说明:

  • 'server name': '@ScrapeGraphAI-scrapegraph-mcp' - 服务器名称,用于在客户端中标识。
  • 'command': 'npx' - 运行服务器的命令,这里使用 'npx' 来执行 npm 包。
  • 'args': 启动参数列表,包括:
    • '-y': 'npx' 参数,自动确认安装 npm 包。
    • '@smithery/cli@latest': Smithery CLI 工具,用于运行 MCP 服务器。
    • 'run': Smithery CLI 命令,用于运行指定的服务器。
    • '@ScrapeGraphAI/scrapegraph-mcp': 要运行的 Smithery 服务器包名。
    • '--config': 配置参数标志。
    • '"{"scrapegraphApiKey":"YOUR-SGAI-API-KEY"}"': JSON 格式的配置字符串,用于传递 ScrapeGraph API Key。请替换 'YOUR-SGAI-API-KEY' 为您的实际 API Key。

'claude_desktop_config.json' 文件路径:

  • Windows: '%APPDATA%/Claude/claude_desktop_config.json'
  • macOS: '~/Library/Application\ Support/Claude/claude_desktop_config.json'

基本使用方法

配置完成后,在支持 MCP 协议的 LLM 客户端 (如 Claude Desktop 或 Cursor) 中,您可以通过自然语言指令调用 ScrapeGraph MCP 服务器提供的工具。例如:

  • "使用 markdownify 工具将 [网页 URL] 转换为 Markdown 格式"
  • "使用 smartscraper 工具从 [网页 URL] 提取 [您想要提取的数据],例如 '产品名称和价格'"
  • "使用 searchscraper 工具搜索 '最新的 AI 网页抓取技术发展'"

LLM 将会调用相应的工具,并返回抓取和处理后的网页数据。

信息

分类

网页与API