Crawlab MCP Server
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.
Crawlab MCP Server
This is a Model Context Protocol (MCP) server for Crawlab, allowing AI applications to interact with Crawlab's functionality.
Overview
The MCP server provides a standardized way for AI applications to access Crawlab's features, including:
- Spider management (create, read, update, delete)
- Task management (run, cancel, restart)
- File management (read, write)
- Resource access (spiders, tasks)
Architecture
The MCP Server/Client architecture facilitates communication between AI applications and Crawlab:
Communication Flow
- User Query: The user sends a natural language query to the MCP Client
- LLM Processing: The Client forwards the query to an LLM provider (e.g., Claude, OpenAI)
- Tool Selection: The LLM identifies necessary tools and generates tool calls
- Tool Execution: The Client sends tool calls to the MCP Server
- API Interaction: The Server executes the corresponding Crawlab API requests
- Response Generation: Results flow back through the Server to the Client to the LLM
- User Response: The Client delivers the final human-readable response to the user
Installation and Usage
Option 1: Install as a Python package
You can install the MCP server as a Python package, which provides a convenient CLI:
After installation, you can use the CLI:
Option 2: Running Locally
Prerequisites
- Python 3.8+
- Crawlab instance running and accessible
- API token from Crawlab
Configuration
- Copy the
.env.example
file to.env
:Copy - Edit the
.env
file with your Crawlab API details:Copy
Running Locally
- Install dependencies:Copy
- Run the server:Copy
Running with Docker
- Build the Docker image:Copy
- Run the container:Copy
Integration with Docker Compose
To add the MCP server to your existing Crawlab Docker Compose setup, add the following service to your docker-compose.yml
:
Using with AI Applications
The MCP server enables AI applications to interact with Crawlab through natural language. Following the architecture diagram above, here's how to use the MCP system:
Setting Up the Connection
- Start the MCP Server: Make sure your MCP server is running and accessible
- Configure the AI Client: Connect your AI application to the MCP server
Example: Using with Claude Desktop
- Open Claude Desktop
- Go to Settings > MCP Servers
- Add a new server with the URL of your MCP server (e.g.,
http://localhost:8000
) - In a conversation with Claude, you can now use Crawlab functionality by describing what you want to do in natural language
Example Interactions
Based on our architecture, here are example interactions with the system:
Create a Spider:
Run a Task:
Available Commands
You can interact with the system using natural language commands like:
- "List all my spiders"
- "Create a new spider with these specifications..."
- "Show me the code for the spider named X"
- "Update the file main.py in spider X with this code..."
- "Run spider X and notify me when it's complete"
- "Show me the results of the last run of spider X"
Available Resources and Tools
These are the underlying tools that power the natural language interactions:
Resources
spiders
: List all spiderstasks
: List all tasks
Tools
Spider Management
get_spider
: Get details of a specific spidercreate_spider
: Create a new spiderupdate_spider
: Update an existing spiderdelete_spider
: Delete a spider
Task Management
get_task
: Get details of a specific taskrun_spider
: Run a spidercancel_task
: Cancel a running taskrestart_task
: Restart a taskget_task_logs
: Get logs for a task
File Management
get_spider_files
: List files for a spiderget_spider_file
: Get content of a specific filesave_spider_file
: Save content to a file
This server cannot be installed
A Model Context Protocol server that allows AI applications to interact with Crawlab's functionality through natural language, enabling spider management, task execution, and file operations.
- Overview
- Architecture
- Installation and Usage
- Integration with Docker Compose
- Using with AI Applications
- Available Resources and Tools