byv1ki· 1 MCP server
Feishu (飞书) channel plugin for Claude Code — messaging bridge with built-in access control
$git clone https://github.com/v1ki/claude-feishu-pluginInstalls into the current project.
Install claude-feishu-plugin by running `git clone https://github.com/v1ki/claude-feishu-plugin`, then use it for the current task and follow its documentation at https://github.com/v1ki/claude-feishu-plugin.
| 1 | # Feishu Channel for Claude Code |
| 2 | |
| 3 | Connect a Feishu (飞书) bot to your Claude Code with an MCP server. |
| 4 | |
| 5 | The MCP server logs into Feishu as a bot and provides tools to Claude to reply, |
| 6 | react, or edit messages. When you message the bot, the server forwards the |
| 7 | message to your Claude Code session. |
| 8 | |
| 9 | > 📖 [中文文档](README_CN.md) |
| 10 | |
| 11 | ## Prerequisites |
| 12 | |
| 13 | - [Bun](https://bun.sh) — the MCP server runs on Bun. Install with |
| 14 | `curl -fsSL https://bun.sh/install | bash`. |
| 15 | |
| 16 | ## Quick Setup |
| 17 | |
| 18 | > Default pairing flow for a single-user DM bot. See [ACCESS.md](ACCESS.md) |
| 19 | > for groups and multi-user setups. |
| 20 | |
| 21 | ### 1. Create a Feishu bot |
| 22 | |
| 23 | Go to [Feishu Open Platform](https://open.feishu.cn/app) → **Create Custom |
| 24 | App** (创建自建应用). Give it a name (e.g. "ClaudeCode") and description. |
| 25 | |
| 26 | #### 1a. Copy credentials |
| 27 | |
| 28 | Left menu → **Credentials & Basic Info** (凭证与基础信息): |
| 29 | - Copy **App ID** (`cli_xxx`) and **App Secret** — you'll need these in step 3. |
| 30 | |
| 31 |  |
| 32 | |
| 33 | #### 1b. Add bot capability |
| 34 | |
| 35 | Left menu → **App Features** (应用能力) → **Bot** (机器人): |
| 36 | - Toggle **Enable Bot** on. This makes the app appear as a bot users can DM. |
| 37 | |
| 38 |  |
| 39 | |
| 40 | #### 1c. Configure permissions |
| 41 | |
| 42 | Left menu → **Permissions & Scopes** (权限管理) → **API Permissions**: |
| 43 | |
| 44 | | Scope | Description | Required | |
| 45 | |---|---|---| |
| 46 | | `im:message` | Read messages | ✅ | |
| 47 | | `im:message:send_as_bot` | Send messages as bot | ✅ | |
| 48 | | `im:resource` | Download images/files from messages | ✅ for photos | |
| 49 | | `im:message.reactions:write` | Add emoji reactions | Optional (for `ackReaction`) | |
| 50 | | `im:chat:readonly` | Read chat info | Optional | |
| 51 | |
| 52 | Search each scope name and click **Activate** (开通). |
| 53 | |
| 54 |  |
| 55 | |
| 56 | #### 1d. Configure event subscriptions ⚠️ |
| 57 | |
| 58 | > **This step is critical.** If you skip it or choose the wrong subscription |
| 59 | > method, the bot can send messages but **cannot receive** them. |
| 60 | |
| 61 | Left menu → **Event Subscriptions** (事件与回调): |
| 62 | |
| 63 | 1. **Subscription method** (订阅方式) — select **Long Connection** (使用长连接 |
| 64 | 接收事件). This is the WebSocket mode, no public URL needed. |
| 65 | 2. Click **Add Event** (添加事件) → search `im.message.receive_v1` → add it. |
| 66 | The full name is "Receive Messages v2.0" (接收消息 v2.0). |
| 67 | |
| 68 |  |
| 69 | |
| 70 | #### 1e. Publish and approve |
| 71 | |
| 72 | Left menu → **App Release** (版本管理与发布): |
| 73 | - Click **Create Version** (创建版本) → fill in version notes → **Submit** |
| 74 | (提交发布). |
| 75 | - A Feishu **admin** in your organization needs to approve the release in the |
| 76 | [Admin Console](https://feishu.cn/admin/appCenter/audit). For personal/test |
| 77 | tenants where you are the admin, it may auto-approve. |
| 78 | |
| 79 | > After any permission or event subscription change, you must **publish a new |
| 80 | > version** for it to take effect. This is easy to forget. |
| 81 | |
| 82 |  |
| 83 | |
| 84 | #### 1f. Verify the bot is live |
| 85 | |
| 86 | Open Feishu → search your bot name → you should see it as a contact. If not, |
| 87 | check that the version is published and approved. |
| 88 | |
| 89 | ### 2. Install the plugin |
| 90 | |
| 91 | These are Claude Code commands — run `claude` to start a session first. |
| 92 | |
| 93 | First, register this repository as a plugin marketplace (only needed once): |
| 94 | |
| 95 | ```bash |
| 96 | claude plugin marketplace add V1ki/claude-feishu-plugin |
| 97 | ``` |
| 98 | |
| 99 | Then install the plugin: |
| 100 | |
| 101 | ```bash |
| 102 | claude plugin install feishu@claude-feishu-plugin |
| 103 | ``` |
| 104 | |
| 105 | Restart your session or run `/reload-plugins`. Check that `/feishu:configure` |
| 106 | tab-completes. |
| 107 | |
| 108 | ### 3. Save credentials |
| 109 | |
| 110 | ``` |
| 111 | /feishu:configure cli_xxx your_app_secret |
| 112 | ``` |
| 113 | |
| 114 | Writes `FEISHU_APP_ID=...` and `FEISHU_APP_SECRET=...` to |
| 115 | `~/.claude/channels/feishu/.env`. You can also write that file by hand, or set |
| 116 | the variables in your shell environment — shell takes precedence. |
| 117 | |
| 118 | ### 4. Launch with channel flag |
| 119 | |
| 120 | Exit your session and start a new one: |
| 121 | |
| 122 | ```bash |
| 123 | claude --dangerously-load-development-channels plugin:feishu@claude-feishu-plugin |
| 124 | ``` |
| 125 | |
| 126 | > **Note:** `--channels` requires the plugin to be on Claude's approved |
| 127 | > channels allowlist, which is not yet available for third-party plugins. |
| 128 | > Use `--dangerously-load-development-channels` instead — it has the same |
| 129 | > functionality but skips the allowlist check. |
| 130 | |
| 131 | ### 5. Pair |
| 132 | |
| 133 | DM your bot on Feishu — it replies with a 6-character pairing code. In your |
| 134 | assistant session: |
| 135 | |
| 136 | ``` |
| 137 | /feishu:access pair <code> |
| 138 | ``` |
| 139 | |
| 140 | Your next DM reaches the assistant. |
| 141 | |
| 142 | ### 6. Lock it down |
| 143 | |
| 144 | Pairing is for capturing IDs. Once you're in, switch to `allowlist` so |
| 145 | strangers don't get pairing-code replies: |
| 146 | |
| 147 | ``` |
| 148 | /feishu:access policy allowlist |
| 149 | ``` |
| 150 | |
| 151 | ## Access control |
| 152 | |
| 153 | See **[ACCESS.md](ACCESS.md)** for DM policies, groups, mention detection, |
| 154 | delivery config, skill commands, and the `access.json` schema. |
| 155 | |
| 156 | Quick reference: IDs are **Feishu open_ids** (e.g. `ou_xxx`). Default policy |
| 157 | is `pairing`. `ackReaction` uses Feishu emoji types like `THUMBSUP`. |
| 158 | |
| 159 | ## Tools exposed to the assistant |
| 160 | |
| 161 | | Tool | Purpose | |
| 162 | | --- | --- | |
| 163 | | `reply` | Send to a cha |