mcp-webscraper
Enables Claude Desktop to perform advanced web scraping and crawling operations, extracting structured data, analyzing website architectures, and discovering content relationships through natural conversation.
README
MCP Web Scraper for Claude Desktop
A Model Context Protocol (MCP) server that enables Claude Desktop to perform advanced web scraping and crawling operations. Extract structured data, analyze website architectures, and discover content relationships - all through natural conversation with Claude.
🎯 Features
- Static & Dynamic Scraping: Handle both regular HTML and JavaScript-rendered pages
- Website Crawling: Discover and map entire website structures
- Data Extraction: Extract specific elements using CSS selectors
- Batch Operations: Process multiple URLs efficiently
- Link Analysis: Understand how pages connect and reference each other
🎥 Watch the Tutorial
See the full demo and step-by-step setup guide on YouTube:
📋 Prerequisites
- Python 3.10 or higher
- WSL2 with Ubuntu (for Windows users)
- Claude Desktop application
uvpackage manager
🚀 Installation
1. Clone the Repository
git clone https://github.com/samirsaci/mcp-webscraper.git
cd mcp-webscraper
2. Install uv Package Manager
If you don't have uv installed:
curl -LsSf https://astral.sh/uv/install.sh | sh
3. Initialize the project
# Initialize the virtual environment
uv init .
4. Install Dependencies
uv add "mcp[cli]"
source .venv/bin/activate
uv pip install -r requirements.txt
Do not forget to install playwright browser to scrape dynamic content
uv run playwright install chromium
5. Test the Installation
Run the test script to verify everything works using a website that loves to be scrapped https://books.toscrape.com/:
uv run python test_local.py
Expected Output:
Static Scraping Success: True
HTML length: 51294
---------
Dynamic Scraping Success: True
HTML length: 51004
---------
Testing Crawler...
Crawler Success: True
Pages crawled: 5
Pages discovered: 437
Failed URLs: 0
First 3 pages discovered:
1. All products | Books to Scrape - Sandbox
URL: https://books.toscrape.com/
Links found: 73
Depth: 0
2. All products | Books to Scrape - Sandbox
URL: https://books.toscrape.com/index.html
Links found: 73
Depth: 1
3. Books |
Books to Scrape - Sandbox
URL: https://books.toscrape.com/catalogue/category/books_1/index.html
Links found: 73
Depth: 1
Statistics:
Total unique links: 104
Max depth reached: 1
Avg load time: 0.21s
⚙️ Claude Desktop Configuration
For Windows Users with WSL
- Locate your Claude Desktop configuration file:
File -> Settings -> Edit Config
- Add the WebScrappingServer configuration
{
"mcpServers": {
"WebScrapingServer": {
"command": "wsl",
"args": [
"-d",
"Ubuntu",
"bash",
"-lc",
"cd ~/path/to/mcp-webscraper && uv run --with mcp[cli] mcp run scrapping.py"
]
}
}
}
Important: Replace ~/path/to/mcp-webscraper with the actual path to your project folder in WSL. To find your WSL path:
pwd
3. Restart Claude Desktop
After updating the configuration:
- Completely quit Claude Desktop (not just close the window)
- Start Claude Desktop again
- Look for the 🔌 icon in the text input area
- Click it to verify "WebScrapingServer" appears
🔧 Usage Examples
Once configured, you can ask Claude to:
Basic Scraping
"Scrape the homepage of example.com and tell me what you find"
Advanced SEO analysis
Please help me to crawl my personal blog https://yourblog.com with a limit of 150 pages.
I would like to understand how articles are referring to each other.
Can you help me to perform this type of analysis?
📁 Project Structure
mcp-webscraper/
├── models/
│ └── scraping_models.py # Pydantic models for data validation
├── utils/
│ └── web_scraper.py # Core WebScraper class
├── scrapping.py # MCP server implementation
├── test_local.py # Local testing script
├── requirements.txt # Python dependencies
├── README.md # This file
└── scraping_server.log # Server logs (created at runtime)
🛠️ Available MCP Tools
The server exposes these tools to Claude:
scrape_url: Get raw HTML from any webpageextract_data: Extract multiple elements using CSS selectorsextract_first: Get a single element from a pagebatch_scrape: Process multiple URLscrawl_website: Discover and map website structure
🐛 Troubleshooting
Server not appearing in Claude
*If the server does not appear in Claude, try first to restart Claude Desktop by terminating its processus.`
If this does not work, try to
- Check the log file:
cat scraping_server.log
- Verify the path in config matches your WSL path:
pwd
The output should match what you have in your config file.
- Test the server directly:
uv run python scrapping.py
Playwright issues
If JavaScript scraping fails, try to reinstall the browser
uv run playwright install chromium
WSL-specific issues
Ensure WSL2 is properly installed:
Run this in Windows PowerShell opened as Administrator
wsl --status
📄 License
MIT License - feel free to use this in your own projects!
About me 🤓
Senior Supply Chain and Data Science consultant with international experience working on Logistics and Transportation operations. For consulting or advising on analytics and sustainable supply chain transformation, feel free to contact me via Logigreen Consulting or LinkedIn
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
