内容
# clawconnect
```
████████████████████████████████████████
██ ██
██ ░░ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ░░ ██
██ ░░ ██ ╔══╗ CLAW ██ ░░ ██
██ ░░ ██ ║██║ CONNECT ██ ░░ ██
██ ░░ ██ ╚══╝ ██ ░░ ██
██ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ ██
████████████████████████████████████████
CONSUME. CONNECT. CONTROL.
```
**适用于 OpenClaw 代理的 Cowork 风格连接器 — 通过命令行、Telegram 和 MCP。**
---
## 什么是 clawconnect?
[Claude Cowork](https://claude.ai) 有一个精致的连接器商店 — 只需点击几下即可验证 Gmail、Slack、Notion 和其他 dozens 种服务,并具有明确的权限控制(只读、写入、需要批准)。OpenClaw 代理没有等效功能:连接器通过插件、环境变量和手动配置组装。
clawconnect 弥补了这一差距。它为 OpenClaw 用户提供了从终端使用 Cowork 风格的连接器体验,包含三个共同工作的组件:
1. **命令行** — 验证服务、管理凭证并直接执行操作
2. **MCP 桥接器** — 将所有连接的服务公开为 MCP 工具,可被 OpenClaw 和 Cowork 自定义连接器插槽读取
3. **Telegram 伴侣** — 代理可以代表您请求连接器操作;您通过内联键盘在执行前批准
---
## clawconnect 与现有工具的区别
存在多个开源 Claude Cowork 替代方案 — [OpenWork](https://openworklabs.com)、[Eigent](https://eigent.ai)、[open-claude-cowork](https://github.com/composio-community/open-claude-cowork) — 但它们都没有解决相同的问题:
| | OpenWork | Eigent | open-claude-cowork | **clawconnect** |
|---|---|---|---|---|
| 目标 | Cowork 桌面替代品 | 多代理工作队伍 | Cowork 桌面替代品 | OpenClaw 连接器层 |
| 接口 | 桌面 GUI | 桌面 GUI | Electron GUI | 命令行 + Telegram + MCP |
| OpenClaw 集成 | ✗ | ✗ | 部分(仅消息传递) | ✓ 原生通过 MCP |
| Cowork 桥接器 | ✗ | ✗ | ✗ | ✓ 自定义连接器 URL |
| 代理发起的操作 | ✗ | ✗ | ✗ | ✓ 带有用户批准门槛 |
| Telegram 批准流程 | ✗ | ✗ | ✓ (仅消息传递) | ✓ 完整连接器批准 |
| 不需要 GUI | ✓ | ✗ | ✗ | ✓ |
| 自定义连接器 | 通过 MCP | 通过 MCP | 通过技能 | ✓ YAML/JSON 插入 |
| 需要 Anthropic 账户 | ✗ | ✗ | ✗ | ✗ |
**clawconnect 填补的特定空白:** OpenClaw 代理可以发现和调用连接器操作作为 MCP 工具 — 用户可以通过 Telegram 批准或拒绝这些请求 — 无需 GUI,无需 Anthropic 凭证,也无需替换现有的 OpenClaw 设置。
---
## 内置连接器
| 连接器 | 验证 | 关键操作 |
|---|---|---|
| `gmail` | OAuth2 | 列出、获取、发送、搜索消息 |
| `google-drive` | OAuth2 | 列出、获取、下载、上传文件 |
| `calendar` | OAuth2 | 列出事件、创建事件 |
| `slack` | OAuth2 | 列出频道、发送消息、获取消息 |
| `notion` | API 密钥 | 数据库、页面 — 列出、查询、创建、更新 |
| `github` | API 密钥 | 仓库、问题、PR — 列出、创建、获取 |
| `custom` | API 密钥 | 任何 MCP 兼容的服务器 URL |
---
## 安装
```bash
pip install clawconnect
# 可选:自定义连接器的 YAML 支持
pip install pyyaml
# 或从源代码:
git clone https://github.com/terence-ma/clawconnect
cd clawconnect && pip install -e .
```
---
## 快速入门
```bash
# 1. 初始设置
clawconnect init
# 2. 浏览连接器
clawconnect connectors list
# 3. 连接服务
clawconnect connect gmail # OAuth2 — 打开浏览器
clawconnect connect notion --api-key secret_xxx
clawconnect connect github --api-key ghp_xxx
# 4. 运行操作
clawconnect run gmail list_messages --params '{"max_results": 5}'
clawconnect run slack send_message --params '{"channel": "#general", "text": "hello"}'
# 5. 启动 MCP 桥接器(OpenClaw + Cowork)
clawconnect bridge start
# 6. 启动 Telegram 伴侣机器人
clawconnect telegram start
```
---
## MCP 桥接器
桥接服务器通过 HTTP 将所有连接的服务公开为 MCP 工具。
一个 URL 可在 OpenClaw 和 Cowork 中使用。
**OpenClaw** — 添加到 `~/.openclaw/openclaw.json`:
```json
{
"mcp": {
"servers": {
"clawconnect": {
"url": "http://127.0.0.1:18800/mcp"
}
}
}
}
```
**Cowork** — 设置 → 连接器 → 添加自定义连接器:
```
URL: http://127.0.0.1:18800/mcp
```
您的代理可以调用:
- `gmail__send_message`、`gmail__list_messages`
- `slack__send_message`、`slack__list_channels`
- `notion__create_page`、`notion__query_database`
- `github__create_issue`、`github__list_repos`
- 您定义的任何自定义连接器
---
## Telegram 伴侣
代理可以通过桥接器请求连接器操作。Telegram 机器人
将这些请求显示给您为内联键盘批准。
```
代理想要: gmail → send_message
至: someone@example.com
主题: Weekly report
正文: Here is the summary...
[✅ 批准] [❌ 拒绝]
```
**设置:**
1. 使用 [@BotFather](https://t.me/botfather) 创建机器人
2. `clawconnect init` → 输入机器人令牌
3. `clawconnect telegram start`
---
## 自定义连接器
### 方法 1:放置 YAML 文件(无需 Python)
创建 `~/.clawconnect/connectors/my-service.yaml`:
```yaml
name: my-service
display_name: 我的服务
description: 连接到我的服务 API
category: productivity
auth: api_key
actions:
- name: list_items
description: 列出所有项目
params:
limit: int
query: str
- name: create_item
description: 创建新项目
params:
title: str
body: str
telegram_prompts:
create_item:
- field: title
prompt: "项目标题:"
- field: body
prompt: "项目内容:"
# 自动执行 HTTP 调用,无需编写 Python
executor:
base_url: https://api.my-service.com/v1
auth_header: Authorization
auth_prefix: Bearer
actions:
list_items:
method: GET
path: /items
query_params: [limit, query]
create_item:
method: POST
path: /items
body_params: [title, body]
```
就是这样。无需代码。重启 clawconnect 并在连接器列表中出现 `my-service`。
### 方法 2:Python 执行器(完全控制)
将内容添加到 `connectors/registry.py` 和 `connectors/executor.py` 中,用于
具有复杂身份验证、分页或响应转换需求的连接器。
查看现有连接器的模式。
---
## 架构
```
clawconnect/
├── cli.py # 命令行入口点(click + rich)
├── connectors/
│ ├── registry.py # 内置连接器定义
│ ├── loader.py # YAML/JSON 自定义连接器加载器
│ ├── oauth.py # OAuth 2.0 浏览器流程
│ └── executor.py # API 调用实现
├── bridge/
│ └── server.py # MCP JSON-RPC 桥接服务器
└── telegram/
└── bot.py # Telegram 批准伴侣
配置:~/.clawconnect/
├── settings.json # 网关 URL、端口、机器人令牌
├── tokens.json # 凭证(仅限用户权限)
└── connectors/ # 在此处放置自定义 YAML/JSON 连接器
└── example-connector.yaml.disabled
```
---
## 安全
- 令牌存储在 `~/.clawconnect/tokens.json` 中,具有仅限用户的权限
- OAuth 客户端机密从环境变量中读取 — 绝不存储到磁盘
- 每个代理发起的操作在执行前都需要明确的 Telegram 批准
- MCP 桥接器仅绑定到 `127.0.0.1` — 默认情况下不对外公开
- 如果需要远程访问,请通过 Cloudflare Tunnel 公开(不建议在没有身份验证的情况下使用)
---
## 许可证
MIT — 免费使用、修改和重新分发。