Webex Bot MCP服务

一个基于Webex Python SDK的MCP服务器,提供自动化消息、房间管理和团队协作工具,适用于系统监控、CI/CD通知和业务流程管理等多种场景。

  • by WebexCommunity
  • Python
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 WebexCommunity/webex-bot-mcp

使用说明

Webex Bot MCP

一个全面的模型上下文协议(MCP)服务器,提供使用Webex机器人与Webex API交互的工具、资源和提示。此服务器通过Webex平台实现自动消息传递、房间管理和团队协作。

由...驱动:此MCP服务器建立在优秀的 Webex Python SDK Webex社区。SDK为该项目中的所有Webex API交互提供了坚实的基础。

特性

🛠️ 工具(31个可用)

  • 客房管理:创建、更新、列出和管理Webex会议室/空间
  • 消息操作:发送带有文本、标记、HTML、文件和提及的消息
  • 会员管理:添加、删除和更新房间成员资格
  • 人员管理:搜索和管理组织用户
  • 双重术语:完全支持“房间”和“空间”术语

📚 资源(10个可用)

  • 入门指南:动态设置和身份验证状态
  • 消息格式:全面的格式示例和最佳实践
  • 当前配置:实时机器人状态和功能
  • 故障排除指南:常见问题和解决方案
  • 安全最佳实践:生产部署安全指南
  • 用例和示例:现实世界的实施模式

🎯 提示(7个可用)

  • 发送公告:专业公告模板
  • 创建团队空间:通过会员管理引导房间设置
  • 批量消息活动:具有速率限制的多目标消息传递
  • 房间管理工作流程:全面的房间审计和维护
  • 事件响应设置:应急响应协调
  • 机器人健康检查:全面的机器人评估
  • 合规性审计:治理和政策合规性检查

🚀 生产特点

  • 健康监测:内置健康检查端点
  • 配置管理:基于环境的配置
  • 容器支持:Docker和Kubernetes部署就绪
  • 安全:令牌管理、速率限制、审计日志记录
  • 可观测性:结构化日志记录和指标支持

先决条件

在设置此MCP服务器之前,您需要创建Webex机器人并获取其访问令牌。

创建Webex Bot

  1. 转到Webex开发人员门户:

    • 访问https://developer.webex.com
    • 使用您的Webex帐户登录(如果没有,请创建一个)
  2. 创建新Bot:

    • 点击顶部导航中的“我的Webex应用程序”
    • 点击“创建新应用”
    • 选择“创建机器人”
  3. 配置您的机器人:

    • 机器人名称:选择一个描述性名称(例如,“通知机器人”、“警报机器人”)
    • 机器人用户名:这将是机器人的唯一标识符(例如“notificationbot”)
    • 图标:上传机器人图标(可选,但推荐)
    • 描述:描述你的机器人做什么
    • 点击“添加机器人”
  4. 获取您的Bot访问令牌:

    • 创建机器人后,您将看到机器人详细信息页面
    • 重要:立即复制“Bot Access Token”-这将不会再次显示
    • 令牌以以下内容开头 Y2lzY29zcGFyazovL3VzL0FQUExJQ0FUSU9O...
    • 安全地存储此令牌-您将使用它作为您的 WEBEX_ACCESS_TOKEN
  5. 机器人需要了解的限制:

    • 机器人只能在明确添加消息的房间中看到消息
    • 要向房间发送消息,机器人必须是该房间的成员
    • 除非对方先给机器人发消息,否则机器人无法在1:1的空间中看到消息
    • 机器人有速率限制(通常每秒10条消息)

将机器人添加到房间

要让您的机器人向房间发送消息,必须将其添加为成员:

  1. 适用于团体客房:

    • 转到Webex应用程序
    • 打开您希望机器人发送消息的房间
    • 单击顶部的房间名称
    • 点击“人物”
    • 点击“添加人员”
    • 搜索您的机器人的用户名(例如,“@notificationbot”)
    • 将机器人添加到房间
  2. 对于直接消息:

    • 用户可以通过搜索其用户名与您的机器人进行1:1对话
    • 或者,您可以使用用户的电子邮件地址发送直接消息

安装

来自PyPI(推荐)

pip install webex-bot-mcp

或与 紫外线:

uv tool install webex-bot-mcp

安装后 webex-bot-mcp 命令在系统范围内可用。

来源

克隆存储库并使用uv安装:

git clone https://github.com/WebexCommunity/webex-bot-mcp.git
cd webex-bot-mcp
uv sync

安装uv

此项目使用 紫外线 用于Python包管理。你需要先安装uv。

安装uv

macOS和Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

窗户:

powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

替代安装方法:

  • 自制(macOS): brew install uv
  • 点: pip install uv
  • pipx: pipx install uv

查找Claude Desktop的uv路径

