feishu-user-plugin
The feishu-user-plugin is a Feishu/Lark MCP server providing 85 tools across messaging, documents, and collaboration — with a unique ability to send messages as a real user (not just a bot) via cookie-based authentication. It supports three-layer auth (cookie, bot API credentials, OAuth UAT) and multi-profile management.
Messaging (as User or Bot)
Send text, rich-text (POST), images, and files as yourself (user identity) to individuals or groups
Batch-send to multiple targets; reply, forward, delete, edit, pin messages, and add/remove emoji reactions
Read group chat and P2P message history; auto-expand merge-forwarded messages
Contacts & Chat Management
Search users, bots, and group chats by name; look up user info by ID
Create/manage group chats, add/remove members, create P2P chats
Documents
Search, read (raw or Markdown), create, and edit Feishu docs and block structures
Upload/download images and files embedded in documents
Bitable (Multi-dimensional Tables)
Manage Bitable apps, tables, fields, views, and records (bulk ops up to 500 at a time)
Upload attachments to Bitable fields
Wiki (Knowledge Base)
List, search, create, rename, move, copy, and delete Wiki spaces and nodes
Resolve Wiki nodes to their underlying resource types
Drive (Cloud Storage)
List files, create folders, upload, copy, move, and delete files
Calendar
List calendars/events, create/update/delete events, respond to invitations, query free/busy times
Tasks
List, create, update, complete, and delete tasks; manage assignees and followers
OKR
List user OKRs and periods, get full OKR details, add/list/delete progress records
Real-time Events
Receive live Feishu events (e.g., new messages) via WebSocket with machine-level single-owner delivery across all MCP processes
Diagnostics & Multi-Account
Manage multiple identity profiles, check auth/session status, manage resource hints for auto-switching
feishu-user-plugin
中文 · English · Docs · CHANGELOG · npm
飞书 / Lark MCP 服务器,覆盖 IM、文档、多维表格、知识库、云空间、日历、任务 v2、OKR、实时事件。84 tools · 3 auth layers · 9 MCP prompts · MIT licensed · Node ≥18。
兼容 Claude Code、Codex、Cursor、Windsurf、VS Code、Claude Desktop、OpenClaw 等 MCP 客户端。
与其他飞书 MCP 的区别:基于 cookie + protobuf 协议路径,支持以用户本人身份发消息——飞书官方开放 API 没有 send_as_user 权限点,机器人 token 发出的消息一律标 sender_type: "app"。
三层鉴权
鉴权层 | 凭证 | 覆盖能力 | 工具数 |
用户身份(cookie + protobuf) |
| 以用户身份发文本 / 图片 / 文件 / 富文本 / @ / 批量 | 8 |
官方 API(机器人) |
| 群消息读写、文档、多维表格、知识库、云空间、日历、任务 v2、OKR、联系人、实时事件 WS | 70+ |
用户 OAuth UAT |
| P2P 私聊读取、用户 chat 列表;写入文档 / Bitable / 日历 资源时以用户为 owner | 2 显式 + 全工具 UAT-first |
三层独立 —— 配置任意一层,对应工具可用。
Related MCP server: lark-hermes-mcp
安装
npx feishu-user-plugin setup --app-id <APP_ID> --app-secret <APP_SECRET>
npx feishu-user-plugin oauth # 拿用户 OAuth UAT
# 重启 Claude Code / Codexcookie 获取:跟 Claude Code 说一句"帮我设置飞书 cookie"会自动经 Playwright 扫码登录抓取;手动方式在 feishu.cn DevTools Network 标签从请求头 Cookie 整行复制(不要用 document.cookie 或 Application > Cookies 标签—— HttpOnly 的 session / sl_session 拿不到)。
没有 APP_ID / SECRET 见下面 创建飞书应用。
用法
你:帮我以我身份给王小明发:今天的代码 review 我看完了,有 3 个 nit
Claude:[调用 send_to_user] Sent你:总结"工程组"群今天 9 点之后的讨论,发个日报到 #日报频道
Claude:[read_messages → 总结 → send_to_group] Sent创建飞书应用
LARK_APP_ID / LARK_APP_SECRET 是用 Official API(70+ 工具)的前置条件:
飞书开放平台 登录 → 创建自建应用(不能选商店应用 / 第三方应用,否则 P2P 读取会被锁)
添加应用能力 → 启用机器人
权限管理 → 添加 scope:
消息:
im:message、im:message:readonly、im:chat:readonly文档:
docx:document、bitable:record、wiki:wiki:readonly、drive:drive:readonly联系人:
contact:user.base:readonly按需:
okr:okr:readonly、calendar:calendar:readonly、task:task、drive:drive、docs:document.media:upload、wiki:wiki等
凭证与基础信息 → 复制 App ID(
cli_xxx)+ App Secret创建版本 → 提交审核 → 管理员审批
把 bot 加到要读消息的群里
工具索引(84 个)
完整工具列表 + 参数 + 跨域注意事项见 CLAUDE.md。
用户身份 —— 消息(cookie protobuf,8 个)
工具 | 说明 |
| 按名搜用户 + 发文本,一步完成 |
| 按名搜群 + 发文本,一步完成 |
| 按 chat ID 发文本,支持回复线程( |
| 以用户身份发图(v1.3.9) |
| 以用户身份发文件(需先 |
| 富文本:标题 + 段落 + @ + 超链 |
| 飞书交互卡片(机器人通道;cookie 通道服务端关闭,仅 bot 路径可用) |
| 一次发多条到不同 chat(text / image / file / post) |
用户身份 —— 联系人 / 信息(cookie,5 个)
工具 | 说明 |
| 搜用户 / bot / 群 |
| 创建或获取 P2P chat |
| 群详情(接受 |
| 用户名 / 头像查询 |
| 三层鉴权健康检查(实际跑一次 UAT 调用,不只看配置) |
用户 OAuth UAT —— P2P 读取(2 个)
工具 | 说明 |
| 读私聊历史(外部群自动 fallback) |
| 用户加入的所有群(仅群,不含 P2P;P2P 用 |
官方 API —— IM(15 个)
工具 | 说明 |
| 列 bot 加入的所有 chat |
| 读群消息(接受 chat 名 / |
| 机器人发消息 |
| 机器人回复 |
| 转发到其他 chat(自动识别 receive_id_type) |
| 撤回 / 删除 bot 消息 |
| 编辑已发消息(仅支持 text / interactive) |
| 表情回应 |
| 置顶 |
| 建群 / 改群 |
| 群成员 list / add / remove(注意 |
| 下载消息附件(image / file,> 2 MiB 必须 |
官方 API —— 文档(7 个)
工具 | 说明 |
| 关键词搜文档 |
| 结构化 JSON |
| v1.3.9 直接返回 markdown,~60% token 节省(适合 RAG / 总结) |
| 块树 |
| 创建文档(可选 |
| 块 create / update / delete(image_path / file_path / image_token / file_token 快捷) |
| 下载文档内嵌图片 |
官方 API —— 多维表格 Bitable(6 个,v1.3.7 整合)
工具 | actions | 说明 |
| create / copy / get_meta | 应用级(创建可指定 |
| list / create / update / delete | 数据表 CRUD |
| list / create / update / delete | 字段(update 必须传 |
| list / create / delete | 视图(grid / kanban / gallery / form / gantt / calendar) |
| search / get / create / update / delete | 记录 CRUD(数组:单条或最多 500) |
| — | 上传附件,返回 |
官方 API —— 知识库 Wiki(9 个)
工具 | 说明 |
| 列空间(UAT-first) |
| 搜知识库 |
| 列节点 |
| 节点 → obj_token 解析(接受 wiki node token 或 obj_token) |
| 创建节点(doc / sheet / bitable / mindnote / file / docx / slides) |
| 改名(内容编辑用 docx / bitable 工具) |
| 移动 |
| 深拷贝 |
| 删除 wiki 节点指针(底层 drive 资源用 |
官方 API —— 云空间 Drive(5 个)
工具 | 说明 |
| 列文件夹内文件 |
| 建文件夹 |
| copy / move / delete(必须传 |
| 上传图片 / 文件,返回 key |
| 上传到 Drive 文件夹(可选 |
官方 API —— OKR(6 个)
工具 | 说明 |
| 列指定用户的 OKR(必须传 user_id) |
| 批量取详情(objectives + key results + progress + alignments) |
| 列周期(季度 / 年度) |
| 添加进展记录(v1.3.7,需 |
| 列进展记录(从 |
| 删进展记录 |
官方 API —— 日历(8 个,写入 v1.3.7)
工具 | 说明 |
| 列日历(primary + 共享 + 订阅) |
| 列事件(指定时间窗) |
| 事件详情(参与人 / 地点 / 会议链接 / 附件) |
| 建事件(需 |
| 改事件 |
| 删事件(可选 |
| RSVP(accept / decline / tentative) |
| 多人 freebusy 查询 |
官方 API —— 任务 v2(7 个,v1.3.7 新域)
标识符是 task_guid(不是 v1 的 numeric task_id),需 task:task scope。
工具 | 说明 |
| 列当前用户任务 |
| 详情 |
| 建任务(summary 必填) |
| 改任务(必传 |
| 完成 / 取消完成 |
| 删 |
| add / remove 成员(assignee / follower) |
插件层 —— 诊断与多账号(4 个)
工具 | 说明 |
| 三层鉴权健康检查 |
| 列可用 profile(默认 + LARK_PROFILES_JSON / credentials.json) |
| 切 profile(缓存的 client 实例下次调用重建) |
| 查 / 改 / 清 自动切换缓存(list / set / clear) |
插件层 —— 实时事件(2 个,v1.3.9)
工具 | 说明 |
| 拉取增量事件(peek=true 不推进 cursor;filter by event_type / chat_id / since_seconds / profile) |
| info / reconnect / claim / rotate / reconfig(诊断 / 重连 / 抢锁 / 强制 events.jsonl 轮转 / 不重启重新订阅) |
9 个 MCP prompts(slash commands)
Prompt | 说明 |
| 以用户身份发消息 |
| 读最近消息然后回 |
| 群 / P2P 最近消息总结 |
| 搜联系人 / 群 |
| 搜 / 读 / 建文档 |
| 操作多维表格 |
| 搜知识库 |
| 列云空间 / 建文件夹 |
| 检查三层鉴权状态 |
客户端配置
环境变量配置一致,配置文件路径和顶层键不同。
统一 env 块:
{
"command": "npx",
"args": ["-y", "feishu-user-plugin"],
"env": {
"LARK_COOKIE": "your-cookie-string",
"LARK_APP_ID": "cli_xxxxxxxxxxxx",
"LARK_APP_SECRET": "your-app-secret",
"LARK_USER_ACCESS_TOKEN": "your-uat",
"LARK_USER_REFRESH_TOKEN": "your-refresh-token"
}
}安放位置:
客户端 | 配置文件 | 顶层键 |
Claude Code |
|
|
Claude Desktop |
|
|
Codex |
|
|
Cursor |
|
|
VS Code (Copilot) |
|
|
OpenClaw |
|
|
Windsurf |
|
|
自动化设置:
npx feishu-user-plugin setup # 默认写 Claude Code (~/.claude.json)
npx feishu-user-plugin setup --client codex # Codex (~/.codex/config.toml)
npx feishu-user-plugin setup --client both # Claude Code + Codex 都写
npx feishu-user-plugin setup --activate # 激活当前 profile各客户端完整 JSON 模板见 README.en.md MCP Client Configuration 段。
多账号(v1.3.8 / v1.3.9)
~/.feishu-user-plugin/credentials.json 支持多 profile(默认 + 任意附加),单台机器一处配置覆盖多个飞书账号 / 多个企业。
npx feishu-user-plugin list-profiles
npx feishu-user-plugin switch-profile <name>
npx feishu-user-plugin keepalive --all # 跨 profile keepalive读路径工具(read_* / list_* / get_* / search_* / download_*)失败码 91403 / 1254301 / 1254000 / 99991672 / HTTP 403 时自动跨 profile retry。写路径不自动切(避免错号创建资源)。
单调用覆盖:传 via_profile: "<name>" 钉到指定 profile,传 via_profile: "auto" 给写路径开自动切换。
详见 CLAUDE.md "Multi-profile auto-switch" 段。
实时事件(v1.3.9 机器级 SSOT)
机器上单进程持有 WS owner 锁(~/.feishu-user-plugin/ws-owner.lock,O_CREAT|O_EXCL,30s stale),所有 MCP 进程共享 ~/.feishu-user-plugin/events.jsonl(10 MB 软 / 20 MB 硬限自动轮转),events.cursor.json 是全机所有 harness 共享的 drain cursor —— 每条事件全机恰好一次。
mcp call manage_ws_status --action info # 谁在持锁、当前订阅、events.jsonl 大小
mcp call manage_ws_status --action claim --force true # 跨进程抢锁默认订阅 ["im.message.receive_v1"]。要订阅其他事件(审批 / 日历 / vc / etc),编辑 credentials.json::profiles[<active>].events,然后 manage_ws_status(action=reconfig) 不重启重新订阅。
仅支持 feishu.cn —— Lark 国际版(lark.com)的 WSClient 当前不支持。
工程细节
Token 生命周期
鉴权层 | Token | 有效期 | 续期 |
Cookie |
| 12h max-age | 4h 心跳自动刷新 |
App |
| 2h | SDK 自动管理 |
User OAuth |
| ~2h | refresh_token 自动刷新,写回 credentials.json |
Refresh Token | — | 7 天 |
|
crontab -e
# 0 */4 * * * npx feishu-user-plugin keepalive >> /tmp/feishu-keepalive.log 2>&1UAT 刷新失败 invalid_grant —— refresh token 过期 / 被撤销,重跑 npx feishu-user-plugin oauth 然后重启 Claude Code / Codex。
凭证存储(v1.3.7+)
单一可信源 ~/.feishu-user-plugin/credentials.json(mode 0600),多 harness 共享。schema 见 docs/CREDENTIALS-FORMAT.md。
npx feishu-user-plugin migrate # dry-run
npx feishu-user-plugin migrate --confirm # 真写自动 sync hooks
阶段 | 触发文件 | 作用 |
pre-commit |
| 同步到 |
pre-commit |
| 三角等价检查(version 必须一致) |
pre-commit |
| 工具个数 + README 84 tools 徽章必须一致 |
pre-commit |
| smoke test |
post-merge (main) | 任意 | 自动开 team-skills sync PR |
CI(.github/workflows/validate.yml)每个 PR 跑同样的 gate。
已知限制
Cookie 寿命:12-24 小时无心跳过期,需重新登录 feishu.cn 拿 cookie
协议变化:cookie + protobuf 层依赖飞书 web 客户端的协议,飞书更新可能失效(机器人能力不受影响)
卡片:cookie 通道发卡片服务端不可用,机器人通道可发
Lark 国际版:实时事件 WS 不支持
未实现:
search_messages(v1.3.10 计划)、md → wiki 同步(v1.3.10 主线)
完整 ROADMAP 见 ROADMAP.md。
贡献
Issues / PR 欢迎。提交前先看 CONTRIBUTING.md。
飞书改协议导致功能挂掉 —— 开 issue 带错误日志即可。
License
致谢
cv-cat/LarkAgentX —— 早期飞书 web 协议研究(Python)
cv-cat/OpenFeiShuApis —— 底层 API 研究
Model Context Protocol —— MCP 标准 + Anthropic / PulseMCP / GitHub / Stacklok 共维 registry
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceA tool designed to help users connect AI Agents with the Feishu/Lark platform, encapsulating Feishu/Lark Open Platform API interfaces as MCP tools for document processing, conversation management, calendar scheduling and more.7,855
- AlicenseBqualityFmaintenanceAn MCP server that exposes Feishu/Lark capabilities as function tools to MCP-compatible agents like Hermes and Claude Desktop. It provides 57 tools for messaging, document management, calendar operations, and task management through both hand-written fallback tools and bridged OpenClaw SDK functionality.531MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that pushes Feishu (Lark) messages to Claude Code sessions and allows Claude to reply directly in Feishu.2MIT
- AlicenseNot gradedqualityBmaintenanceMCP server for Feishu/Lark API integration, enabling AI agents to send messages, manage groups, create and edit documents and spreadsheets, and search knowledge bases.MIT
Related MCP Connectors
Real-time chat hub for AI agents — Claude Code, Cursor, Cline, Codex over MCP or REST.
Brazilian Open Finance MCP — 30+ banks (Itaú, Nubank, etc.) to Claude/Cursor. Read-only.
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/EthanQC/feishu-user-plugin'
If you have feedback or need assistance with the MCP directory API, please join our Discord server