电报AI桥梁 是 AI Skill Hub 本期精选MCP工具之一。综合评分 7.5 分,整体质量较高。我们推荐使用将其纳入你的 AI 工具库,帮助提升工作效率。
电报AI桥梁 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
电报AI桥梁 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/AliceLJY/telegram-ai-bridge
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"--ai--": {
"command": "npx",
"args": ["-y", "telegram-ai-bridge"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 电报AI桥梁 执行以下任务... Claude: [自动调用 电报AI桥梁 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"__ai__": {
"command": "npx",
"args": ["-y", "telegram-ai-bridge"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
Run multiple bots for parallel workflows:
@cc-alpha → Claude Code instance 1 (primary)@cc-beta → Claude Code instance 2 (parallel tasks)@cc-gamma → Claude Code instance 3 (parallel tasks)@your-codex-bot → Codex (different backend)Each Claude instance shares memory automatically. No configuration needed — CC's memory lives in ~/.claude/, not in the bot.
Supported backends:
| Backend | SDK | Status |
|---|---|---|
claude | Claude Code (via Agent SDK) | Recommended |
codex | Codex CLI (via Codex SDK) | Recommended |
gemini | Gemini Code Assist API | The "quiet scribe" — see note below |
Gemini's niche in this setup. The Gemini backend is best used as an overnight note-taker in a multi-agent group: let Claude and Codex brainstorm, and have Gemini read along and summarize the conversation on a schedule. It is the least chatty of the three backends, which turns out to be a fit for that role. Nothing in the code enforces a read-only mode — you shape the behavior through the per-bot CLAUDE.md / prompt. It runs through Gemini Code Assist API, not a full CLI terminal, so capabilities are narrower than Claude Code or Codex.
Core rule: One bot = one process = one independent agent. Run as many as you need.
The bridge is transparent. Your TG bot inherits whatever skills, MCP servers, and hooks your local CC has. If CC can browse the web, generate images, or query databases in terminal — it can do the same through Telegram. The bridge adds session management; the capabilities come from CC itself.
---
Run N parallel Claude Code instances, each with its own Telegram bot:
1. Create a bot — message @BotFather on Telegram, get a token.
2. Create a config file — copy and customize:
```bash cp config.json config-2.json
Prerequisites: Bun runtime, a Telegram bot token (from @BotFather), and at least one backend CLI: Claude Code, Codex, or Gemini CLI.
git clone https://github.com/AliceLJY/telegram-ai-bridge.git
cd telegram-ai-bridge
bun install
bun run bootstrap --backend claude
bun run setup --backend claude
bun run check --backend claude
bun run start --backend claude
Want parallel agents? Add a second bot in 30 seconds — see Multi-Instance Deployment.
Input has always been bidirectional: text, photos, documents, voice all flow to CC. Now output is too:
The bridge captures images from SDK tool results (base64 data from Read/peekaboo/screenshot tools) and scans CC's response text for file paths. No manual copy-paste, no "where did you save it?" — files just appear in the chat.
Reply to cancel: Task taking too long? Send /cancel to abort. Need context from a previous message? Reply to it — the quoted text is automatically included as context.
json { "shared": { "ownerTelegramId": "YOUR_ID", "tasksDb": "tasks-2.db" }, "backends": { "claude": { "enabled": true, "telegramBotToken": "NEW_TOKEN_FROM_BOTFATHER", "sessionsDb": "sessions-2.db", "model": "claude-opus-4-7", "permissionMode": "bypassPermissions" } } }
**3. Start it:**
bash bun run start --backend claude --config config-2.json
**4. (Optional) Register as LaunchAgent** for auto-start:
bash ./scripts/install-launch-agent.sh --backend claude --instance 2 --config config-2.json --install bun run check-configs config.example.json config-2.json
See the LaunchAgent section below for plist setup.
> **What's shared vs isolated:**
>
> | Shared (automatic) | Isolated (per-instance) |
> |---|---|
> | `~/.claude/` (CLAUDE.md, memory, skills, hooks) | Telegram bot token |
> | MCP servers (memory-store, etc.) | SQLite sessions DB |
> | Project settings & rules | SQLite tasks DB |
> | Git repos & file system | Log files |
---
<details>
<summary><strong>macOS LaunchAgent</strong></summary>
Generate and install:
bash ./scripts/install-launch-agent.sh --backend claude --install ./scripts/install-launch-agent.sh --backend codex --install ./scripts/install-log-rotation.sh --install
The wrapper runs `bun run check` before `bun run start`, so bad config fails fast.
Logs are written under `~/Library/Logs/telegram-ai-bridge/` and the rotation agent copy-truncates them daily at 03:00.
Default labels: `com.telegram-ai-bridge`, `com.telegram-ai-bridge-codex`, `com.telegram-ai-bridge-gemini`.
bash launchctl print gui/$(id -u)/com.telegram-ai-bridge launchctl kickstart -k gui/$(id -u)/com.telegram-ai-bridge tail -f ~/Library/Logs/telegram-ai-bridge/bridge.log
If you see `409 Conflict`, another process is polling the same bot token.
</details>
<details>
<summary><strong>Docker</strong></summary>
bash docker build -t telegram-ai-bridge .
docker run -d \ --name tg-ai-bridge-claude \ -v $(pwd)/config.json:/app/config.json:ro \ -v ~/.claude:/root/.claude \ telegram-ai-bridge --backend claude ```
Swap credential mount and --backend for other backends. See docker-compose.example.yml for a Compose starter.
</details>
<details> <summary><strong>Project Structure</strong></summary>
start.js — CLI entry for start, bootstrap, check, setup, configconfig.js — Config loader and setup wizardbridge.js — Telegram bot runtimesessions.js — SQLite session persistencediscuss-mode.js — Discuss mode send/silent contract, control command semantics, and probe gatinggroup-context-pipeline.js — Canonical group-message context reduction and renderingtelegram-command-routing.js — Telegram slash-command target parsing, including mention-first control commandsstreaming-preview.js — Live text preview via editMessage (throttled, with degradation)progress.js — Progress messages and typing-only indicatorssend-retry.js — Outbound delivery retry with error classification and HTML fallbackfile-ref-protect.js — Prevents Telegram auto-linking filenames as domains (.md, .go, .py etc.)shared-context.js — Cross-bot shared context entry pointshared-context/ — Pluggable backends (SQLite / JSON / Redis)a2a/ — Agent-to-agent communication bus, loop guard, peer healthadapters/ — Backend integrationslaunchd/ — LaunchAgent template for macOSscripts/ — Install wrapper and runtime launcherdocker-compose.example.yml — Compose starter</details>
<details> <summary><strong>Execution Modes</strong></summary>
direct — runs the backend adapter in-process (default)local-agent — communicates with a local agent subprocess over JSONL stdioSet in config.json at shared.executor, or override with BRIDGE_EXECUTOR.
</details>
---
[mcp_servers.claude-code] type = "stdio" command = "claude" args = ["mcp", "serve"] ```
Claude Code and Codex each have a built-in MCP server mode. Register them with each other and they can call each other directly — no bridge, no Telegram, no custom code:
```bash
Claude Code now ships Remote Control (Feb 2026) and a Telegram channel plugin (Mar 2026). Both let you talk to Claude from your phone. Neither gives you session management, multi-backend support, or agent-to-agent collaboration.
| Key differentiator | Remote Control | Channels | OpenClaw | **This project** |
|---|---|---|---|---|
| Parallel sessions | — | — | 1 bot = 1 session | **N bots, shared memory** |
| Session management (new/resume/peek) | — | — | — | ✅ Full lifecycle |
| Image & file output relay | Terminal only | — | — | ✅ Auto-sent to chat |
| War Room (multi-agent) | — | — | — | ✅ @mention + shared context |
| Multi-backend (Claude/Codex/Gemini) | Claude only | Claude only | Provider-locked | ✅ All three |
| Always-on daemon | Terminal must stay open | Session-tied | Gateway | ✅ LaunchAgent / Docker |
| Production reliability | — | — | — | ✅ Retry, rate-limit, drain |
What official tools do better: Remote Control streams full terminal output. Channels relay tool-approval dialogs natively. This project optimizes for a different job: persistent, multi-agent session management entirely from Telegram.
<details> <summary><strong>Full comparison (26 features)</strong></summary>
| Feature | [Remote Control](https://code.claude.com/docs/en/remote-control) | [Channels](https://code.claude.com/docs/en/channels) (TG plugin) | [OpenClaw](https://github.com/openclaw/openclaw) | This project |
|---|---|---|---|---|
| Parallel sessions (multi-instance) | — | — | 1 bot = 1 session | **N bots, N parallel CC instances, shared memory** |
| Create new sessions from phone | — | — | — | /new |
| Browse & resume past sessions | — | — | — | /sessions /resume /peek |
| Switch models on the fly | — | — | Per-bot config | /model with inline buttons |
| Claude + Codex + Gemini backends | Claude only | Claude only | Provider-locked | All three, per-chat switchable |
| Tool approval from phone | Partial (limited UI) | Yes | Yes | Inline buttons: Allow / Deny / Always / YOLO |
| War Room (multi-agent command center) | — | — | — | @mention dispatch + pluggable shared context (SQLite/Redis) |
| Multi-agent group collaboration | — | — | — | A2A bus + shared context |
| Cross-agent collaboration | — | — | Gateway channels | A2A broadcast (groups) + MCP/CLI (DMs) |
| Real-time progress streaming | Terminal output only | — | Yes | **Live text preview** (editMessage streaming) + tool icons + 3 verbosity levels |
| Rapid message batching | N/A | — | — | FlushGate: 800ms window, auto-merge |
| Photo / document / voice input | — | Text only | Yes | Auto-download + reference in prompt |
| **Image / file output relay** | Terminal only | — | — | **Screenshots & files auto-sent to TG chat** |
| Cancel running task | Ctrl+C in terminal | — | — | /cancel — abort from phone |
| Message reply context | N/A | — | — | Reply to any message → quoted text as context |
| Smart quick-reply buttons | — | — | — | Yes/No + numbered options (1. 1、 1) formats) |
| Runs as background daemon | Terminal must stay open | Session must be open | Yes (Gateway) | LaunchAgent / Docker |
| Survives network interruptions | 10-min timeout kills session | Tied to session lifecycle | Gateway reconnect | SQLite + Redis persistence |
| Memory shared across instances | N/A | N/A | Per-bot isolated | **All instances share CLAUDE.md + MCP memory** |
| Per-bot persona | N/A | N/A | SOUL.md per bot | Per-bot CLAUDE.md workspace + shared global rules |
| Group context compression | N/A | N/A | N/A | 3-tier: recent full / middle truncated / old keywords |
| Shared context backend | N/A | N/A | N/A | SQLite / JSON / Redis (pluggable) |
| Task audit trail | — | — | — | SQLite: status, cost, duration, approval log |
| Loop guard for bot-to-bot | N/A | N/A | N/A | 5-layer: generation cap + AI self-decline + no-rebroadcast + idempotency + circuit breaker |
| Production reliability | — | — | — | Exponential retry, rate-limit, FlushGate batching, graceful drain |
| Stable release | Yes | Research preview | Yes | Yes (v4.1) |
</details>
<details> <summary><strong>Migrating from OpenClaw?</strong></summary>
Every OpenClaw feature has a direct equivalent — most of them are just CC running natively behind the bridge:
| OpenClaw feature | How this project handles it |
|---|---|
| **IM integration** (Telegram/WhatsApp) | grammy Telegram bot + Claude Code Agent SDK — runs full CC, not an API wrapper |
| **Multi-agent routing** | A2A bus (auto-debate) + War Room (@mention dispatch) |
| **Skills** | CC native skills (~/.claude/skills/) — no conversion needed |
| **Memory system** | CC native (CLAUDE.md + MCP memory like memory-store) — shared across all instances |
| **Cron / scheduled tasks** | CC native cron — runs inside the agent, results delivered to TG |
| **Tool execution** (bash/fs/web) | CC native tools — Bash, Read, Write, Edit, Glob, Grep, WebFetch, etc. |
| **External agents (ACP)** | CC subagents + MCP servers |
| **Hooks** | CC native hooks (~/.claude/settings.json) |
| **Web UI** | **Telegram IS the UI** — inline buttons, notifications, multi-device, zero deployment |
| **SOUL.md persona** | Per-bot CLAUDE.md workspace + shared global rules |
| **Workspace memory** | Per-project CLAUDE.md + MCP memory — CC loads both automatically |
The difference: OpenClaw reimplements these features on top of an API. This project runs actual Claude Code — every feature CC has, you get for free.
</details>
---
| Backend | Dependencies | Concurrency | Best For |
|---|---|---|---|
sqlite (default) | None (built-in) | WAL mode, single-writer | Single bot, low concurrency |
json | None (built-in) | Atomic write (tmp+rename) | Zero-dependency deployment |
redis | ioredis | Native concurrency + TTL | Multi-bot, Docker environment |
Set sharedContextBackend in config.json:
{
"shared": {
"sharedContextBackend": "redis",
"redisUrl": "redis://localhost:6379"
}
}
Note: Bots only respond when explicitly @mentioned or replied to. They don't auto-reply to each other.
创新AI代理合作解决方案
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
经综合评估,电报AI桥梁 在MCP工具赛道中表现稳健,质量良好。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | telegram-ai-bridge |
| 原始描述 | 开源MCP工具:Heterogeneous AI agents (Claude Code + Codex + Gemini) collaborating in Telegram。⭐8 · JavaScript |
| Topics | ai-agentjavascripttelegram |
| GitHub | https://github.com/AliceLJY/telegram-ai-bridge |
| License | MIT |
| 语言 | JavaScript |
收录时间:2026-05-26 · 更新时间:2026-05-30 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端