对于Claude Desktop配置,您可能需要uv的完整路径。您可以通过以下方式找到它:

which uv

这将返回类似以下内容:

  • macOS/Linux: /Users/username/.cargo/bin/uv 或 /usr/local/bin/uv
  • 视窗: C:\Users\username\.cargo\bin\uv.exe

如果 which uv 不起作用,试试:

whereis uv

备注:如果您通过官方安装程序安装了uv,它通常位于:

  • macOS/Linux: ~/.cargo/bin/uv
  • 视窗: %USERPROFILE%\.cargo\bin\uv.exe

您可以使用完整路径,也可以仅使用 uv 如果uv在您的系统PATH中,请在Claude Desktop配置中。

设置

  1. 安装依赖项:

    uv sync
    
  2. 配置环境变量:

    cp .env.example .env
    

    编辑 .env 并添加您的Webex机器人访问令牌:

    WEBEX_ACCESS_TOKEN=your_bot_access_token_here
    
  3. 测试你的机器人令牌: 您可以通过测试来验证您的机器人令牌是否有效:

    curl -H "Authorization: Bearer YOUR_BOT_TOKEN" \
         https://webexapis.com/v1/people/me
    

    这应该会返回您的机器人的信息。

Bot通知的常见用例

此MCP服务器特别适用于:

系统监控和警报

  • 向运营团队发送服务器状态更新
  • 系统故障或性能问题警报
  • 通知备份完成或失败
  • 监控应用程序运行状况并发送警报

CI/CD管道通知

  • 通知团队构建成功/失败
  • 部署完成警报
  • 发送代码审查提醒
  • 报告测试结果

业务流程通知

  • 客户支持工单警报
  • 销售渠道更新
  • 会议提醒和跟进
  • 报告生成完成

集成示例

  • 连接到监控工具(Prometheus、Grafana)
  • 与票务系统(Jira、ServiceNow)集成
  • 连接到CI/CD平台(Jenkins、GitHub Actions)
  • 连接到业务应用程序(Salesforce、HubSpot)

最佳实践

  • 使用markdown格式以提高消息的可读性
  • 在通知中包含相关上下文和行动项
  • 使用线程回复来组织对话
  • 为不同类型的通知设置不同的机器人
  • 首先在专用测试室测试你的机器人

运行MCP服务器

服务器支持两种传输类型:stdio(默认)和可流式传输http。

标准传输(默认)

webex-bot-mcp

可流式HTTP传输

webex-bot-mcp --transport streamable-http

您还可以自定义HTTP传输的主机和端口:

webex-bot-mcp --transport streamable-http --host 0.0.0.0 --port 9000

命令行选项

  • --transport:选择运输类型(stdio 或 streamable-http,默认值: stdio)
  • --host:要绑定以进行流式http传输的主机(默认值: localhost)
  • --port:用于流式http传输的绑定端口(默认值: 8000)

使用 --help 查看所有可用选项:

webex-bot-mcp --help

还可以使用独立的健康检查命令:

webex-bot-mcp-health
webex-bot-mcp-health --output text
webex-bot-mcp-health --skip-api  # environment check only

Claude桌面集成

要将此MCP服务器与Claude Desktop一起使用,您需要将服务器配置添加到Claude Desktop配置文件中。

配置文件位置

Claude Desktop配置文件位于:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • 视窗: %APPDATA%\Claude\claude_desktop_config.json

标准配置(标准运输)

如果从PyPI安装 (推荐),将此添加到您的 claude_desktop_config.json:

{
  "mcpServers": {
    "webex-bot-mcp": {
      "command": "webex-bot-mcp",
      "env": {
        "WEBEX_ACCESS_TOKEN": "your_webex_bot_access_token_here"
      }
    }
  }
}

如果从源代码签出运行,使用uv运行CLI:

{
  "mcpServers": {
    "webex-bot-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/your/webex-bot-mcp",
        "run",
        "webex-bot-mcp"
      ],
      "env": {
        "WEBEX_ACCESS_TOKEN": "your_webex_bot_access_token_here"
      }
    }
  }
}

备注:如果 uv 或 webex-bot-mcp 如果不在系统PATH中,请使用二进制文件的完整路径。请参阅 安装uv 上面的部分介绍了如何找到完整路径。

设置步骤

  1. 替换占位符:更改 your_webex_bot_access_token_here 到您的实际Webex机器人访问令牌
  2. 更新路径 (仅限源代码检查):更改 /path/to/your/webex-bot-mcp 以匹配您的实际项目目录
  3. 复制配置:将配置添加到Claude Desktop配置文件中
  4. 重新启动克劳德桌面:关闭并重新打开Claude Desktop以加载新配置
  5. 测试MCP服务器:您现在可以使用Claude Desktop中的MCP服务器与Webex会议室交互并发送消息

