mcpField
F
feishu-wiki

feishu-wiki

github.com/alextangsonProductivity6467 installsUpdated 31w ago
Repository

About feishu-wiki

feishu-wiki is a skill for managing Feishu knowledge spaces and page nodes through the Wiki v2 API. It covers space creation and lookup, plus creating, retrieving, and moving nodes associated with documents and other content types.

Key features

  1. 01Create and list knowledge spaces
  2. 02Retrieve space details
  3. 03Create Wiki page nodes
  4. 04Retrieve and move nodes
  5. 05Associate nodes with existing documents

Use cases

  1. 01Set up a Feishu knowledge space
  2. 02Create a Wiki page linked to a document
  3. 03Move pages between locations
  4. 04Inspect knowledge-space nodes

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/alextangson/feishu_skills --skill feishu-wiki

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

Details

From the project README

飞书知识库

通过 Wiki v2 API 管理知识空间和页面节点。

Base URL: https://open.feishu.cn/open-apis/wiki/v2

认证与 Token 获取

从 feishu_skills 根目录执行共享脚本:

TOKEN="$(./scripts/get_feishu_token.sh)"

请求头统一使用 Authorization: Bearer ${TOKEN}。

如果业务接口返回 token 无效、过期或 401,强制刷新后仅重试一次原请求:

TOKEN="$(./scripts/get_feishu_token.sh --force-refresh)"

环境变量:

  • FEISHU_APP_ID
  • FEISHU_APP_SECRET

本地缓存: ./.feishu_token_cache.json(未过期直接复用,默认提前 5 分钟刷新)


知识空间

API端点说明
创建空间POST /spaces{"name":"知识库名称"}
获取列表GET /spaces-
获取详情GET /spaces/{space_id}-

⚠️ 权限穿透:空间创建后机器人默认无权维护。建议:

  1. 创建包含机器人的群组
  2. 在知识库【设置】添加该群组为"管理员"
  3. 机器人通过群组身份获得操作权

页面节点

API端点说明
创建节点POST /spaces/{space_id}/nodes创建 Wiki 页面
获取节点GET /spaces/{space_id}/nodes/{node_token}-
移动节点POST /spaces/{space_id}/nodes/{node_token}/move-

创建节点:

{
  "obj_type": "docx",
  "parent_node_token": "root",
  "node_type": "origin",
  "origin_node_token": "doxcnXXX",
  "title": "页面标题"
}

obj_type: doc / sheet / mindnote / bitable / file / docx


最佳实践

  1. 群组授权法(解决权限问题)
  2. 先创建文档再关联(origin_node_token)
  3. 适合知识沉淀场景

Comments

Markdown supported