feishu-doc-mcp 1.0.1 → 1.0.3

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.
Files changed (3) hide show
  1. package/README.md +26 -0
  2. package/build/index.js +18 -17
  3. package/package.json +7 -9
package/README.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
  一个用于访问飞书开放平台文档的 Model Context Protocol (MCP) 服务器。该服务器使 Claude 等 AI 助手能够直接搜索和阅读飞书 API 文档。
4
4
 
5
+ ## 为什么选择 Feishu Doc MCP
6
+
7
+ ### 零配置,无需 API Key
8
+
9
+ 直接对接飞书官方公开的文档接口,无需申请任何 Token 或 API Key,开箱即用。
10
+
11
+ ### 动态同步,永不过时
12
+
13
+ 分类列表从飞书 API 实时获取,自动适应官方文档结构变化,无硬编码维护负担。当飞书新增或调整 API 分类时,本工具自动同步。
14
+
15
+ ### 覆盖完整,4800+ 文档
16
+
17
+ 支持飞书开放平台全部文档体系,包括服务端 API、客户端 API、开发指南、开发教程等 100+ 个分类,涵盖即时通讯、日历、通讯录、云文档、审批、人事等全部能力。
18
+
19
+ ### 内容智能处理
20
+
21
+ - HTML 自动转换为 Markdown,便于 AI 理解和引用
22
+ - 大文件自动提示分段读取,保护 context window
23
+ - 临时文件智能命名(可读前缀 + Hash),避免冲突
24
+
25
+ ### 高性能设计
26
+
27
+ - 启动时并行加载文档索引和 URI 映射
28
+ - 内存缓存 4800+ 文档映射,查询 O(1) 时间复杂度
29
+ - 支持长期运行,无需反复初始化
30
+
5
31
  ## 功能特性
6
32
 
7
33
  - 按分类搜索飞书 API 文档
package/build/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
- import axios from "axios";
5
4
  import TurndownService from "turndown";
6
5
  import * as fs from "fs";
7
6
  import * as os from "os";
@@ -52,15 +51,17 @@ class FeishuDocServer {
52
51
  try {
53
52
  // 并行获取文档树和 URI 映射
54
53
  const [treeResponse, mappingResponse] = await Promise.all([
55
- axios.get(DIRECTORY_LIST_URL, { timeout: 30000 }),
56
- axios.get(URI_MAPPING_URL, { timeout: 30000 }),
54
+ fetch(DIRECTORY_LIST_URL, { signal: AbortSignal.timeout(30000) }),
55
+ fetch(URI_MAPPING_URL, { signal: AbortSignal.timeout(30000) }),
57
56
  ]);
58
- if (treeResponse.data.code === 0) {
59
- this.docTree = treeResponse.data.data.items;
57
+ const treeData = (await treeResponse.json());
58
+ const mappingData = (await mappingResponse.json());
59
+ if (treeData.code === 0) {
60
+ this.docTree = treeData.data.items;
60
61
  console.error(`[Init] Loaded ${this.countNodes(this.docTree)} document nodes`);
61
62
  }
62
- if (mappingResponse.data.code === 0) {
63
- this.uriMap = mappingResponse.data.data.uriMap;
63
+ if (mappingData.code === 0) {
64
+ this.uriMap = mappingData.data.uriMap;
64
65
  console.error(`[Init] Loaded ${Object.keys(this.uriMap).length} URI mappings`);
65
66
  }
66
67
  // 构建目录分类映射
@@ -202,14 +203,16 @@ class FeishuDocServer {
202
203
  requestPath = this.uriMap[docPath];
203
204
  }
204
205
  // 请求文档内容
205
- const response = await axios.get(DOC_DETAIL_URL, {
206
- params: { fullPath: requestPath },
207
- timeout: 30000,
206
+ const url = new URL(DOC_DETAIL_URL);
207
+ url.searchParams.set("fullPath", requestPath);
208
+ const response = await fetch(url.toString(), {
209
+ signal: AbortSignal.timeout(30000),
208
210
  });
209
- if (response.data.code !== 0) {
210
- throw new Error(`API error: ${response.data.msg || "Unknown error"}`);
211
+ const data = await response.json();
212
+ if (data.code !== 0) {
213
+ throw new Error(`API error: ${data.msg || "Unknown error"}`);
211
214
  }
212
- const detail = response.data.data;
215
+ const detail = data.data;
213
216
  // 提取文档内容
214
217
  let content = "";
215
218
  // 文档标题
@@ -273,10 +276,8 @@ class FeishuDocServer {
273
276
  };
274
277
  }
275
278
  catch (error) {
276
- if (axios.isAxiosError(error)) {
277
- throw new Error(`Failed to fetch document: ${error.message}`);
278
- }
279
- throw error;
279
+ const message = error instanceof Error ? error.message : "Unknown error";
280
+ throw new Error(`Failed to fetch document: ${message}`);
280
281
  }
281
282
  }
282
283
  async run() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feishu-doc-mcp",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "MCP server for Feishu Open Platform Documentation",
5
5
  "type": "module",
6
6
  "main": "build/index.js",
@@ -39,16 +39,14 @@
39
39
  },
40
40
  "homepage": "https://github.com/ztxtxwd/feishu-doc-mcp#readme",
41
41
  "dependencies": {
42
- "@modelcontextprotocol/sdk": "^1.25.1",
43
- "axios": "^1.6.0",
44
- "turndown": "^7.1.0",
45
- "zod": "^4.2.1",
46
- "zod-to-json-schema": "^3.25.0"
42
+ "@modelcontextprotocol/sdk": "^1.25.2",
43
+ "turndown": "^7.2.2",
44
+ "zod": "^4.3.5"
47
45
  },
48
46
  "devDependencies": {
49
- "@types/node": "^20.0.0",
50
- "@types/turndown": "^5.0.0",
51
- "typescript": "^5.0.0"
47
+ "@types/node": "^25.0.6",
48
+ "@types/turndown": "^5.0.6",
49
+ "typescript": "^5.9.3"
52
50
  },
53
51
  "engines": {
54
52
  "node": ">=18"