AI代理提示示例

此MCP服务器使AI代理能够通过自然语言提示与Webex消息交互。以下是代理如何利用Webex机器人的实际示例:

事件管理和运营

“创建事故室并通知待命团队”

Create a new Webex room called "INCIDENT-2025-001-Database-Outage" and send a message to it with:
- Incident severity: P1
- Affected service: Customer Database
- Initial symptoms: Connection timeouts
- Next steps: Investigating root cause
Then send direct messages to the on-call engineers:
- john.doe@company.com
- jane.smith@company.com
- ops-lead@company.com
Alert them about the new incident room and ask them to join immediately.

“向多个团队发送维护通知”

Send a maintenance notification to the following Webex rooms:
- "Engineering Team"
- "Customer Support" 
- "Operations"
- "QA Team"

Message should include:
- Maintenance window: Tonight 11 PM - 2 AM EST
- Affected services: Payment processing, user authentication
- Expected downtime: 15 minutes
- Contact person: DevOps team for questions

自动监控和警报

“向手术室发送系统运行状况更新”

Check our monitoring dashboard and send a daily health summary to the "Operations" room including:
- Server uptime status
- Database performance metrics
- API response times
- Any alerts or warnings from the last 24 hours
Format it nicely with markdown for easy reading.

“关于CI/CD管道故障的警报”

The build pipeline for project "customer-portal" just failed on the main branch.
Send an alert to the "Engineering Team" room with:
- Build ID: #2045
- Failed stage: Integration Tests
- Error summary: Database connection timeout
- Assigned to: @backend-team
- Link to build logs: [provide the link]

客户支持与沟通

“将支持票升级到工程部门”

We have a P1 customer issue that needs engineering attention.
Create a room called "CUSTOMER-ISSUE-Netflix-Streaming" and invite:
- support-manager@company.com
- engineering-lead@company.com
- customer-success@company.com

Send the initial context:
- Customer: Netflix
- Issue: Streaming service integration failing
- Impact: 50,000+ users affected
- Ticket ID: SUP-12345
- Customer contact: tech-contact@netflix.com

“向利益相关者发送发布说明”

We just deployed version 3.2.1 to production. Send release notes to:
- "Product Team" room
- "Customer Success" room
- "Executive Updates" room

Include:
- New features: Advanced analytics dashboard, mobile push notifications
- Bug fixes: 12 critical issues resolved
- Performance improvements: 30% faster page load times
- Breaking changes: None
- Rollback plan: Available if needed

团队协调和项目管理

“协调跨团队项目更新”

Send a weekly project status update to the "Project Alpha" room and individual updates to:
- engineering-manager@company.com
- product-owner@company.com
- design-lead@company.com

Status should include:
- Completed this week: User authentication module
- In progress: Payment integration
- Blocked: Waiting for security review
- Next week's goals: Complete checkout flow
- Risks: Potential delay in third-party API integration

“安排并宣布团队会议”

Send meeting invitations to the "Architecture Review" room for next Tuesday at 2 PM EST.
Agenda:
- Review microservices communication patterns
- Discuss database sharding strategy
- Plan for Q3 scalability improvements
- Action items from last meeting

Also send individual reminders to:
- senior-architect@company.com
- database-admin@company.com
- platform-engineer@company.com

合规与安全警报

“发送安全事件通知”

We detected a potential security incident. Send immediate alerts to:
- "Security Team" room
- "IT Leadership" room
- Direct messages to CISO and IT Director

Include:
- Incident type: Unusual login patterns detected
- Affected systems: Customer portal
- Action taken: Accounts temporarily locked
- Investigation status: In progress
- Next steps: Full security audit initiated

“合规性审计提醒”

Send SOC 2 audit preparation reminders to compliance stakeholders:
- "Compliance Team" room
- "Engineering Leadership" room
- Individual messages to department heads

Reminder should include:
- Audit date: Next Friday
- Required documentation: Security policies, access logs, change management records
- Point of contact: compliance-officer@company.com
- Preparation checklist: [attach file]

集成和自动化示例

“多通道部署通知”

After a successful production deployment, automatically send notifications to:
1. "Engineering Team" room - Technical details and metrics
2. "Product Team" room - Feature summary and user impact
3. "Customer Support" room - What to expect and how to help customers
4. Direct message to release manager with detailed deployment log

“升级工作流程”

If a P1 incident isn't acknowledged within 15 minutes:
1. Send escalation alert to "Critical Incidents" room
2. Page the on-call manager directly
3. Create a conference bridge and share details
4. Notify executive team if incident exceeds 1 hour
5. Update incident status in all relevant rooms

这些示例演示了AI代理如何使用自然语言来编排复杂的Webex消息传递工作流,使事件响应、团队协调和运营通信更加高效和自动化。