feishu-mcp 0.0.8 → 0.0.9-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 cso1z
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 cso1z
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md ADDED
@@ -0,0 +1,201 @@
1
+ # Feishu MCP Server
2
+
3
+ Provides access to Feishu (Lark) documents for [Cursor](https://cursor.sh/), [Windsurf](https://codeium.com/windsurf), [Cline](https://cline.bot/), and other AI-driven coding tools, implemented based on the [Model Context Protocol](https://modelcontextprotocol.io/introduction) server.
4
+
5
+ When Cursor can access Feishu document data, it can understand and process document content more accurately, making it more efficient than other methods (such as copying and pasting text).
6
+
7
+ ## Core Features
8
+
9
+ ### Document Management
10
+ - **Create Feishu Documents**: Support for creating new Feishu documents in specified folders
11
+ - **Folder Management**:
12
+ - Get root folder information
13
+ - View folder contents and file lists
14
+ - Create new folders
15
+
16
+ ### Document Content Operations
17
+ - **Get Document Information**:
18
+ - Get basic document information (title, version, etc.)
19
+ - Get document block structure and hierarchy
20
+ - Get detailed content of specific blocks
21
+ - **Get Document Plain Text Content**: Support for extracting complete plain text content from documents for analysis and processing
22
+ - **Edit Document Content**:
23
+ - **Text Block Operations**:
24
+ - Create and update text blocks with rich styles (bold, italic, underline, strikethrough, inline code)
25
+ - Support for text color settings (gray, brown, orange, yellow, green, blue, purple)
26
+ - Support for text alignment adjustment (left-aligned, centered, right-aligned)
27
+ - **Heading Block Operations**: Create headings from level one to level nine
28
+ - **Code Block Operations**:
29
+ - Create code blocks for multiple programming languages
30
+ - Support for code syntax highlighting
31
+ - Support for automatic line wrapping settings
32
+ - **List Operations**:
33
+ - Create ordered lists (numbered lists)
34
+ - Create unordered lists (bullet point lists)
35
+ - **Block Management Operations**:
36
+ - Batch content creation: Support for creating multiple different types of content blocks in a single operation
37
+ - Delete document blocks: Support for deleting one or more consecutive document blocks
38
+ - **Wiki Document Support**:
39
+ - Convert Feishu Wiki links to compatible document IDs for use with other document operation tools
40
+ - **Image Resource Processing**:
41
+ - Download images from Feishu using media IDs
42
+
43
+ ### Planned Features
44
+ - **Advanced Content Insertion**:
45
+ - Table insertion: Support for row and column structured data
46
+ - Insert charts: Support for various data visualization charts
47
+ - Insert flowcharts: Support for flowcharts and mind maps
48
+ - Insert formulas: Support for mathematical formulas and scientific symbols
49
+ - Recognition and parsing of charts and flowcharts
50
+
51
+ Quick start, see the [Configuration](#configuration) section for details:
52
+
53
+ ```bash
54
+ npx feishu-mcp --feishu-app-id=<YOUR_FEISHU_APP_ID> --feishu-app-secret=<YOUR_FEISHU_APP_SECRET>
55
+ ```
56
+
57
+ ## How It Works
58
+
59
+ 1. Open the editor in Cursor's Agent mode.
60
+ 2. Paste a Feishu document link.
61
+ 3. Ask Cursor to perform operations based on the Feishu document—for example, analyze document content or create related code.
62
+ 4. Cursor will retrieve relevant metadata from Feishu and use it to assist in writing code.
63
+
64
+ This MCP server is designed specifically for Cursor. Before responding with content from the [Feishu API](https://open.feishu.cn/document/home/introduction-to-lark-open-platform/overview), it simplifies and transforms the responses, ensuring that only the most relevant document information is provided to the model.
65
+
66
+ ## Installation
67
+
68
+ ### Quickly Run the Server Using NPM
69
+
70
+ You can quickly run the server using NPM without installing or building the repository:
71
+
72
+ ```bash
73
+ npx feishu-mcp --feishu-app-id=<YOUR_FEISHU_APP_ID> --feishu-app-secret=<YOUR_FEISHU_APP_SECRET>
74
+
75
+ # or
76
+ pnpx feishu-mcp --feishu-app-id=<YOUR_FEISHU_APP_ID> --feishu-app-secret=<YOUR_FEISHU_APP_SECRET>
77
+
78
+ # or
79
+ yarn dlx feishu-mcp --feishu-app-id=<YOUR_FEISHU_APP_ID> --feishu-app-secret=<YOUR_FEISHU_APP_SECRET>
80
+
81
+ # or
82
+ bunx feishu-mcp --feishu-app-id=<YOUR_FEISHU_APP_ID> --feishu-app-secret=<YOUR_FEISHU_APP_SECRET>
83
+ ```
84
+
85
+ **Published to the Smithery platform, available at: https://smithery.ai/server/@cso1z/feishu-mcp**
86
+
87
+ Instructions on how to create a Feishu application and obtain application credentials can be found in the [official tutorial](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app).
88
+
89
+ **Detailed Feishu application configuration steps**: For detailed guidance on registering a Feishu application, configuring permissions, and adding document access permissions, please refer to [Step-by-step tutorial FEISHU_CONFIG.md](FEISHU_CONFIG.md).
90
+
91
+ ### JSON Configuration for Tools Using Configuration Files
92
+
93
+ Many tools such as Windsurf, Cline, and [Claude Desktop](https://claude.ai/download) use configuration files to start servers.
94
+
95
+ The `feishu-mcp` server can be configured by adding the following to the configuration file:
96
+
97
+ ```json
98
+ {
99
+ "mcpServers": {
100
+ "feishu-mcp": {
101
+ "command": "npx",
102
+ "args": ["-y", "feishu-mcp", "--stdio"],
103
+ "env": {
104
+ "FEISHU_APP_ID": "<YOUR_FEISHU_APP_ID>",
105
+ "FEISHU_APP_SECRET": "<YOUR_FEISHU_APP_SECRET>"
106
+ }
107
+ }
108
+ }
109
+ }
110
+ ```
111
+
112
+ ### Run the Server from Local Source Code
113
+
114
+ 1. Clone the repository
115
+ 2. Install dependencies using `pnpm install`
116
+ 3. Copy `.env.example` to `.env` and fill in your [Feishu application credentials](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app).
117
+ 4. Run the server using `pnpm run dev`, with any flags from the [Command Line Arguments](#command-line-arguments) section.
118
+
119
+ ### Run the Server Using Docker
120
+
121
+ You can use Docker to run the server, which avoids installing Node.js and other dependencies locally:
122
+
123
+ 1. Build the Docker image:
124
+ ```bash
125
+ docker build -t feishu-mcp .
126
+ ```
127
+
128
+ 2. Run the Docker container:
129
+ ```bash
130
+ docker run -p 3333:3333 --env FEISHU_APP_ID=<YOUR_FEISHU_APP_ID> --env FEISHU_APP_SECRET=<YOUR_FEISHU_APP_SECRET> feishu-mcp
131
+ ```
132
+
133
+ Alternatively, you can use docker-compose:
134
+
135
+ 1. Edit the `.env` file and add your Feishu application credentials:
136
+ ```
137
+ FEISHU_APP_ID=<YOUR_FEISHU_APP_ID>
138
+ FEISHU_APP_SECRET=<YOUR_FEISHU_APP_SECRET>
139
+ ```
140
+
141
+ 2. Run docker-compose:
142
+ ```bash
143
+ docker-compose up -d
144
+ ```
145
+
146
+ This will start the server in the background and expose it on port 3333.
147
+
148
+ ## Configuration
149
+
150
+ The server can be configured using environment variables (via the `.env` file) or command line arguments. Command line arguments take precedence over environment variables.
151
+
152
+ ### Environment Variables
153
+
154
+ - `FEISHU_APP_ID`: Your [Feishu application ID](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app) (required)
155
+ - `FEISHU_APP_SECRET`: Your [Feishu application secret](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app) (required)
156
+ - `PORT`: The port to run the server on (default: 3333)
157
+
158
+ ### Command Line Arguments
159
+
160
+ - `--version`: Show version number
161
+ - `--feishu-app-id`: Your Feishu application ID
162
+ - `--feishu-app-secret`: Your Feishu application secret
163
+ - `--port`: The port to run the server on
164
+ - `--stdio`: Run the server in command mode instead of the default HTTP/SSE
165
+ - `--help`: Show help menu
166
+
167
+ ## Connecting to Cursor
168
+
169
+ ### Configuring Cursor
170
+
171
+ 1. Open Cursor settings
172
+ 2. Navigate to `Settings > AI > MCP Servers`
173
+ 3. Add a new server with the URL `http://localhost:3333` (or your configured port)
174
+ 4. Click "Verify Connection" to ensure the connection is successful
175
+
176
+ ## Usage
177
+
178
+ 1. In Cursor, open the AI panel (default shortcut `Cmd+K` or `Ctrl+K`)
179
+ 2. If you need to create a new Feishu document, you should explicitly specify a folderToken, which you can find by opening a Feishu document directory like: `https://vq5xxxxx7bc.feishu.cn/drive/folder/FPKvfjdxxxxx706RnOc`
180
+ 3. If you need to modify Feishu document content, you should explicitly provide the Feishu document link, for example: `https://vq5ixxxx7bc.feishu.cn/docx/J6T0d6exxxxxxxDdc1zqwnph`
181
+ 4. Ask questions about the document or request operations based on the document content
182
+ 5. Creating and editing documents requires permissions, and you can test your account on the Feishu open platform: `https://open.feishu.cn/api-explorer/cli_a75a8ca0ac79100c?apiName=tenant_access_token_internal&from=op_doc&project=auth&resource=auth&version=v3`
183
+
184
+ ## Document Permissions and Troubleshooting
185
+
186
+ ### Permission Types
187
+ Permissions are divided into two types: robot permissions and document access permissions.
188
+
189
+ ### Permission Verification and Troubleshooting
190
+ 1. Get token: [https://open.feishu.cn/api-explorer/cli_a7582508c93ad00d?apiName=tenant_access_token_internal&project=auth&resource=auth&version=v3](https://open.feishu.cn/api-explorer/cli_a7582508c93ad00d?apiName=tenant_access_token_internal&project=auth&resource=auth&version=v3)
191
+ 2. Using the token obtained in step 1, verify whether you have permission to access the document: [https://open.feishu.cn/api-explorer/cli_a7582508c93ad00d?apiName=get&project=docx&resource=document&version=v1](https://open.feishu.cn/api-explorer/cli_a7582508c93ad00d?apiName=get&project=docx&resource=document&version=v1)
192
+
193
+ ### Troubleshooting Method
194
+ Test permissions normally on the Feishu development platform (when debugging on the open platform, there will be sufficient prompt information and guidance in case of failure).
195
+
196
+ ### Document Authorization
197
+ If you encounter permission issues, please refer to [Cloud Document FAQ](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN), [Knowledge Base FAQ](https://open.feishu.cn/document/server-docs/docs/wiki-v2/wiki-qa), especially focusing on how to grant document permissions to applications or users.
198
+
199
+ ## License
200
+
201
+ MIT
package/README.md CHANGED
@@ -1,160 +1,164 @@
1
- # 飞书 MCP 服务器
2
-
3
- 为 [Cursor](https://cursor.sh/)、[Windsurf](https://codeium.com/windsurf)、[Cline](https://cline.bot/) 和其他 AI 驱动的编码工具提供访问飞书文档的能力,基于 [Model Context Protocol](https://modelcontextprotocol.io/introduction) 服务器实现。
4
-
5
- 当 Cursor 能够访问飞书文档数据时,它可以更准确地理解和处理文档内容,比其他方法(如复制粘贴文本)更加高效。
6
-
7
- ## 核心功能
8
-
9
- ### 文档管理
10
- - **创建飞书文档**:支持在指定文件夹中创建新的飞书文档
11
-
12
- ### 文档内容操作
13
- - **获取文档信息**:
14
- - 获取文档基本信息(标题、版本等)
15
- - 获取文档区块结构和层级
16
- - 获取特定区块的详细内容
17
- - **获取文档纯文本内容**:支持提取文档的完整纯文本内容,便于分析和处理
18
- - **编辑文档内容**:
19
- - **文本块操作**:
20
- - 创建和更新带有丰富样式的文本块(粗体、斜体、下划线、删除线、行内代码)
21
- - 支持文本颜色设置(灰色、棕色、橙色、黄色、绿色、蓝色、紫色)
22
- - 支持文本对齐方式调整(左对齐、居中、右对齐)
23
- - **标题块操作**:创建从一级到九级的不同级别标题
24
- - **代码块操作**:
25
- - 创建多种编程语言的代码块
26
- - 支持代码语法高亮
27
- - 支持自动换行设置
28
- - **列表操作**:
29
- - 创建有序列表(编号列表)
30
- - 创建无序列表(项目符号列表)
31
- - **批量内容创建**:支持在单次操作中创建多个不同类型的内容块
32
-
33
- ### 计划中的功能
34
- - **高级内容插入**:
35
- - 表格插入:支持行列结构化数据
36
- - 插入图表:支持各类数据可视化图表
37
- - 插入流程图:支持流程图和思维导图
38
- - 插入公式:支持数学公式和科学符号
39
- - 图表、流程图的内容识别和解析
40
-
41
- 快速开始,详见[配置](#配置)部分:
42
-
43
- ```bash
44
- npx feishu-mcp --feishu-app-id=<你的飞书应用ID> --feishu-app-secret=<你的飞书应用密钥>
45
- ```
46
-
47
- ## 工作原理
48
-
49
- 1. 在 Cursor 的 Agent 模式下打开编辑器。
50
- 2. 粘贴飞书文档的链接。
51
- 3. 要求 Cursor 基于飞书文档执行操作——例如,分析文档内容或创建相关代码。
52
- 4. Cursor 将从飞书获取相关元数据并使用它来辅助编写代码。
53
-
54
- 这个 MCP 服务器专为 Cursor 设计。在响应来自[飞书 API](https://open.feishu.cn/document/home/introduction-to-lark-open-platform/overview) 的内容之前,它会简化和转换响应,确保只向模型提供最相关的文档信息。
55
- ## 安装
56
-
57
- ### 使用 NPM 快速运行服务器
58
-
59
- 你可以使用 NPM 快速运行服务器,无需安装或构建仓库:
60
-
61
- ```bash
62
- npx feishu-mcp --feishu-app-id=<你的飞书应用ID> --feishu-app-secret=<你的飞书应用密钥>
63
-
64
- # 或
65
- pnpx feishu-mcp --feishu-app-id=<你的飞书应用ID> --feishu-app-secret=<你的飞书应用密钥>
66
-
67
- # 或
68
- yarn dlx feishu-mcp --feishu-app-id=<你的飞书应用ID> --feishu-app-secret=<你的飞书应用密钥>
69
-
70
- # 或
71
- bunx feishu-mcp --feishu-app-id=<你的飞书应用ID> --feishu-app-secret=<你的飞书应用密钥>
72
- ```
73
-
74
- **已发布到smithery平台,可访问:https://smithery.ai/server/@cso1z/feishu-mcp**
75
-
76
-
77
- 关于如何创建飞书应用和获取应用凭证的说明可以在[这里](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app)找到。
78
-
79
- ### 使用配置文件的工具的 JSON 配置
80
-
81
- 许多工具如 Windsurf、Cline 和 [Claude Desktop](https://claude.ai/download) 使用配置文件来启动服务器。
82
-
83
- `feishu-mcp` 服务器可以通过在配置文件中添加以下内容来配置:
84
-
85
- ```json
86
- {
87
- "mcpServers": {
88
- "feishu-mcp": {
89
- "command": "npx",
90
- "args": ["-y", "feishu-mcp", "--stdio"],
91
- "env": {
92
- "FEISHU_APP_ID": "<你的飞书应用ID>",
93
- "FEISHU_APP_SECRET": "<你的飞书应用密钥>"
94
- }
95
- }
96
- }
97
- }
98
- ```
99
-
100
- ### 从本地源代码运行服务器
101
-
102
- 1. 克隆仓库
103
- 2. 使用 `pnpm install` 安装依赖
104
- 3. 复制 `.env.example` 到 `.env` 并填入你的[飞书应用凭证](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app)。
105
- 4. 使用 `pnpm run dev` 运行服务器,可以使用[命令行参数](#命令行参数)部分的任何标志。
106
-
107
- ## 配置
108
-
109
- 服务器可以使用环境变量(通过 `.env` 文件)或命令行参数进行配置。命令行参数优先于环境变量。
110
-
111
- ### 环境变量
112
-
113
- - `FEISHU_APP_ID`:你的[飞书应用 ID](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app)(必需)
114
- - `FEISHU_APP_SECRET`:你的[飞书应用密钥](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app)(必需)
115
- - `PORT`:运行服务器的端口(默认:3333)
116
-
117
- ### 命令行参数
118
-
119
- - `--version`:显示版本号
120
- - `--feishu-app-id`:你的飞书应用 ID
121
- - `--feishu-app-secret`:你的飞书应用密钥
122
- - `--port`:运行服务器的端口
123
- - `--stdio`:在命令模式下运行服务器,而不是默认的 HTTP/SSE
124
- - `--help`:显示帮助菜单
125
-
126
- ## 连接到 Cursor
127
-
128
- ### 配置 Cursor
129
-
130
- 1. 打开 Cursor 设置
131
- 2. 导航到 `Settings > AI > MCP Servers`
132
- 3. 添加新服务器,URL 为 `http://localhost:3333`(或你配置的端口)
133
- 4. 点击 "Verify Connection" 确保连接成功
134
-
135
- ## 使用方法
136
-
137
- 1. Cursor 中,打开 AI 面板(默认快捷键 `Cmd+K` 或 `Ctrl+K`)
138
- 2. 如果需要新建一个飞书文档编辑信息,应该明确制定一个folderToken,可以打开一个飞书文档目录如:`https://vq5xxxxx7bc.feishu.cn/drive/folder/FPKvfjdxxxxx706RnOc查找`
139
- 2. 如果需要修改飞书文档内容应该明确告知飞书文档链接,例如:`https://vq5ixxxx7bc.feishu.cn/docx/J6T0d6exxxxxxxDdc1zqwnph`
140
- 3. 询问关于文档的问题或请求基于文档内容执行操作
141
- 4. 创建编辑文档都需要权限,可以到飞书开放平台对账号进行测试`https://open.feishu.cn/api-explorer/cli_a75a8ca0ac79100c?apiName=tenant_access_token_internal&from=op_doc&project=auth&resource=auth&version=v3`
142
-
143
- ## 文档权限与故障排查
144
-
145
- ### 权限类型
146
- 权限分为两种:机器人权限、文档访问权限
147
-
148
- ### 权限验证与排查
149
- 1. 获取token:[https://open.feishu.cn/api-explorer/cli_a7582508c93ad00d?apiName=tenant_access_token_internal&project=auth&resource=auth&version=v3](https://open.feishu.cn/api-explorer/cli_a7582508c93ad00d?apiName=tenant_access_token_internal&project=auth&resource=auth&version=v3)
150
- 2. 使用第1步获取的token,验证是否有权限访问该文档:[https://open.feishu.cn/api-explorer/cli_a7582508c93ad00d?apiName=get&project=docx&resource=document&version=v1](https://open.feishu.cn/api-explorer/cli_a7582508c93ad00d?apiName=get&project=docx&resource=document&version=v1)
151
-
152
- ### 排查方法
153
- 在飞书开发平台测试权限正常(在开放平台调试,失败时会有充足提示信息和指导)
154
-
155
- ### 文档授权
156
- 如遇到权限问题,请参考[云文档常见问题](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)、[知识库常见问题](https://open.feishu.cn/document/server-docs/docs/wiki-v2/wiki-qa),特别关注如何为应用或用户开通文档权限。
157
-
158
- ## 许可证
159
-
160
- MIT
1
+ # 飞书 MCP 服务器
2
+
3
+ 为 [Cursor](https://cursor.sh/)、[Windsurf](https://codeium.com/windsurf)、[Cline](https://cline.bot/) 和其他 AI 驱动的编码工具提供访问飞书文档的能力,基于 [Model Context Protocol](https://modelcontextprotocol.io/introduction) 服务器实现。
4
+
5
+ 当 Cursor 能够访问飞书文档数据时,它可以更准确地理解和处理文档内容,比其他方法(如复制粘贴文本)更加高效。
6
+
7
+ ## 核心功能
8
+
9
+ ### 文档管理
10
+ - **创建飞书文档**:支持在指定文件夹中创建新的飞书文档
11
+
12
+ ### 文档内容操作
13
+ - **获取文档信息**:
14
+ - 获取文档基本信息(标题、版本等)
15
+ - 获取文档区块结构和层级
16
+ - 获取特定区块的详细内容
17
+ - **获取文档纯文本内容**:支持提取文档的完整纯文本内容,便于分析和处理
18
+ - **编辑文档内容**:
19
+ - **文本块操作**:
20
+ - 创建和更新带有丰富样式的文本块(粗体、斜体、下划线、删除线、行内代码)
21
+ - 支持文本颜色设置(灰色、棕色、橙色、黄色、绿色、蓝色、紫色)
22
+ - 支持文本对齐方式调整(左对齐、居中、右对齐)
23
+ - **标题块操作**:创建从一级到九级的不同级别标题
24
+ - **代码块操作**:
25
+ - 创建多种编程语言的代码块
26
+ - 支持代码语法高亮
27
+ - 支持自动换行设置
28
+ - **列表操作**:
29
+ - 创建有序列表(编号列表)
30
+ - 创建无序列表(项目符号列表)
31
+ - **批量内容创建**:支持在单次操作中创建多个不同类型的内容块
32
+
33
+ ### 计划中的功能
34
+ - **高级内容插入**:
35
+ - 表格插入:支持行列结构化数据
36
+ - 插入图表:支持各类数据可视化图表
37
+ - 插入流程图:支持流程图和思维导图
38
+ - 插入公式:支持数学公式和科学符号
39
+ - 图表、流程图的内容识别和解析
40
+
41
+ 快速开始,详见[配置](#配置)部分:
42
+
43
+ ```bash
44
+ npx feishu-mcp --feishu-app-id=<你的飞书应用ID> --feishu-app-secret=<你的飞书应用密钥>
45
+ ```
46
+
47
+ ## 工作原理
48
+
49
+ 1. 在 Cursor 的 Agent 模式下打开编辑器。
50
+ 2. 粘贴飞书文档的链接。
51
+ 3. 要求 Cursor 基于飞书文档执行操作——例如,分析文档内容或创建相关代码。
52
+ 4. Cursor 将从飞书获取相关元数据并使用它来辅助编写代码。
53
+
54
+ 这个 MCP 服务器专为 Cursor 设计。在响应来自[飞书 API](https://open.feishu.cn/document/home/introduction-to-lark-open-platform/overview) 的内容之前,它会简化和转换响应,确保只向模型提供最相关的文档信息。
55
+ ## 安装
56
+
57
+ ### 使用 NPM 快速运行服务器
58
+
59
+ 你可以使用 NPM 快速运行服务器,无需安装或构建仓库:
60
+
61
+ ```bash
62
+ npx feishu-mcp --feishu-app-id=<你的飞书应用ID> --feishu-app-secret=<你的飞书应用密钥>
63
+
64
+ # 或
65
+ pnpx feishu-mcp --feishu-app-id=<你的飞书应用ID> --feishu-app-secret=<你的飞书应用密钥>
66
+
67
+ # 或
68
+ yarn dlx feishu-mcp --feishu-app-id=<你的飞书应用ID> --feishu-app-secret=<你的飞书应用密钥>
69
+
70
+ # 或
71
+ bunx feishu-mcp --feishu-app-id=<你的飞书应用ID> --feishu-app-secret=<你的飞书应用密钥>
72
+ ```
73
+
74
+ **已发布到smithery平台,可访问:https://smithery.ai/server/@cso1z/feishu-mcp**
75
+
76
+
77
+ 关于如何创建飞书应用和获取应用凭证的说明可以在[官方教程](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app)找到。
78
+
79
+
80
+ **详细的飞书应用配置步骤**:有关注册飞书应用、配置权限、添加文档访问权限的详细指南,请参阅 [手把手教程 FEISHU_CONFIG.md](FEISHU_CONFIG.md)。
81
+
82
+
83
+ ### 使用配置文件的工具的 JSON 配置
84
+
85
+ 许多工具如 Windsurf、Cline 和 [Claude Desktop](https://claude.ai/download) 使用配置文件来启动服务器。
86
+
87
+ `feishu-mcp` 服务器可以通过在配置文件中添加以下内容来配置:
88
+
89
+ ```json
90
+ {
91
+ "mcpServers": {
92
+ "feishu-mcp": {
93
+ "command": "npx",
94
+ "args": ["-y", "feishu-mcp", "--stdio"],
95
+ "env": {
96
+ "FEISHU_APP_ID": "<你的飞书应用ID>",
97
+ "FEISHU_APP_SECRET": "<你的飞书应用密钥>"
98
+ }
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ ### 从本地源代码运行服务器
105
+
106
+ 1. 克隆仓库
107
+ 2. 使用 `pnpm install` 安装依赖
108
+ 3. 复制 `.env.example` 到 `.env` 并填入你的[飞书应用凭证](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app)。
109
+ 4. 使用 `pnpm run dev` 运行服务器,可以使用[命令行参数](#命令行参数)部分的任何标志。
110
+
111
+ ## 配置
112
+
113
+ 服务器可以使用环境变量(通过 `.env` 文件)或命令行参数进行配置。命令行参数优先于环境变量。
114
+
115
+ ### 环境变量
116
+
117
+ - `FEISHU_APP_ID`:你的[飞书应用 ID](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app)(必需)
118
+ - `FEISHU_APP_SECRET`:你的[飞书应用密钥](https://open.feishu.cn/document/home/develop-a-bot-in-5-minutes/create-an-app)(必需)
119
+ - `PORT`:运行服务器的端口(默认:3333)
120
+
121
+ ### 命令行参数
122
+
123
+ - `--version`:显示版本号
124
+ - `--feishu-app-id`:你的飞书应用 ID
125
+ - `--feishu-app-secret`:你的飞书应用密钥
126
+ - `--port`:运行服务器的端口
127
+ - `--stdio`:在命令模式下运行服务器,而不是默认的 HTTP/SSE
128
+ - `--help`:显示帮助菜单
129
+
130
+ ## 连接到 Cursor
131
+
132
+ ### 配置 Cursor
133
+
134
+ 1. 打开 Cursor 设置
135
+ 2. 导航到 `Settings > AI > MCP Servers`
136
+ 3. 添加新服务器,URL 为 `http://localhost:3333`(或你配置的端口)
137
+ 4. 点击 "Verify Connection" 确保连接成功
138
+
139
+ ## 使用方法
140
+
141
+ 1. 在 Cursor 中,打开 AI 面板(默认快捷键 `Cmd+K` 或 `Ctrl+K`)
142
+ 2. 如果需要新建一个飞书文档编辑信息,应该明确制定一个folderToken,可以打开一个飞书文档目录如:`https://vq5xxxxx7bc.feishu.cn/drive/folder/FPKvfjdxxxxx706RnOc查找`
143
+ 2. 如果需要修改飞书文档内容应该明确告知飞书文档链接,例如:`https://vq5ixxxx7bc.feishu.cn/docx/J6T0d6exxxxxxxDdc1zqwnph`
144
+ 3. 询问关于文档的问题或请求基于文档内容执行操作
145
+ 4. 创建编辑文档都需要权限,可以到飞书开放平台对账号进行测试`https://open.feishu.cn/api-explorer/cli_a75a8ca0ac79100c?apiName=tenant_access_token_internal&from=op_doc&project=auth&resource=auth&version=v3`
146
+
147
+ ## 文档权限与故障排查
148
+
149
+ ### 权限类型
150
+ 权限分为两种:机器人权限、文档访问权限
151
+
152
+ ### 权限验证与排查
153
+ 1. 获取token:[https://open.feishu.cn/api-explorer/cli_a7582508c93ad00d?apiName=tenant_access_token_internal&project=auth&resource=auth&version=v3](https://open.feishu.cn/api-explorer/cli_a7582508c93ad00d?apiName=tenant_access_token_internal&project=auth&resource=auth&version=v3)
154
+ 2. 使用第1步获取的token,验证是否有权限访问该文档:[https://open.feishu.cn/api-explorer/cli_a7582508c93ad00d?apiName=get&project=docx&resource=document&version=v1](https://open.feishu.cn/api-explorer/cli_a7582508c93ad00d?apiName=get&project=docx&resource=document&version=v1)
155
+
156
+ ### 排查方法
157
+ 在飞书开发平台测试权限正常(在开放平台调试,失败时会有充足提示信息和指导)
158
+
159
+ ### 文档授权
160
+ 如遇到权限问题,请参考[云文档常见问题](https://open.feishu.cn/document/ukTMukTMukTM/uczNzUjL3czM14yN3MTN)、[知识库常见问题](https://open.feishu.cn/document/server-docs/docs/wiki-v2/wiki-qa),特别关注如何为应用或用户开通文档权限。
161
+
162
+ ## 许可证
163
+
164
+ MIT
package/dist/cli.js CHANGED
File without changes