Portable MCP Web Scraper
Efficient web scraping MCP server with a two-step workflow for token-efficient content extraction. Supports previewing HTML structure, targeted scraping, and entire documentation site crawling.
README
🚀 Portable MCP Web Scraper
A drop-in MCP (Model Context Protocol) server for efficient web scraping with two-step workflow optimization.
✨ Features
- Two-Step Workflow: Get HTML structure preview first, then scrape with targeted filters
- Token Efficient: Minimal token usage for AI analysis and decision-making
- Clean Output: Automatically removes navigation, ads, and UI elements
- Portable: Drop anywhere and add to your MCP servers
- Multiple Tools: Single page, multi-page, and documentation site scraping
🚀 Quick Start
Option 1: Automated Installation
python install.py
Option 2: Manual Setup
-
Install dependencies:
pip install -r requirements.txt -
Copy to your MCP servers directory:
cp portable_mcp_scraper.py /path/to/your/mcp/servers/ -
Add to your MCP configuration (e.g.,
~/.cursor/mcp.json):{ "mcpServers": { "web-scraper": { "command": "python", "args": ["/path/to/your/mcp/servers/portable_mcp_scraper.py"] } } } -
Restart your MCP client
🛠️ Available Tools
1. preview_html_structure
Get a clean HTML structure preview for AI analysis.
Parameters:
url(string): The URL to analyzemax_elements(int, optional): Maximum elements to include (default: 50)
Returns: Structured HTML preview with minimal text content
2. scrape_web_content
Scrape web content with custom filtering.
Parameters:
url(string): The URL to scrapeinclude_tags(list, optional): HTML tags to includeexclude_tags(list, optional): HTML tags to excludesave_to_file(bool, optional): Save content to file (default: false)output_dir(string, optional): Directory to save files (default: "./scraped_content")
Returns: Clean Markdown content
3. scrape_documentation_site
Scrape an entire documentation site with intelligent crawling.
Parameters:
base_url(string): Base URL of the documentation sitemax_pages(int, optional): Maximum pages to scrape (default: 10)include_tags(list, optional): HTML tags to includeexclude_tags(list, optional): HTML tags to excludesave_to_files(bool, optional): Save each page to separate file (default: true)output_dir(string, optional): Directory to save files (default: "./documentation")
Returns: Summary of scraped content with file paths
💡 Two-Step Workflow Benefits
- Step 1: Get HTML structure preview (~500-1000 tokens)
- Step 2: Scrape with AI-determined filters (clean, focused content)
Efficiency Gains:
- For 100-page documentation: ~90% token reduction
- AI only analyzes structure, not full content
- Clean, focused output without manual filtering
- Massive cost savings for large documentation sites
🧪 Testing
Run the test script to verify everything works:
python test_mcp_server.py
📋 Example Usage
Basic Single Page Scraping
# Get structure preview first
preview = preview_html_structure("https://cursor.com/docs")
# Then scrape with filters
content = scrape_web_content(
url="https://cursor.com/docs",
include_tags=["h1", "h2", "h3", "p", "div"],
exclude_tags=["nav", "footer", "aside"],
save_to_file=True
)
Documentation Site Scraping
# Scrape entire documentation site
summary = scrape_documentation_site(
base_url="https://cursor.com/docs",
max_pages=20,
save_to_files=True,
output_dir="./cursor_docs"
)
🔧 Requirements
- Python 3.8+
- Google Chrome browser
- ChromeDriver (automatically managed by webdriver-manager)
📁 Files
portable_mcp_scraper.py- The main MCP serverfastmcp.json- FastMCP configurationinstall.py- Automated installation scripttest_mcp_server.py- Test scriptrequirements.txt- Python dependenciesUSAGE_GUIDE.md- 📚 Complete usage guide with examplesPORTABLE_PACKAGE.md- Detailed package informationSUCCESS_SUMMARY.md- What this package provides
🎯 Perfect For
- AI Agents that need to scrape documentation on-demand
- Documentation Analysis with minimal token usage
- Content Extraction from complex websites
- Multi-page Scraping with intelligent crawling
- Cost-Effective web scraping for AI workflows
📄 License
MIT License - Feel free to use and modify as needed.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📞 Support
If you encounter any issues:
- Check that Google Chrome is installed
- Verify all dependencies are installed
- Run the test script to diagnose problems
- Check the documentation files for troubleshooting
Ready to drop and use! 🎉
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。