@dasaying/feishu-doc-mcp
v1.1.1
Published
飞书云文档 MCP 服务器 - 支持 Markdown 文档上传、读取和批量操作。Feishu (Lark) Document MCP Server - Support Markdown upload, read and batch operations.
Downloads
318
Maintainers
Readme
@dasaying/feishu-doc-mcp
飞书云文档 MCP 服务器 - 支持 Markdown 文档上传、读取和批量操作
中文
简介
feishu-doc-mcp 是一个功能完整的 Model Context Protocol (MCP) 服务器,专门用于飞书(Lark)云文档集成。它提供了强大的 Markdown 文档上传、读取和批量操作功能,让你可以轻松地在 AI 工作流中管理飞书文档。
核心功能
📤 文档上传
- ✅ 单个 Markdown 文档上传
- ✅ 批量文档上传(支持并发控制)
- ✅ 自动转换 Markdown 为飞书格式
- ✅ 自动上传本地图片和附件
- ✅ Front Matter 处理
- ✅ 支持云空间和知识库
📥 文档读取
- ✅ 读取单个文档并转换为 Markdown
- ✅ 批量读取多个文档
- ✅ 递归读取整个知识库
- ✅ 自动下载图片和附件
- ✅ 保持文档结构和格式
🔐 认证管理
- ✅ 完整的 OAuth 2.0 流程
- ✅ 自动 token 刷新
- ✅ 多应用支持
- ✅ 安全的凭证存储
📁 资源管理
- ✅ 列出云空间文件夹
- ✅ 列出知识库空间
- ✅ 浏览知识库节点
- ✅ 获取用户信息
快速开始
使用 npx(推荐)
无需安装,直接使用:
{
"mcpServers": {
"@dasaying/feishu-doc-mcp": {
"command": "npx",
"args": ["-y", "@dasaying/feishu-doc-mcp"],
"env": {
"FEISHU_DEFAULT_APP_ID": "your_app_id",
"FEISHU_DEFAULT_APP_SECRET": "your_app_secret",
"FEISHU_OAUTH_CALLBACK_URL": "http://localhost:3010/oauth/feishu/callback"
}
}
}
}全局安装
npm install -g @dasaying/feishu-doc-mcp配置 MCP 客户端:
{
"mcpServers": {
"@dasaying/feishu-doc-mcp": {
"command": "@dasaying/feishu-doc-mcp",
"args": [],
"env": {
"FEISHU_DEFAULT_APP_ID": "your_app_id",
"FEISHU_DEFAULT_APP_SECRET": "your_app_secret",
"FEISHU_OAUTH_CALLBACK_URL": "http://localhost:3010/oauth/feishu/callback"
}
}
}
}配置说明
必需环境变量
| 变量 | 说明 | 示例 |
|------|------|------|
| FEISHU_DEFAULT_APP_ID | 飞书应用 ID | cli_a9e211f948381bdf |
| FEISHU_DEFAULT_APP_SECRET | 飞书应用密钥 | your_app_secret |
| FEISHU_OAUTH_CALLBACK_URL | OAuth 回调地址 | http://localhost:3010/oauth/feishu/callback |
可选环境变量
| 变量 | 说明 | 默认值 |
|------|------|--------|
| MCP_LOG_LEVEL | 日志级别 | debug |
| STORAGE_PROVIDER_TYPE | 存储类型 | filesystem |
| STORAGE_FILESYSTEM_PATH | 存储路径 | ~/.feishu-doc-mcp/storage |
可用工具
认证相关
feishu_auth_url- 生成授权 URLfeishu_auth_callback- 处理授权回调feishu_get_user_info- 获取用户信息feishu_list_apps- 列出已配置的应用feishu_set_default_app- 设置默认应用
文档上传
feishu_upload_markdown- 上传单个 Markdown 文档feishu_batch_upload_markdown- 批量上传文档feishu_update_document- 更新已存在的文档
文档读取
feishu_read_document- 读取单个文档feishu_batch_read_documents- 批量读取文档feishu_read_wiki_recursive- 递归读取知识库
资源浏览
feishu_list_folders- 列出云空间文件夹feishu_list_wikis- 列出知识库空间feishu_list_wiki_nodes- 列出知识库节点
使用示例
1. 授权飞书账号
// 生成授权 URL
const { authUrl } = await mcp.call('feishu_auth_url');
// 在浏览器中打开 authUrl 完成授权2. 上传 Markdown 文档
// 上传到知识库
await mcp.call('feishu_upload_markdown', {
filePath: './docs/README.md',
targetType: 'wiki',
targetId: 'wiki_space_id',
uploadImages: true,
uploadAttachments: true
});3. 读取文档
// 读取文档并保存为 Markdown
await mcp.call('feishu_read_document', {
documentId: 'doc_id',
documentType: 'wiki',
wikiSpaceId: 'space_id',
outputPath: './output/document.md',
downloadImages: true
});4. 批量操作
// 批量上传
await mcp.call('feishu_batch_upload_markdown', {
documents: [
{ filePath: './doc1.md', targetType: 'wiki', targetId: 'space_id' },
{ filePath: './doc2.md', targetType: 'wiki', targetId: 'space_id' }
],
concurrency: 3
});
// 递归读取知识库
await mcp.call('feishu_read_wiki_recursive', {
wikiSpaceId: 'space_id',
outputPath: './output',
downloadImages: true,
preserveStructure: true
});飞书应用配置
- 访问 飞书开放平台
- 创建企业自建应用
- 配置应用权限:
drive:drive- 云空间操作wiki:wiki- 知识库操作contact:user.base- 用户信息
- 配置 OAuth 回调地址:
http://localhost:3010/oauth/feishu/callback - 获取 App ID 和 App Secret
开发
# 克隆仓库
git clone https://github.com/yourusername/feishu-doc-mcp.git
cd feishu-doc-mcp
# 安装依赖
npm install
# 构建
npm run build
# 本地测试
npm link
feishu-doc-mcp技术栈
- TypeScript - 类型安全
- MCP SDK - Model Context Protocol
- Hono - 轻量级 Web 框架
- tsyringe - 依赖注入
- Zod - 运行时验证
- Pino - 结构化日志
许可证
Apache-2.0
English
Introduction
feishu-doc-mcp is a full-featured Model Context Protocol (MCP) server specifically designed for Feishu (Lark) document integration. It provides powerful Markdown document upload, read, and batch operation capabilities, making it easy to manage Feishu documents in AI workflows.
Core Features
📤 Document Upload
- ✅ Single Markdown document upload
- ✅ Batch document upload (with concurrency control)
- ✅ Automatic Markdown to Feishu format conversion
- ✅ Automatic local image and attachment upload
- ✅ Front Matter processing
- ✅ Support for Drive and Wiki
📥 Document Read
- ✅ Read single document and convert to Markdown
- ✅ Batch read multiple documents
- ✅ Recursively read entire wiki space
- ✅ Automatic image and attachment download
- ✅ Preserve document structure and formatting
🔐 Authentication
- ✅ Complete OAuth 2.0 flow
- ✅ Automatic token refresh
- ✅ Multi-app support
- ✅ Secure credential storage
📁 Resource Management
- ✅ List Drive folders
- ✅ List Wiki spaces
- ✅ Browse Wiki nodes
- ✅ Get user information
Quick Start
Using npx (Recommended)
No installation required:
{
"mcpServers": {
"@dasaying/feishu-doc-mcp": {
"command": "npx",
"args": ["-y", "@dasaying/feishu-doc-mcp"],
"env": {
"FEISHU_DEFAULT_APP_ID": "your_app_id",
"FEISHU_DEFAULT_APP_SECRET": "your_app_secret",
"FEISHU_OAUTH_CALLBACK_URL": "http://localhost:3010/oauth/feishu/callback"
}
}
}
}Global Installation
npm install -g @dasaying/feishu-doc-mcpConfigure MCP client:
{
"mcpServers": {
"@dasaying/feishu-doc-mcp": {
"command": "@dasaying/feishu-doc-mcp",
"args": [],
"env": {
"FEISHU_DEFAULT_APP_ID": "your_app_id",
"FEISHU_DEFAULT_APP_SECRET": "your_app_secret",
"FEISHU_OAUTH_CALLBACK_URL": "http://localhost:3010/oauth/feishu/callback"
}
}
}
}Available Tools
See Chinese section above for detailed tool list.
License
Apache-2.0
