Webex Go MCP服务器
基于Go的 模型上下文协议(MCP) 将Cisco Webex API作为工具公开的服务器。支持两者 工作室 和 超文本传输协议 运输方式。这允许LLM(如Claude)与Webex进行交互——发送消息、管理会议室、安排会议、下载成绩单等。
特性
- 两种运输方式:STDIO(单用户、访问令牌)和HTTP(OAuth、静态令牌或混合机器人/用户模式)
- OAuth 2.1授权服务器:在HTTP模式下,充当符合MCP的OAuth 2.1授权服务器,代理Webex Integration OAuth(授权代码+PKCE)
- 动态客户端注册:RFC 7591支持MCP客户端动态注册
- 不透明承载代币:向MCP客户发放自己的代币;Webex令牌从未公开
- 透明令牌刷新:自动刷新过期的Webex令牌
- 多用户支持:每个经过身份验证的用户都会获得自己的Webex API上下文
MCP工具 在Webex API资源类别中:
| 类别 | 工具 | 操作 |
|---|---|---|
| 消息 | 6(仅限+3混合) | 列出、创建、发送附件、发送自适应卡、获取、删除消息 |
| 房间 | 5 | 列出、创建、获取、更新、删除房间/空间 |
| 团队 | 4 | 列出、创建、获取、更新团队 |
| 会员 | 4 | 列出、创建、更新、删除房间成员资格 |
| 会议 | 8 | 列出、创建、获取、更新、修补、删除会议;列出参与者,获取参与者 |
| 文字记录 | 5 | 列出成绩单、下载内容、列出/获取/更新片段 |
| 录音 | 3 | 列出、获取、下载录音 |
| 流媒体 | 4 | 订阅、取消订阅、等待消息、列表订阅 |
| 网络钩子 | 5 | 列出、创建、获取、更新、删除webhooks |
先决条件
- 转到1.26或更高版本
- STDIO模式A. Webex访问令牌
- HTTP模式A. Webex集成 对于OAuth,静态机器人模式的Webex访问令牌,或混合模式的两者都有
构建```bash
go build -o webex-go-mcp .
## 配置
配置是通过环境变量和/或CLI标志加载的。CLI标志优先于环境变量。
### 常见选项
|环境变量| CLI标志|必需|默认值|描述|
|---|---|---|---|---|
| `WEBEX_MODE` | `--mode` |没有| `stdio` |服务器模式: `stdio` 或 `http` |
| `WEBEX_API_BASE_URL` | `--webex-api-base-url` |没有| `https://webexapis.com/v1` |Webex API基础URL|
| `WEBEX_TIMEOUT` | `--timeout` |没有| `30s` |HTTP请求超时|
| `WEBEX_INCLUDE_TOOLS` | `--include` |无|-|逗号分隔的工具列表|
| `WEBEX_EXCLUDE_TOOLS` | `--exclude` |无|-|要排除的工具列表,以逗号分隔|
| `WEBEX_MINIMAL` | `--minimal` |没有| `false` |启用最小工具集|
| `WEBEX_READONLY_MINIMAL` | `--readonly-minimal` |没有| `false` |启用只读最小工具集|
| `WEBEX_SHARED_ENV_MINIMAL` | `--shared-env-minimal` |没有| `false` |启用共享环境安全的最小工具集|
| `WEBEX_ENABLE_MCP_ELICITATION` | `--enable-mcp-elicitation` |没有| `false` |在运行变异Webex工具之前,需要MCP启发批准。如果客户端不支持启发,受保护的操作将失败关闭|
| `WEBEX_STREAMING_IGNORE_FROM_EMAILS` | `--streaming-ignore-from-emails` |否|-|从Mercury流式通知中删除逗号分隔的发件人电子邮件,这对于抑制机器人本身发送的消息很有用|
### STDIO模式选项
|环境变量| CLI标志|必需|默认值|描述|
|---|---|---|---|---|
| `WEBEX_ACCESS_TOKEN` | `--access-token` |是(stdio)|-|Webex API承载令牌|
### HTTP模式选项
|环境变量| CLI标志|必需|默认值|描述|
|---|---|---|---|---|
| `WEBEX_CLIENT_ID` | `--client-id` |(http)|-|Webex Integration客户端ID。如果配置了客户端ID、密钥和访问令牌,则使用http混合模式|
| `WEBEX_CLIENT_SECRET` | `--client-secret` |(http)|-|Webex集成客户端密码|
| `WEBEX_ACCESS_TOKEN` | `--access-token` |(http)|-|静态服务器端Webex令牌。如果没有OAuth配置,它将为所有工具提供动力。通过客户端ID和secret,它可以在混合模式下作为机器人发送默认消息|
| `WEBEX_REDIRECT_URI` | `--redirect-uri` |对OAuth是|-|向Webex注册了OAuth重定向URI|
| `WEBEX_BASE_URL` | `--base-url` |是(http)|-|此MCP服务器的外部基本URL,用于OAuth元数据和签名上传URL。支持本地主机,例如。 `http://localhost:8560` 或 `localhost:8560` |
| `WEBEX_AUTH_API_KEY` | `--auth-api-key` |上不需要|-|可选的API密钥 `/mcp` 请求通过 `X-API-Key`。应用于OAuth或静态令牌模式之上|
| `WEBEX_OAUTH_SCOPES` | `--oauth-scopes` |没有| `spark:all` |Webex OAuth作用域(空格分隔)|
| `WEBEX_HOST` | `--host` |没有| `localhost` |HTTP服务器绑定主机|
| `WEBEX_PORT` | `--port` |没有| `8080` |HTTP服务器端口|
| `WEBEX_TLS_CERT` | `--tls-cert` |没有|-| TLS证书文件的路径|
| `WEBEX_TLS_KEY` | `--tls-key` |没有|-| TLS密钥文件的路径|
| `WEBEX_CORS_ORIGINS` | `--cors-origins` |没有| `*` |允许的CORS源的逗号分隔列表|
### 工具筛选
您可以使用以下命令控制暴露的工具 `--include` 或 `--exclude`。工具在中指定 `category:action` 格式,其中 `category` 映射到Webex API资源(例如。 `messages`, `rooms`, `meetings`)以及 `action` 是操作(例如。 `list`, `create`, `get`, `delete`).
接受单数和复数类别形式(`message:list` 和 `messages:list` 两者都工作)。
这 `category:action` 简写映射到完整的工具名称 `webex_{category}_{action}`例如, `messages:list` 地图到 `webex_messages_list`.
当 `WEBEX_ENABLE_MCP_ELICITATION=true`,发送、创建、更新、修补或删除Webex资源的工具在呼叫Webex之前会请求MCP获取批准。阅读/列表/获取/搜索/下载工具不需要启发。如果连接的MCP客户端不支持启发,则不会执行受保护的操作。
**规则:**
- 如果 `--include` 设置后,仅注册指定的工具。
- 如果 `--exclude` 设置后,将注册除指定工具之外的所有工具。
- 如果两者都被设置, `--include` 优先和 `--exclude` 被忽略。
- 如果两者都没有设置,则注册所有工具(默认)。
**可用类别和操作:**
|类别|行动|
|---|---|
| `people` | `get` |
| `messages` | `list`, `create`, `send_attachment`, `send_adaptive_card`, `get`, `delete`;仅混合动力车: `create_as_logged_in_user`, `send_attachment_as_logged_in_user`, `send_adaptive_card_as_logged_in_user` |
| `rooms` | `list`, `create`, `get`, `update`, `delete` |
| `teams` | `list`, `create`, `get`, `update` |
| `memberships` | `list`, `create`, `update`, `delete` |
| `meetings` | `list`, `create`, `get`, `update`, `patch`, `delete`, `list_participants`, `get_participant` |
| `transcripts` | `list`, `download`, `list_snippets`, `get_snippet`, `update_snippet` |
| `recordings` | `list`, `get`, `download` |
| `streaming` | `subscribe_room_messages`, `unsubscribe`, `wait_for_message`, `list_subscriptions` |
| `webhooks` | `list`, `create`, `get`, `update`, `delete` |
#### 预设标志
为了方便起见,可以使用预设标志,自动将一组精心策划的工具添加到 `--include` 列表:
- **`--minimal`** --消息、房间、团队、会议、成绩单和流媒体的所有操作(不包括会员资格和Webhook)。包括启用HTTP混合模式时仅登录的混合用户发送工具。
- **`--shared-env-minimal`** --共享机器人安全界面:仅限人员查找和出站消息/卡/附件工具。没有房间/消息历史记录读取、广泛列表、订阅、成绩单、会议、会员资格、Webhook、更新或删除。包括启用HTTP混合模式时仅登录的混合用户发送工具。
- **`--readonly-minimal`** --仅对消息、房间、团队、会议、成绩单和流媒体进行读取/列出/获取操作。无需创建、更新或删除。 **17个工具。**
这些旗帜 **合并** 和 `--include` --他们不会覆盖它。例如, `--minimal --include "webhooks:list"` 注册最小集合+ `webhooks:list`如果设置了多个预设, `--shared-env-minimal` 优先考虑,因为这是最安全的。
**示例:**```bash
# Only register read-only transcript tools
./webex-go-mcp --include "transcripts:list,transcripts:download,transcripts:list_snippets,transcripts:get_snippet"
# Register all tools except destructive ones
./webex-go-mcp --exclude "messages:delete,rooms:delete,meetings:delete,memberships:delete,webhooks:delete"
# Use the minimal preset (messages, rooms, teams, meetings, transcripts)
./webex-go-mcp --minimal
# Use readonly-minimal (only read operations, no writes)
./webex-go-mcp --readonly-minimal
# Use shared-env-minimal (safe for shared bot deployments)
./webex-go-mcp --shared-env-minimal
# Minimal preset plus an extra tool
./webex-go-mcp --minimal --include "webhooks:list"
用法
STDIO模式(默认)```bash
export WEBEX_ACCESS_TOKEN="your-token-here"
./webex-go-mcp
### HTTP模式
OAuth模式:```bash
export WEBEX_CLIENT_ID="your-client-id"
export WEBEX_CLIENT_SECRET="your-client-secret"
export WEBEX_REDIRECT_URI="http://localhost:8080/callback"
./webex-go-mcp --mode http --port 8080 --base-url http://localhost:8080
静态令牌模式:```bash
export WEBEX_ACCESS_TOKEN="your-token-here"
./webex-go-mcp --mode http --port 8080 --base-url http://localhost:8080
混合动力模式:```bash
export WEBEX_CLIENT_ID="your-client-id"
export WEBEX_CLIENT_SECRET="your-client-secret"
export WEBEX_REDIRECT_URI="http://localhost:8080/callback"
export WEBEX_ACCESS_TOKEN="your-bot-token-here"
./webex-go-mcp --mode http --port 8080 --base-url http://localhost:8080
在混合模式下,用户仍然使用OAuth进行身份验证。读取/用户上下文工具使用登录用户的令牌。默认消息发送工具使用 WEBEX_ACCESS_TOKEN,因此消息将作为机器人发送。仅限混合 *_as_logged_in_user 工具以OAuth用户身份发送,并拒绝直接发送给同一登录用户。
可选MCP API-钥匙防护装置:```bash
export WEBEX_AUTH_API_KEY="your-mcp-api-key"
然后,客户端必须发送:```text
X-API-Key: your-mcp-api-key
设置Webex集成(HTTP模式)
- 首选 developer.webex.com 并登录
- 导航至 我的Webex应用程序 > 创建新应用程序 > 整合
- 填写必填字段:
- 重定向URI:设置为http://localhost:8080/callback(或您的服务器/callbackURL)
- 范围:选择您的工具所需的范围(例如。,spark:all) - 注意 客户端ID 和 客户端密钥
- 将它们设置为环境变量或CLI标志
HTTP模式端点
| 端点 | 方法 | 身份验证 | 描述 |
|---|---|---|---|
/.well-known/oauth-protected-resource |
GET | 否 | RFC 9728受保护资源元数据 |
/.well-known/oauth-authorization-server |
GET | 否 | RFC 8414授权服务器元数据 |
/register |
POST | 否 | RFC 7591动态客户端注册 |
/authorize |
GET | 否 | OAuth授权(重定向到Webex) |
/callback |
GET | 否 | OAuth回调(来自Webex) |
/token |
POST | 否 | 令牌交换(身份验证码→ 持票人代币) |
/mcp |
POST | 承载 | MCP可流式HTTP端点 |
OAuth流(HTTP模式)```mermaid
sequenceDiagram
participant Client as MCP Client
participant Server as Our Server
participant Webex as Webex
Client->>Server: POST /register
Server-->>Client: client_id
Client->>Server: GET /authorize
Server->>Webex: GET /v1/authorize
Server-->>Client: redirect to Webex
Note over Client,Webex: User consents in browser
Webex->>Server: GET /callback (auth code)
Server->>Webex: POST /v1/access_token
Webex-->>Server: Webex tokens
Server-->>Client: redirect with code
Client->>Server: POST /token (auth code)
Server-->>Client: opaque Bearer token
Client->>Server: POST /mcp (Bearer token)
Note over Server: Resolves Webex token from opaque token
Server-->>Client: tool results
### 直接从Git运行(无需构建)
如果安装了Go,则可以直接从存储库运行服务器,而无需克隆或构建。Go将在一个步骤中获取、编译和执行:```bash
export WEBEX_ACCESS_TOKEN="your-token-here"
go run github.com/tejzpr/webex-go-mcp@latest
在配置Cursor或Claude Desktop等MCP客户端时,这尤其方便——不需要预构建的二进制文件。
克劳德桌面版
添加到您的Claude Desktop MCP配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):
使用预构建的二进制文件:```json
{
"mcpServers": {
"webex": {
"command": "/path/to/webex-go-mcp",
"env": {
"WEBEX_ACCESS_TOKEN": "your-token-here"
}
}
}
}
**使用 `go run` 直接从Git(无构建步骤):**```json
{
"mcpServers": {
"webex": {
"command": "go",
"args": ["run", "github.com/tejzpr/webex-go-mcp@latest"],
"env": {
"WEBEX_ACCESS_TOKEN": "your-token-here"
}
}
}
}
光标
添加到光标MCP配置(.cursor/mcp.json 在您的项目或 ~/.cursor/mcp.json 全球):
使用预构建的二进制文件:```json
{
"mcpServers": {
"webex": {
"command": "/path/to/webex-go-mcp",
"env": {
"WEBEX_ACCESS_TOKEN": "your-token-here"
}
}
}
}
**使用 `go run` 直接从Git(无构建步骤):**```json
{
"mcpServers": {
"webex": {
"command": "go",
"args": ["run", "github.com/tejzpr/webex-go-mcp@latest"],
"env": {
"WEBEX_ACCESS_TOKEN": ""
}
}
}
}
使用工具过滤(仅显示特定工具):```json
{
"mcpServers": {
"webex": {
"command": "go",
"args": ["run", "github.com/tejzpr/webex-go-mcp@latest", "--include", "messages:list,messages:get,transcripts:list,transcripts:download"],
"env": {
"WEBEX_ACCESS_TOKEN": ""
}
}
}
}
**具有只读最低预设(安全、只读访问):**```json
{
"mcpServers": {
"webex": {
"command": "go",
"args": ["run", "github.com/tejzpr/webex-go-mcp@latest", "--readonly-minimal"],
"env": {
"WEBEX_ACCESS_TOKEN": ""
}
}
}
}
> 注: 这 go run 该方法要求在您的 PATH。第一次运行将下载并编译模块(缓存以供后续运行)。要更新到最新版本,Go将在以下时间重新获取 @latest 解析为较新的版本。
工具参考
消息
webex_messages_list--列出房间中的邮件(必填roomId).丰富了房间上下文、发件人姓名和文件元数据。webex_messages_create--发送短信。对于DM某人,只需通过toPersonEmail--无需查找房间。对于组空间,请使用roomId.webex_messages_send_attachment--发送带有文件附件的邮件。在HTTP模式下,使用webex_uploads_request_url+uploadId用于本地客户端文件。webex_messages_send_adaptive_card--将自适应卡发送到房间或个人。在HTTP模式下,卡图像URL可以使用mcp-upload://之后webex_uploads_request_url;不要使用Webex附件filesURL作为卡片图像。webex_messages_create_as_logged_in_user--仅限混合动力模式。以登录的OAuth用户而不是机器人发送文本。webex_messages_send_attachment_as_logged_in_user--仅限混合动力模式。以登录的OAuth用户而不是机器人发送附件。webex_messages_send_adaptive_card_as_logged_in_user--仅限混合动力模式。以登录的OAuth用户而不是机器人的身份发送自适应卡。webex_messages_get--按ID获取消息。丰富了发件人配置文件、房间信息和文件内容(内联文本文件)。webex_messages_delete--按ID删除邮件
房间/空间
webex_rooms_list--列出房间(按以下条件筛选teamId,type,sortBy)webex_rooms_create--创建房间(title必需,可选teamId)webex_rooms_get--按ID获取房间详细信息webex_rooms_update--更新房间标题webex_rooms_delete--删除房间
团队
webex_teams_list--列出团队webex_teams_create--组建一个团队(name必填)webex_teams_get--按ID获取团队详细信息webex_teams_update--更新团队名称
会员
webex_memberships_list--列出成员资格(按以下条件筛选roomId,personEmail)webex_memberships_create--将人员添加到房间(roomId+personEmail或personId)webex_memberships_update--更新成员资格(集isModerator)webex_memberships_delete--将人员移出房间
会议
webex_meetings_list--列出会议(按以下条件筛选meetingType,state,from,to).注:meetingType当需要时state使用。webex_meetings_create--安排与可选受邀者的会议(title,start,end必修的;invitees接受逗号分隔的电子邮件)webex_meetings_get--按ID获取会议详细信息webex_meetings_update--更新会议webex_meetings_patch--部分更新会议(PATCH语义)webex_meetings_delete--取消/删除会议webex_meetings_list_participants--列出实际参加过过去会议的人员(加入/离开时间、主持人状态、设备)webex_meetings_get_participant--按ID获取特定参与者
文字记录
webex_transcripts_list--列出会议记录(按以下条件筛选meetingId,hostEmail,日期范围)webex_transcripts_download--下载成绩单内容(需要transcriptId+meetingId,可选format:txt或vtt)webex_transcripts_list_snippets--列出成绩单中的口语片段webex_transcripts_get_snippet--获取特定的成绩单片段webex_transcripts_update_snippet--更新/更正成绩单片段的文本
录音
webex_recordings_list--列出会议记录(按以下条件筛选meetingId,hostEmail,日期范围)webex_recordings_get--按ID获取录制详细信息webex_recordings_download--下载录制内容
流媒体
webex_subscribe_room_messages--订阅房间中的实时消息webex_unsubscribe--取消订阅webex_wait_for_message--等待订阅的下一条消息webex_list_subscriptions--列出活动订阅
网络钩子
webex_webhooks_list--列出webhookswebex_webhooks_create--创建webhook(name,targetUrl,resource,event必填)webex_webhooks_get--按ID获取webhook详细信息webex_webhooks_update--更新webhookwebex_webhooks_delete--删除webhook
建筑```
webex-go-mcp/
main.go -- Cobra CLI + Viper config, mode branching (STDIO/HTTP)
server.go -- MCP server setup, STDIO + HTTP server startup
auth/
client_resolver.go -- ClientResolver type (static for STDIO, context-based for HTTP)
discovery.go -- RFC 9728 + RFC 8414 well-known metadata endpoints
middleware.go -- Bearer token auth middleware, transparent token refresh
oauth.go -- /authorize, /callback, /token (proxies Webex OAuth)
registration.go -- RFC 7591 Dynamic Client Registration
store.go -- In-memory token store, auth code store, pending auth state
tools/
filter.go -- ToolRegistrar interface, tool include/exclude filtering
enrich.go -- Response enrichment helpers (person names, room info, files)
messages.go -- 6 message tools
rooms.go -- 5 room tools
recordings.go -- 3 recording tools
teams.go -- 4 team tools
memberships.go -- 4 membership tools
meetings.go -- 8 meeting tools
transcripts.go -- 5 transcript tools
webhooks.go -- 5 webhook tools
streaming/
manager.go -- Real-time subscriptions (subscribe, unsubscribe, wait_for_message, list_subscriptions)
```
依赖项
- mcp走 --MCP服务器框架(STDIO+流式HTTP)
- webex go sdk --Webex API客户端
- 眼镜蛇 --CLI框架
- 蝰蛇 --配置管理
许可证
MPL-2.0
