mcpField
F
feishu-connection

feishu-connection

github.com/xiaomingxProductivity795 installsUpdated 39w ago
Repository

About feishu-connection

A local WebSocket bridge that forwards Feishu bot messages to Clawdbot Gateway and maps each Feishu chat to a Clawdbot session. It is for routing Feishu conversations to an AI agent without opening an inbound port or requiring a public IP.

Key features

  1. 01Bridges Feishu and Clawdbot Gateway
  2. 02Maps chats to Clawdbot sessions
  3. 03Uses outbound Feishu SDK connection
  4. 04Filters group messages for replies
  5. 05Supports macOS service startup

Use cases

  1. 01Routing Feishu chats to a Clawdbot agent
  2. 02Handling bot messages in Feishu group chats
  3. 03Running the bridge as a macOS service

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/xiaomingx/moltbot-connector-feishu-dingtalk --skill feishu-connection

After installing, type/feishu-connectionin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

.env.example
bridge.py
pyproject.toml
README.md
setup_service.py

Details

From the project README

Feishu Bridge

Bridge Feishu bot messages to Clawdbot Gateway over local WebSocket.

Architecture

Feishu user → Feishu cloud ←WS→ bridge.py (local) ←WS→ Clawdbot Gateway → AI agent
  • Feishu SDK connects outbound (no inbound port / public IP needed)
  • Bridge authenticates to Gateway using the existing gateway token
  • Each Feishu chat maps to a Clawdbot session (feishu:<chatId>)

Setup

1. Create Feishu bot
  1. Go to open.feishu.cn/app → Create self-built app → Add Bot capability
  2. Enable permissions: im:message, im:message.group_at_msg, im:message.p2p_msg
  3. Events: add im.message.receive_v1, set delivery to WebSocket long-connection
  4. Publish the app (create version → request approval)
  5. Note the App ID and App Secret
2. Store secret
mkdir -p ~/.clawdbot/secrets
echo "YOUR_APP_SECRET" > ~/.clawdbot/secrets/feishu_app_secret
chmod 600 ~/.clawdbot/secrets/feishu_app_secret
3. Install & run
cd <skill-dir>/feishu-connection
uv sync
FEISHU_APP_ID=cli_xxx uv run python bridge.py
4. Auto-start (macOS)
FEISHU_APP_ID=cli_xxx uv run python setup_service.py
launchctl load ~/Library/LaunchAgents/com.clawdbot.feishu-bridge.plist

Diagnostics

# Check service
launchctl list | grep feishu

# Logs
tail -f ~/.clawdbot/logs/feishu-bridge.err.log

# Stop
launchctl unload ~/Library/LaunchAgents/com.clawdbot.feishu-bridge.plist

Group chat behavior

Bridge replies only when: user @-mentions the bot, message ends with ?/?, contains request verbs (帮/请/分析/总结…), or calls the bot by name. Customize the name list in bridge.py → should_respond_in_group().

Environment variables

VariableRequiredDefault
FEISHU_APP_ID✅—
FEISHU_APP_SECRET_PATH—~/.clawdbot/secrets/feishu_app_secret
CLAWDBOT_CONFIG_PATH—~/.clawdbot/clawdbot.json
CLAWDBOT_AGENT_ID—main
FEISHU_THINKING_THRESHOLD_MS—2500

Comments

Markdown supported