Token导航 LogoToken导航TokenDH.com
Crawlab MCP Server logo
运维云端stdio官方级别未说明来源级核验

Crawlab MCP Server

MCP Server

Crawlab MCP Server是一个为AI应用提供与Crawlab交互功能的协议服务器,支持爬虫管理、任务管理和文件管理等功能。

工具数

0

提示词数

0

GitHub Stars

6

资源数

0
PythonClaude文件管理Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

crawlab-team

提供方

crawlab-team

最后核验

2026/5/17 21:11

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install -e .

详细介绍

Crawlab MCP服务器

这是一个用于Crawlab的模型上下文协议(MCP)服务器,允许AI应用程序与Crawlab功能进行交互。

概述

MCP服务器为AI应用程序访问Crawlab的功能提供了一种标准化的方式,包括:

  • Spider管理(创建、读取、更新、删除)
  • 任务管理(运行、取消、重新启动)
  • 文件管理(读、写)
  • 资源访问(蜘蛛、任务)

建筑

MCP服务器/客户端架构促进了AI应用程序和Crawlab之间的通信:

graph TB
    User[User] --> Client[MCP Client]
    Client --> LLM[LLM Provider]
    Client  Server[MCP Server]
    Server  Crawlab[Crawlab API]

    subgraph "MCP System"
        Client
        Server
    end

    subgraph "Crawlab System"
        Crawlab
        DB[(Database)]
        Crawlab  DB
    end

    class User,LLM,Crawlab,DB external;
    class Client,Server internal;

    %% Flow annotations
    LLM -.-> |Tool calls| Client
    Client -.-> |Executes tool calls| Server
    Server -.-> |API requests| Crawlab
    Crawlab -.-> |API responses| Server
    Server -.-> |Tool results| Client
    Client -.-> |Human-readable response| User

    classDef external fill:#f9f9f9,stroke:#333,stroke-width:1px;
    classDef internal fill:#d9edf7,stroke:#31708f,stroke-width:1px;

通信流

  1. 用户查询:用户向MCP客户端发送自然语言查询
  2. LLM处理:客户端将查询转发给LLM提供者(例如Claude、OpenAI)
  3. 工具选择:LLM识别必要的工具并生成工具调用
  4. 工具执行:客户端向MCP服务器发送工具调用
  5. API交互:服务器执行相应的Crawlab API请求
  6. 响应生成:结果通过服务器流回到客户端,再流到LLM
  7. 用户响应:客户端向用户提供最终的人类可读响应

安装和使用

选项1:作为Python包安装

您可以将MCP服务器安装为Python包,它提供了一个方便的CLI:

# Install from source
pip install -e .

# Or install from GitHub (when available)
# pip install git+https://github.com/crawlab-team/crawlab-mcp-server.git

安装后,您可以使用CLI:

# Start the MCP server
crawlab_mcp-mcp server [--spec PATH_TO_SPEC] [--host HOST] [--port PORT]

# Start the MCP client
crawlab_mcp-mcp client SERVER_URL

选项2:本地运行

先决条件

  • Python 3.8+
  • Crawlab实例正在运行且可访问
  • Crawlab中的API令牌

配置

  1. 复制 .env.example 文件到 .env:
   cp .env.example .env
  1. 编辑 .env 带有Crawlab API详细信息的文件:
   CRAWLAB_API_BASE_URL=http://your-crawlab-instance:8080/api
   CRAWLAB_API_TOKEN=your_api_token_here

本地运行

  1. 安装依赖项:
   pip install -r requirements.txt
  1. 运行服务器:
   python server.py

使用Docker运行

  1. 构建Docker镜像:
   docker build -t crawlab-mcp-server .
  1. 运行容器:
   docker run -p 8000:8000 --env-file .env crawlab-mcp-server

与Docker Compose集成

要将MCP服务器添加到现有的Crawlab Docker Compose设置中,请将以下服务添加到您的 docker-compose.yml:

services:
  # ... existing Crawlab services
  
  mcp-server:
    build: ./backend/mcp-server
    ports:
      - "8000:8000"
    environment:
      - CRAWLAB_API_BASE_URL=http://backend:8000/api
      - CRAWLAB_API_TOKEN=your_api_token_here
    depends_on:
      - backend

与AI应用程序一起使用

MCP服务器使AI应用程序能够通过自然语言与Crawlab进行交互。按照上面的架构图,以下是如何使用MCP系统:

设置连接

  1. 启动MCP服务器:确保您的MCP服务器正在运行且可访问
  2. 配置AI客户端:将您的AI应用程序连接到MCP服务器

示例:与Claude Desktop一起使用

  1. 打开克劳德桌面
  2. 前往“设置”>“MCP服务器”
  3. 使用MCP服务器的URL添加新服务器(例如。, http://localhost:8000)
  4. 在与Claude的对话中,您现在可以通过用自然语言描述您想做什么来使用Crawlab功能

交互示例

基于我们的架构,以下是与系统的交互示例:

创建蜘蛛:

User: "Create a new spider named 'Product Scraper' for the e-commerce project"
↓
LLM identifies intent and calls the create_spider tool
↓
MCP Server executes the API call to Crawlab
↓
Spider is created and details are returned to the user

运行任务:

User: "Run the 'Product Scraper' spider on all available nodes"
↓
LLM calls the run_spider tool with appropriate parameters
↓
MCP Server sends the command to Crawlab API
↓
Task is started and confirmation is returned to the user

可用命令

您可以使用自然语言命令与系统交互,例如:

  • “列出我的所有蜘蛛”
  • “根据这些规范创建一个新的蜘蛛…”
  • “显示名为X的蜘蛛的代码”
  • “用以下代码更新spider X中的main.py文件…”
  • “运行spider X并在完成时通知我”
  • “显示蜘蛛X最后一次运行的结果”

可用资源和工具

这些是为自然语言交互提供动力的底层工具:

资源

  • spiders:列出所有蜘蛛
  • tasks:列出所有任务

工具

蜘蛛管理

  • get_spider:获取特定蜘蛛的详细信息
  • create_spider:创建新的蜘蛛
  • update_spider:更新现有的蜘蛛
  • delete_spider:删除蜘蛛

任务管理

  • get_task:获取特定任务的详细信息
  • run_spider:跑蜘蛛
  • cancel_task:取消正在运行的任务
  • restart_task:重新启动任务
  • get_task_logs:获取任务的日志

文件管理

  • get_spider_files:列出蜘蛛的文件
  • get_spider_file:获取特定文件的内容
  • save_spider_file:将内容保存到文件

目录标签

目录标签

PythonClaude文件管理爬虫管理本地部署任务调度AI集成自动化工具

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP