AI工作助手

Cliq-MCP是一款为Zoho Cliq设计的智能助手,通过模型上下文协议(MCP)提供智能自动化和生产力功能,增强团队协作和效率。

  • by rohansen856
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 rohansen856/cliq-mcp

使用说明

Cliq MCP:Zoho Cliq的人工智能工作伙伴

AI WorkBuddy是Zoho Cliq的智能助手,通过模型上下文协议(MCP)提供智能自动化和生产力功能。它将现代人工智能的力量与Cliq的无缝集成相结合,以增强团队协作和生产力。

🎯 主要特点

🤖 人工智能驱动能力

  • 智能摘要:自动总结渠道对话中的关键见解
  • 任务提取:从讨论中确定并提取行动项目
  • 会议记录:根据对话生成结构化的会议纪要
  • 问题分类:支持票的智能分类和优先级排序
  • 上下文感知响应:人工智能对工作场所沟通模式的理解

🔧 技术卓越

  • MCP协议:基于模型上下文协议构建,实现无缝的人工智能集成
  • 多提供商支持:与OpenAI GPT和Anthropic Claude兼容
  • 专业建筑:干净、可扩展和可维护的代码库
  • 综合测试:单元和集成测试的测试覆盖率为48%
  • Docker就绪:完全支持容器化,便于部署

⚡ Cliq集成

  • Webhook支持:来自Zoho Cliq的实时事件处理
  • 丰富的卡片响应:渠道中的精彩互动响应
  • 命令接口:用于AI功能的直观斜线命令
  • 错误处理:通过用户友好的消息进行优雅的错误处理

🚀 快速开始

先决条件

  • Python 3.11+
  • 具有机器人权限的Zoho Cliq帐户
  • OpenAI API密钥或Anthropic API密钥

安装

  1. 克隆存储库

    git clone https://github.com/rohansen856/cliq-mcp
    cd cliq-mcp
    
  2. 设置环境

    # Copy environment template
    cp .env.example .env
    
    # Edit .env with your configuration
    nano .env
    
  3. 安装依赖项

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -r requirements.txt
    
  4. 启动应用程序

    # Using the start script (recommended)
    ./scripts/start.sh
    
    # Or manually
    python -m src.main run
    

Docker部署

# Build and run with Docker Compose
docker-compose up -d

# Check status
docker-compose ps

# View logs
docker-compose logs -f cliq-mcp

📋 可用命令

在Zoho Cliq频道

命令 描述 示例
/summary [count] 总结最近的消息 /summary 50
/tasks [count] 提取行动项 /tasks 30
/minutes [title] 生成会议纪要 /minutes "Sprint Planning"
/classify <text> 对问题进行分类 /classify "Login page is broken"
/help 显示可用命令 /help

CLI命令

# Run specific modes
python -m src.main run --mode mcp        # MCP server only
python -m src.main run --mode webhook    # Webhook server only
python -m src.main run --mode both       # Both servers (default)

# Validation and testing
python -m src.main validate              # Validate configuration
python -m src.main test-ai               # Test AI functionality
python -m src.main test-cliq --channel-id CHANNEL_ID  # Test Cliq integration

# Initialize project
python -m src.main init                  # Create .env from template

🏗️ 建筑

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Zoho Cliq     │    │   Webhook       │    │   MCP Server    │
│                 │◄──►│   Server        │◄──►│                 │
│   - Channels    │    │   (FastAPI)     │    │   - AI Tools    │
│   - Commands    │    │   - Events      │    │   - Resources   │
│   - Cards       │    │   - Handlers    │    │   - Prompts     │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                                │                       │
                                ▼                       ▼
                       ┌─────────────────┐    ┌─────────────────┐
                       │   AI Tools      │    │   Claude Code   │
                       │                 │    │   Integration   │
                       │   - Summarizer  │    │                 │
                       │   - Extractor   │    │   - MCP Client  │
                       │   - Classifier  │    │   - Tool Access │
                       │   - Generator   │    │   - Resources   │
                       └─────────────────┘    └─────────────────┘

核心组件

  • MCP服务器:通过模型上下文协议公开AI工具
  • Webhook服务器:处理Zoho Cliq事件和命令
  • AI工具:用于各种任务的智能处理模块
  • Cliq集成:Zoho Cliq的API客户端和事件处理程序

🔧 配置

环境变量

# Required Settings
WEBHOOK_SECRET=your-webhook-secret-key
SECRET_KEY=your-super-secret-key

# AI Provider (choose one)
OPENAI_API_KEY=sk-your-openai-api-key
ANTHROPIC_API_KEY=sk-ant-your-anthropic-key

# Zoho Cliq Integration
CLIQ_BOT_TOKEN=your-cliq-bot-token
CLIQ_CLIENT_ID=your-cliq-client-id
CLIQ_CLIENT_SECRET=your-cliq-client-secret

