🚀 Collaboration Tools MCP Server¶
Start Here - Complete guide to the Collaboration Tools MCP Server implementation
📋 What Is This?¶
A production-ready Model Context Protocol (MCP) server that provides 19 collaboration tools for AI agents across 5 categories:
✅ Implemented Features¶
🌐 Browser Automation (5 tools)¶
- Virtual browser using browser-use library (知名虚拟浏览器库)
- Navigate websites, extract content, take screenshots
- AI-powered autonomous browser tasks
- Multi-tab management
👤 Human-in-the-Loop (4 tools)¶
- Request admin approval for sensitive operations
- Request human input with timeout handling
- Multi-channel admin notifications
- Pending request management
💬 Instant Messaging (3 tools)¶
- Telegram bot integration
- Slack webhook messaging
- Discord webhook messaging
📧 Email Notifications (1 tool)¶
- SMTP support (Gmail, etc.)
- SendGrid API support
- HTML emails with attachments
⏰ Timer & Scheduling (5 tools)¶
- One-time timers
- Recurring timers
- Timer cancellation and management
- Persistent timer storage
- Callback notifications
🎯 Quick Start¶
1. Installation¶
cd projects/week4/collaboration-tools
# Install dependencies
pip install -r requirements.txt
# Install Playwright browsers
playwright install chromium
# Configure environment
cp env.example .env
# Edit .env with your credentials
2. Run Demo¶
# Quick start demo (all tools)
python quickstart.py
# Real-world example
python client_example.py
# Basic tests
python test_basic.py
3. Start MCP Server¶
# Run as MCP server
python src/main.py
# Use with Claude Desktop (add to config)
# See README.md for configuration
📁 Project Structure¶
collaboration-tools/ (Total: 2,331 lines of Python code)
│
├── 📘 Documentation (80KB total)
│ ├── 00_START_HERE.md ← You are here
│ ├── README.md (6.7KB) Main documentation
│ ├── IMPLEMENTATION.md (7.3KB) Technical details
│ ├── ARCHITECTURE.md (23KB) System architecture
│ ├── USAGE_EXAMPLES.md (14KB) 7+ practical examples
│ └── PROJECT_SUMMARY.md (9.2KB) Project overview
│
├── 🔧 Configuration
│ ├── requirements.txt 19 dependencies
│ ├── env.example Configuration template
│ └── .gitignore Git ignore patterns
│
├── 🎯 Demo & Testing
│ ├── quickstart.py (6.1KB) Quick start demo
│ ├── client_example.py (7.2KB) Real-world workflow
│ └── test_basic.py (4.7KB) Basic tests
│
└── 📦 Source Code (src/)
├── main.py (11KB) MCP server (19 tools)
├── config.py (3.5KB) Configuration management
├── browser_tools.py (8.3KB) Browser automation
├── notification_tools.py (11KB) Email & IM notifications
├── hitl_tools.py (11KB) Human-in-the-loop
└── timer_tools.py (14KB) Timer management
🛠️ Technology Stack¶
| Component | Technology |
|---|---|
| MCP Server | FastMCP (mcp>=0.9.0) |
| Browser Automation | browser-use + Playwright |
| AI Agent | LangChain + OpenAI |
| aiosmtplib (SMTP) + SendGrid | |
| IM | httpx (Webhooks) + Telegram Bot API |
| Async | asyncio (Python 3.11+) |
| Config | Pydantic + python-dotenv |
| Scheduling | apscheduler + asyncio |
📚 Documentation Guide¶
For Getting Started¶
- 00_START_HERE.md (this file) - Overview and quick start
- README.md - Installation, configuration, and basic usage
For Implementation¶
- ARCHITECTURE.md - System architecture and data flows
- IMPLEMENTATION.md - Technical implementation details
For Usage¶
- USAGE_EXAMPLES.md - 7+ practical usage examples
- quickstart.py - Runnable demo of all features
- client_example.py - Real-world workflow example
For Summary¶
- PROJECT_SUMMARY.md - Complete project overview
🎨 Key Features¶
1. Browser Automation with AI¶
# Autonomous browser task using AI
await mcp_browser_execute_task(
task="Search for AI agent tutorials on Google and extract top 5 results",
max_steps=30
)
2. Human-in-the-Loop Workflow¶
# Request approval with timeout
result = await mcp_request_admin_approval(
request_message="Delete 1000 database records?",
urgent=True,
timeout_seconds=300
)
if result["approved"]:
# Proceed with action
perform_deletion()
3. Multi-Channel Notifications¶
# Send alert via all channels
await mcp_send_email(to_email="admin@example.com", ...)
await mcp_send_slack_message(message="🚨 Alert!")
await mcp_send_telegram_message(message="Alert!")
await mcp_send_discord_message(message="Alert!")
4. Timer & Scheduling¶
# Set timer for delayed execution
timer = await mcp_set_timer(
duration_seconds=3600,
callback_message="Time to check website"
)
# Recurring timer
await mcp_set_recurring_timer(
interval_seconds=300, # Every 5 minutes
max_occurrences=10
)
📊 Statistics¶
- Total Files: 17 (7 Python modules + 10 docs/config)
- Lines of Code: 2,331 (Python)
- Documentation: ~80KB
- MCP Tools: 19 tools across 5 categories
- Dependencies: 19 packages
- Test Coverage: Basic tests included
🔐 Security Features¶
✅ Environment-based configuration (no hardcoded secrets)
✅ .env file excluded from git
✅ Isolated browser user data directory
✅ HITL timeout and multi-channel verification
✅ Graceful error handling throughout
✅ Audit trail for admin approvals
🚦 Usage Patterns¶
Pattern 1: Website Monitoring¶
Pattern 2: Admin Approval Flow¶
Pattern 3: Scheduled Task¶
Pattern 4: Multi-Channel Alert¶
📖 Next Steps¶
To Use This Project:¶
- Read Documentation
- Start with
README.mdfor setup - Check
USAGE_EXAMPLES.mdfor practical examples -
Review
ARCHITECTURE.mdfor technical details -
Configure Environment
- Copy
env.exampleto.env - Add your API keys and credentials
-
Configure notification channels
-
Run Demos
python quickstart.py- See all tools in actionpython client_example.py- Real-world workflow-
python test_basic.py- Verify installation -
Start Using
- Run as MCP server:
python src/main.py - Use with Claude Desktop or custom client
- Integrate into your AI agent application
To Extend This Project:¶
- Add New Tools: Create new functions in existing modules
- Add New Channels: Extend
notification_tools.py - Add Storage: Replace in-memory state with database
- Add Dashboard: Build web UI for admin management
- Add Analytics: Track tool usage and performance
🆘 Troubleshooting¶
Browser Issues¶
Email Issues¶
- Use Gmail App Passwords (not regular password)
- Check SMTP port and host settings
Import Errors¶
Permission Issues¶
# Ensure config directory is writable
mkdir -p ~/.config/collaboration-tools
chmod 755 ~/.config/collaboration-tools
📞 Support¶
- Documentation: Check all .md files in this directory
- Examples: See
quickstart.pyandclient_example.py - Tests: Run
test_basic.pyto verify functionality - Issues: Review error messages and logs
🎓 Learning Path¶
- Beginner: Run
quickstart.pyand readREADME.md - Intermediate: Study
USAGE_EXAMPLES.mdand modify examples - Advanced: Review
ARCHITECTURE.mdand extend functionality
✅ Implementation Checklist¶
✅ Virtual browser (browser-use library)
✅ Human-in-the-loop tools
✅ IM notifications (Telegram, Slack, Discord)
✅ Email notifications (SMTP + SendGrid)
✅ Timer and scheduling tools
✅ Configuration management
✅ Error handling and logging
✅ Comprehensive documentation
✅ Working examples and demos
✅ Basic test suite
✅ Clean architecture
✅ Production-ready code
🌟 Highlights¶
- Production-Ready: Comprehensive error handling and logging
- Well-Documented: 80KB+ of documentation
- Modular Design: Easy to extend and maintain
- Real Examples: Working demos and use cases
- Best Practices: SOLID principles, clean code, async patterns
📝 License¶
MIT License - See project root for details
Ready to start? → Continue to README.md for detailed setup instructions!