🌐 SNM BrightData Client
A powerful Rust crate providing MCP-compatible integration with BrightData's web scraping and data extraction services. Built with Actix Web for high-performance web scraping, search, data extraction, and screenshot capabilities.
✨ Features
- 🔍 Web Search: Search across Google, Bing, Yandex, and DuckDuckGo
- 🌐 Website Scraping: Extract content in markdown, raw HTML, or structured formats
- 📊 Data Extraction: Intelligent data extraction from any webpage
- 📸 Screenshots: Capture website screenshots using BrightData Browser
- 🤖 MCP Compatible: Full Model Context Protocol support for AI integrations
- ⚡ Multiple Interfaces: Library, CLI, and HTTP server
- 🔒 Authentication: Secure token-based authentication
- 📈 Rate Limiting: Built-in rate limiting and error handling
- 🚀 High Performance: Built with Actix Web for production workloads
🚀 Quick Start
Installation
Add to your Cargo.toml:
[]
= "0.1.0"
Environment Setup
# BrightData Configuration
# Proxy Credentials (optional)
# Server Configuration
📖 Usage
As a Library
use ;
use ;
use json;
async
CLI Usage
# Search the web
# Scrape a website
# Extract data
# Take screenshot
HTTP Server
# Start the server
# Health check
# List available tools
# Use tools via API
🛠️ Available Tools
🔍 Search Web (search_web)
Search across multiple search engines with BrightData's unblocking capabilities.
🌐 Scrape Website (scrape_website)
Extract content from any website, bypassing anti-bot protections.
📊 Extract Data (extract_data)
Intelligent data extraction from webpages.
📸 Take Screenshot (take_screenshot)
Capture high-quality screenshots of websites.
🤖 MCP Integration
This crate is fully compatible with the Model Context Protocol (MCP), making it easy to integrate with AI systems like Claude.
MCP Server Configuration
Example with Claude
🏗️ API Reference
HTTP Endpoints
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/tools |
GET | List available tools |
/invoke |
POST | Direct tool invocation |
/sse |
POST | Server-Sent Events streaming |
/mcp |
POST | MCP JSON-RPC protocol |
Response Format
All tools return MCP-compatible responses:
⚙️ Configuration
BrightData Setup
- Sign up for BrightData account
- Create zones for Web Unlocker and Browser
- Get API credentials from your dashboard
- Set environment variables as shown above
Zone Configuration
- Web Unlocker Zone: For web scraping and search
- Browser Zone: For screenshots and JavaScript rendering
🔧 Development
Building
# Build library
# Build with all features
# Run tests
# Run with debug logging
RUST_LOG=debug
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
📊 Performance
- Concurrent Requests: Supports high-concurrency workloads
- Rate Limiting: Built-in 10 requests/minute per tool (configurable)
- Timeout Handling: Configurable timeouts for different operations
- Error Recovery: Automatic retry mechanisms with backoff
🛡️ Security
- Token Authentication: Secure API access
- Rate Limiting: Prevents abuse
- Input Validation: Comprehensive parameter validation
- CORS Support: Configurable cross-origin requests
📝 Examples
Check out the examples/ directory for:
- Basic usage examples
- Integration patterns
- Advanced configurations
- Error handling strategies
🤝 Integration Examples
With Anthropic Claude
Use as an MCP server to enhance Claude with web scraping capabilities.
With Custom Applications
Integrate into your Rust applications for:
- E-commerce price monitoring
- Content aggregation
- Market research
- Competitive analysis
📋 Requirements
- Rust: 1.70 or later
- BrightData Account: With API access
- Network Access: HTTPS outbound connections
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
- BrightData for providing robust web scraping infrastructure
- Actix Web for high-performance HTTP server framework
- Anthropic for MCP protocol specification
📞 Support
- 📧 Email: inxmaurya@gmail.com
- 🐛 Issues: GitHub Issues
- 📖 Documentation: API Docs
🚀 Roadmap
- Additional search engines
- Enhanced data extraction templates
- WebSocket support for real-time scraping
- GraphQL API interface
- Kubernetes deployment examples
- Advanced proxy rotation
- Machine learning integration for content classification
Made with ❤️ by SNM Maurya