chaimi-keep-mcp 3.1.45-beta.3 → 3.1.45-beta.4
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/package.json +1 -1
- package/server.js +16 -1
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -54,7 +54,22 @@ async function fetchConfigFromCloud() {
|
|
|
54
54
|
async function initializeConfig() {
|
|
55
55
|
const fs = require('fs');
|
|
56
56
|
const path = require('path');
|
|
57
|
-
const
|
|
57
|
+
const os = require('os');
|
|
58
|
+
|
|
59
|
+
// XDG 标准配置目录
|
|
60
|
+
// Linux/macOS: ~/.config/chaimi-keep-mcp/
|
|
61
|
+
// Windows: %APPDATA%/chaimi-keep-mcp/ (通过设置 XDG_CONFIG_HOME 环境变量)
|
|
62
|
+
const xdgConfigHome = process.env.XDG_CONFIG_HOME;
|
|
63
|
+
const configDir = xdgConfigHome
|
|
64
|
+
? path.join(xdgConfigHome, 'chaimi-keep-mcp')
|
|
65
|
+
: path.join(os.homedir(), '.config', 'chaimi-keep-mcp');
|
|
66
|
+
|
|
67
|
+
// 确保配置目录存在
|
|
68
|
+
if (!fs.existsSync(configDir)) {
|
|
69
|
+
fs.mkdirSync(configDir, { recursive: true, mode: 0o700 });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const envPath = path.join(configDir, envFile);
|
|
58
73
|
|
|
59
74
|
// 如果配置文件已存在,直接返回
|
|
60
75
|
if (fs.existsSync(envPath)) {
|