feishu-mcp 0.2.7 → 0.2.8
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/dist/cli/commands/config.js +21 -5
- package/dist/mcp/feishuMcp.js +4 -1
- package/package.json +1 -1
|
@@ -41,22 +41,38 @@ export function writeEnvKey(filePath, key, value) {
|
|
|
41
41
|
}
|
|
42
42
|
writeFileSync(filePath, content, 'utf-8');
|
|
43
43
|
}
|
|
44
|
+
/** 对敏感字段做脱敏处理 */
|
|
45
|
+
function maskValue(key, value) {
|
|
46
|
+
if (key.includes('SECRET') || key.includes('APP_ID')) {
|
|
47
|
+
if (value.length <= 6)
|
|
48
|
+
return '****';
|
|
49
|
+
return `${value.slice(0, 3)}****${value.slice(-3)}`;
|
|
50
|
+
}
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
44
53
|
/** 展示当前生效配置 */
|
|
45
54
|
export function handleConfigShow(envPath) {
|
|
46
|
-
|
|
55
|
+
// 仅当加载来源与全局配置文件不同时,才额外展示全局配置文件内容(避免重复)
|
|
56
|
+
const showGlobal = envPath !== GLOBAL_CONFIG_FILE;
|
|
47
57
|
const output = {
|
|
48
58
|
configFile: existsSync(GLOBAL_CONFIG_FILE) ? GLOBAL_CONFIG_FILE : null,
|
|
49
59
|
loadedFrom: envPath ?? null,
|
|
50
60
|
config: {
|
|
51
|
-
FEISHU_APP_ID: process.env.FEISHU_APP_ID
|
|
61
|
+
FEISHU_APP_ID: process.env.FEISHU_APP_ID
|
|
62
|
+
? maskValue('FEISHU_APP_ID', process.env.FEISHU_APP_ID) : '(未设置)',
|
|
52
63
|
FEISHU_APP_SECRET: process.env.FEISHU_APP_SECRET
|
|
53
|
-
?
|
|
64
|
+
? maskValue('FEISHU_APP_SECRET', process.env.FEISHU_APP_SECRET) : '(未设置)',
|
|
54
65
|
FEISHU_AUTH_TYPE: process.env.FEISHU_AUTH_TYPE ?? 'tenant (默认)',
|
|
55
66
|
FEISHU_ENABLED_MODULES: process.env.FEISHU_ENABLED_MODULES ?? 'document (默认)',
|
|
56
67
|
PORT: process.env.PORT ?? '3333 (默认)',
|
|
57
68
|
},
|
|
58
|
-
globalConfigFile: Object.keys(fileConfig).length ? fileConfig : '(文件不存在)',
|
|
59
69
|
};
|
|
70
|
+
if (showGlobal) {
|
|
71
|
+
const fileConfig = readEnvFile(GLOBAL_CONFIG_FILE);
|
|
72
|
+
output.globalConfigFile = Object.keys(fileConfig).length
|
|
73
|
+
? Object.fromEntries(Object.entries(fileConfig).map(([k, v]) => [k, maskValue(k, v)]))
|
|
74
|
+
: '(文件不存在)';
|
|
75
|
+
}
|
|
60
76
|
process.stdout.write(JSON.stringify(output, null, 2) + '\n');
|
|
61
77
|
}
|
|
62
78
|
/** 向配置文件写入 key=value,写入目标与当前加载来源保持一致 */
|
|
@@ -81,6 +97,6 @@ export function handleConfigSet(key, value, envPath) {
|
|
|
81
97
|
process.stdout.write(JSON.stringify({
|
|
82
98
|
ok: true,
|
|
83
99
|
file: targetFile,
|
|
84
|
-
set: { [key]: key.includes('SECRET')
|
|
100
|
+
set: { [key]: key.includes('SECRET') || key.includes('APP_ID') ? maskValue(key, value) : value },
|
|
85
101
|
}) + '\n');
|
|
86
102
|
}
|
package/dist/mcp/feishuMcp.js
CHANGED
|
@@ -3,9 +3,12 @@ import { FeishuApiService } from '../services/feishuApiService.js';
|
|
|
3
3
|
import { Logger } from '../utils/logger.js';
|
|
4
4
|
import { Config } from '../utils/config.js';
|
|
5
5
|
import { ModuleRegistry } from '../modules/ModuleRegistry.js';
|
|
6
|
+
import { createRequire } from 'module';
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
const { version } = require('../../package.json');
|
|
6
9
|
export const serverInfo = {
|
|
7
10
|
name: "Feishu MCP Server",
|
|
8
|
-
version
|
|
11
|
+
version,
|
|
9
12
|
};
|
|
10
13
|
const serverOptions = {
|
|
11
14
|
capabilities: { logging: {}, tools: {} },
|