The Crawlab MCP (Model Context Protocol) server provides a standardized interface for AI applications to interact with Crawlab's functionality. It enables AI systems to manage spiders, tasks, and files through natural language commands, serving as a bridge between AI applications and Crawlab's API.
Install the MCP server as a Python package for an easy-to-use 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
After installation, use the CLI to start the server or client:
# 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
Create your environment file:
cp .env.example .env
Configure your Crawlab API details:
CRAWLAB_API_BASE_URL=http://your-crawlab-instance:8080/api
CRAWLAB_API_TOKEN=your_api_token_here
Install dependencies:
pip install -r requirements.txt
Run the server:
python server.py
Build the image:
docker build -t crawlab-mcp-server .
Run the container:
docker run -p 8000:8000 --env-file .env crawlab-mcp-server
Add the MCP server to your existing Crawlab Docker Compose setup:
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
http://localhost:8000
)Creating a Spider:
User: "Create a new spider named 'Product Scraper' for the e-commerce project"
Running a Task:
User: "Run the 'Product Scraper' spider on all available nodes"
You can interact using natural language phrases such as:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.