Crawlab MCP Server

Official

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • The MCP server provides integration with Docker, allowing users to run the server in a containerized environment and integrate it with existing Crawlab Docker Compose setups.

  • The MCP server documentation uses Mermaid for architecture diagrams, illustrating the communication flow between components.

  • The MCP server integrates with OpenAI as an LLM provider, allowing AI applications to interact with Crawlab through the MCP protocol. The architecture shows OpenAI as one of the supported LLM providers for processing natural language queries.

크롤랩 MCP 서버

이는 Crawlab을 위한 MCP(Model Context Protocol) 서버로, AI 애플리케이션이 Crawlab의 기능과 상호 작용할 수 있도록 해줍니다.

개요

MCP 서버는 AI 애플리케이션이 다음을 포함하여 Crawlab 기능에 액세스할 수 있는 표준화된 방법을 제공합니다.

  • 스파이더 관리(생성, 읽기, 업데이트, 삭제)
  • 작업 관리(실행, 취소, 다시 시작)
  • 파일 관리(읽기, 쓰기)
  • 리소스 액세스(스파이더, 작업)

건축학

MCP 서버/클라이언트 아키텍처는 AI 애플리케이션과 Crawlab 간의 통신을 용이하게 합니다.

지엑스피1

커뮤니케이션 흐름

  1. 사용자 쿼리 : 사용자가 MCP 클라이언트에 자연어 쿼리를 보냅니다.
  2. LLM 처리 : 클라이언트는 쿼리를 LLM 공급자(예: Claude, OpenAI)에게 전달합니다.
  3. 도구 선택 : LLM은 필요한 도구를 식별하고 도구 호출을 생성합니다.
  4. 도구 실행 : 클라이언트가 MCP 서버로 도구 호출을 보냅니다.
  5. API 상호작용 : 서버는 해당 Crawlab API 요청을 실행합니다.
  6. 응답 생성 : 결과는 서버를 거쳐 클라이언트로 다시 LLM으로 흐릅니다.
  7. 사용자 응답 : 클라이언트는 사용자에게 최종 인간이 읽을 수 있는 응답을 전달합니다.

설치 및 사용

옵션 1: Python 패키지로 설치

MCP 서버는 편리한 CLI를 제공하는 Python 패키지로 설치할 수 있습니다.

# 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: 로컬로 실행

필수 조건

  • 파이썬 3.8 이상
  • Crawlab 인스턴스가 실행 중이고 접근 가능함
  • Crawlab의 API 토큰

구성

  1. .env.example 파일을 .env 로 복사합니다.
    cp .env.example .env
  2. Crawlab API 세부정보로 .env 파일을 편집합니다.
    CRAWLAB_API_BASE_URL=http://your-crawlab-instance:8080/api CRAWLAB_API_TOKEN=your_api_token_here

지역적으로 실행

  1. 종속성 설치:
    pip install -r requirements.txt
  2. 서버를 실행합니다:
    python server.py

Docker로 실행

  1. Docker 이미지를 빌드합니다.
    docker build -t crawlab-mcp-server .
  2. 컨테이너를 실행합니다.
    docker run -p 8000:8000 --env-file .env crawlab-mcp-server

Docker Compose와의 통합

기존 Crawlab Docker Compose 설정에 MCP 서버를 추가하려면 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라는 이름의 거미에 대한 코드를 보여주세요"
  • "스파이더 X의 main.py 파일을 이 코드로 업데이트하세요..."
  • "스파이더 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 : 파일에 콘텐츠 저장
-
security - not tested
F
license - not found
-
quality - not tested

AI 애플리케이션이 자연어를 통해 Crawlab 기능과 상호 작용할 수 있도록 하는 모델 컨텍스트 프로토콜 서버로, 스파이더 관리, 작업 실행 및 파일 작업이 가능합니다.

  1. Overview
    1. Architecture
      1. Communication Flow
    2. Installation and Usage
      1. Option 1: Install as a Python package
      2. Option 2: Running Locally
      3. Prerequisites
      4. Configuration
      5. Running Locally
      6. Running with Docker
    3. Integration with Docker Compose
      1. Using with AI Applications
        1. Setting Up the Connection
        2. Example: Using with Claude Desktop
        3. Example Interactions
        4. Available Commands
      2. Available Resources and Tools
        1. Resources
        2. Tools
      ID: kou3odk02c