# Server Configuration
MCP_SERVER_HOST=localhost
MCP_SERVER_PORT=8001
WEBHOOK_HOST=0.0.0.0
WEBHOOK_PORT=8000

# Application Limits
MAX_MESSAGE_HISTORY=50
SUMMARY_MAX_LENGTH=500
TASK_EXTRACTION_LIMIT=10

Zoho Cliq设置

  1. 创建Cliq应用程序

    • 转到Zoho Cliq开发人员控制台
    • 创建新的机器人应用程序
    • 配置webhook URL: https://your-domain.com/webhook/cliq
  2. 设置权限

    • 阅读频道中的消息
    • 发送消息和卡片
    • 访问通道历史
  3. 安装在通道中

    • 将机器人添加到所需的频道
    • 测试用 /help 命令

🧪 测试

运行测试

# All tests
pytest

# Unit tests only
pytest tests/unit/

# With coverage
pytest --cov=src --cov-report=html

# Specific test file
pytest tests/unit/test_ai_tools.py -v

测试覆盖率

当前测试覆盖率: 48% 跨所有模块

  • AI工具:70-89%的覆盖率
  • Cliq集成:65-78%的覆盖率
  • 配置:82%的覆盖率

手动测试

# Test basic functionality
python test_basic.py

# Test AI tools (requires API key)
python -m src.main test-ai

# Test Cliq integration (requires bot token)
python -m src.main test-cliq --channel-id YOUR_CHANNEL_ID

📚 文档

模块文档

API 文档

  • Webhook端点: http://localhost:8000/

    • POST /webhook/cliq -主Cliq webhook
    • POST /webhook/command -命令特定的webhook
    • GET /health -健康检查
  • MCP服务器: localhost:8001 (标准输入/传输控制协议)

    • 工具:summarize_message、extract_tasks等。
    • 资源:cliq://settings, cliq://status

🔧 发展

项目结构

cliq-mcp/
├── src/
│   ├── ai_tools/          # AI processing modules
│   ├── cliq_integration/  # Zoho Cliq integration
│   ├── mcp_server/        # MCP protocol server
│   ├── config/            # Configuration management
│   ├── utils/             # Shared utilities
│   └── main.py           # Application entry point
├── tests/
│   ├── unit/             # Unit tests
│   └── integration/      # Integration tests
├── docs/
│   ├── modules/          # Module documentation
│   └── api/              # API documentation
├── scripts/              # Utility scripts
├── config/               # Deployment configurations
└── README.md

开发工作流程

  1. 设置开发环境

    python -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    pip install -e .
    
  2. 以开发模式运行

    DEBUG=true python -m src.main run
    
  3. 测试

    pytest tests/ -v
    python test_basic.py
    
  4. 代码质量

    black src/          # Code formatting
    isort src/          # Import sorting
    mypy src/           # Type checking
    

🚀 部署

生产部署

  1. 使用Docker Compose(推荐)

    # Production deployment
    docker-compose --profile production up -d
    
    # With monitoring
    docker-compose --profile monitoring up -d
    
  2. 手动部署

    # Start with production settings
    DEBUG=false RELOAD=false ./scripts/start.sh
    
  3. 云部署

    • 在云平台中配置环境变量
    • 使用提供的Dockerfile进行容器部署
    • 设置SSL终止(提供nginx配置)
    • 为生产配置数据库和Redis

监控

该应用程序提供全面的监控:

  • 健康检查: /health 端点
  • 普罗米修斯指标:应用程序性能指标
  • Grafana仪表板:可视化和警报
  • 结构化日志记录:JSON格式的日志用于分析

🤝 贡献

我们欢迎捐款!请参阅我们的投稿指南:

  1. 分叉存储库
  2. 创建要素分支
  3. 为新功能编写测试
  4. 确保所有测试通过
  5. 提交拉取请求

开发指南

  • 遵循PEP 8风格指南
  • 编写全面的测试
  • 更新新功能的文档
  • 在整个代码库中使用类型提示

📄 许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。

🆘 支持

故障排除

常见问题:

  1. API密钥错误

    Error: No AI provider API key configured
    Solution: Set OPENAI_API_KEY or ANTHROPIC_API_KEY in .env
    
  2. Webhook身份验证

    Error: Invalid signature
    Solution: Verify WEBHOOK_SECRET matches Cliq configuration
    
  3. 端口冲突

    Error: Address already in use
    Solution: Change ports in .env or stop conflicting services
    

获取帮助

  • 📖 检查 文档
  • 🐛 在GitHub上报告问题
  • 💬 加入我们的社区讨论

路线图

  • [x] 核心MCP服务器实现
  • [x] Zoho Cliq集成
  • [x] AI工具套件(摘要、任务、分类)
  • [x] Docker部署支持
  • []多语言支持
  • []高级分析和见解
  • []与其他Zoho应用程序集成
  • []自定义AI模型支持

内置于❤️ Zoho Cliq社区

通过智能自动化和人工智能驱动的洞察力提高团队的生产力。