跳转至

🚀 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
Email 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

  1. 00_START_HERE.md (this file) - Overview and quick start
  2. README.md - Installation, configuration, and basic usage

For Implementation

  1. ARCHITECTURE.md - System architecture and data flows
  2. IMPLEMENTATION.md - Technical implementation details

For Usage

  1. USAGE_EXAMPLES.md - 7+ practical usage examples
  2. quickstart.py - Runnable demo of all features
  3. client_example.py - Real-world workflow example

For Summary

  1. 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

navigate  screenshot  set_recurring_timer  notify_via_slack

Pattern 2: Admin Approval Flow

request_approval  wait_for_response  notify_decision  execute_action

Pattern 3: Scheduled Task

set_timer  browser_task  extract_data  send_email_report

Pattern 4: Multi-Channel Alert

critical_event  [email, slack, telegram, discord]  admin_approval

📖 Next Steps

To Use This Project:

  1. Read Documentation
  2. Start with README.md for setup
  3. Check USAGE_EXAMPLES.md for practical examples
  4. Review ARCHITECTURE.md for technical details

  5. Configure Environment

  6. Copy env.example to .env
  7. Add your API keys and credentials
  8. Configure notification channels

  9. Run Demos

  10. python quickstart.py - See all tools in action
  11. python client_example.py - Real-world workflow
  12. python test_basic.py - Verify installation

  13. Start Using

  14. Run as MCP server: python src/main.py
  15. Use with Claude Desktop or custom client
  16. Integrate into your AI agent application

To Extend This Project:

  1. Add New Tools: Create new functions in existing modules
  2. Add New Channels: Extend notification_tools.py
  3. Add Storage: Replace in-memory state with database
  4. Add Dashboard: Build web UI for admin management
  5. Add Analytics: Track tool usage and performance

🆘 Troubleshooting

Browser Issues

# Reinstall Playwright
playwright install chromium --force

Email Issues

  • Use Gmail App Passwords (not regular password)
  • Check SMTP port and host settings

Import Errors

# Reinstall dependencies
pip install -r requirements.txt --force-reinstall

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.py and client_example.py
  • Tests: Run test_basic.py to verify functionality
  • Issues: Review error messages and logs

🎓 Learning Path

  1. Beginner: Run quickstart.py and read README.md
  2. Intermediate: Study USAGE_EXAMPLES.md and modify examples
  3. Advanced: Review ARCHITECTURE.md and 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!