网页爬取服务

一个连接Claude桌面应用与本地eGet网页爬取器的MCP服务器,实现通过本地API爬取网站内容。

  • by vishwajeetdabholkar
  • Python
  • 本地部署
  • 4 星标
  • 更新于
在 GitHub 查看 vishwajeetdabholkar/eget_mcp

使用说明

克劳德网络爬虫MCP

一个简单的模型上下文协议(MCP)服务器,将Claude for Desktop连接到本地运行的eGet web scraper。这允许Claude通过您当地的API抓取网站内容。

先决条件

  • Claude桌面版
  • Python 3.7+
  • eGet刮网器(来自https://github.com/vishwajeetdabholkar/eGet-Crawler-for-ai)

安装说明

1.设置eGet网络爬虫

首先,确保eGet web scraper正在运行:

# Clone the eGet repository
git clone https://github.com/vishwajeetdabholkar/eGet-Crawler-for-ai
cd eGet-Crawler-for-ai

# Set up and run eGet according to its instructions
# (typically using Docker or local Python installation)

# Verify the API is running (default: http://localhost:8000/api/v1/scrape)

2.设置MCP服务器

# Create project directory
mkdir claude-scraper-mcp
cd claude-scraper-mcp

# Set up UV and virtual environment
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
uv add "mcp[cli]" httpx

# Create the MCP server script
touch scrape_mcp_server.py

复制 scrape_mcp_server.py 将代码写入文件。

3.为桌面配置Claude

  1. 创建或编辑Claude桌面配置:
# On macOS
mkdir -p ~/Library/Application\ Support/Claude/
  1. 将此配置添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
    "mcpServers": {
        "scrape-service": {
            "command": "/absolute/path/to/claude-scraper-mcp/.venv/bin/python",
            "args": [
                "/absolute/path/to/claude-scraper-mcp/scrape_mcp_server.py"
            ]
        }
    }
}

将路径替换为虚拟环境和脚本的实际绝对路径。

  1. 重新启动桌面版的Claude

用法

设置后,您可以使用Claude通过以下命令抓取网站:

  • “从中删除内容https://example.com并对其进行总结”
  • “获取有关网站的信息https://news.ycombinator.com"

故障排除

如果您遇到问题:

  1. 检查eGet刮板是否正在运行
  2. 验证脚本中的API端点是否与eGet配置匹配
  3. 确保Claude for Desktop使用了正确的Python解释器
  4. 更改配置后重新启动Claude for Desktop