@shodh/memory-mcp 0.1.71 → 0.1.73
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/index.js +11 -2
- package/package.json +1 -1
- package/scripts/postinstall.cjs +134 -134
package/dist/index.js
CHANGED
|
@@ -5125,7 +5125,11 @@ async function apiCall(endpoint, method = "GET", body) {
|
|
|
5125
5125
|
}
|
|
5126
5126
|
}
|
|
5127
5127
|
}
|
|
5128
|
-
|
|
5128
|
+
const errMsg = lastError?.message || "Unknown error";
|
|
5129
|
+
if (errMsg.includes("ECONNREFUSED") || errMsg.includes("fetch failed")) {
|
|
5130
|
+
throw new Error(`Cannot connect to shodh-memory server at ${API_URL}. ` + `Start the server with: shodh-memory-server`);
|
|
5131
|
+
}
|
|
5132
|
+
throw new Error(`Failed after ${RETRY_ATTEMPTS} attempts: ${errMsg}`);
|
|
5129
5133
|
}
|
|
5130
5134
|
async function isServerAvailable() {
|
|
5131
5135
|
try {
|
|
@@ -7842,7 +7846,12 @@ async function ensureServerRunning() {
|
|
|
7842
7846
|
return;
|
|
7843
7847
|
}
|
|
7844
7848
|
if (!AUTO_SPAWN_ENABLED) {
|
|
7845
|
-
console.error("[shodh-memory]
|
|
7849
|
+
console.error("[shodh-memory] Server not running at", API_URL);
|
|
7850
|
+
console.error("[shodh-memory] Auto-spawn disabled (SHODH_AUTO_SPAWN=false).");
|
|
7851
|
+
console.error("[shodh-memory] Start the server manually:");
|
|
7852
|
+
console.error("[shodh-memory] shodh-memory-server");
|
|
7853
|
+
console.error("[shodh-memory] Or with Docker:");
|
|
7854
|
+
console.error("[shodh-memory] docker run -d -p 3030:3030 roshera/shodh-memory");
|
|
7846
7855
|
return;
|
|
7847
7856
|
}
|
|
7848
7857
|
const binaryPath = getBinaryPath();
|
package/package.json
CHANGED
package/scripts/postinstall.cjs
CHANGED
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Postinstall script for @shodh/memory-mcp
|
|
4
|
-
*
|
|
5
|
-
* Downloads the appropriate shodh-memory-server binary for the current platform
|
|
6
|
-
* from GitHub releases.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const fs = require('fs');
|
|
10
|
-
const path = require('path');
|
|
11
|
-
const https = require('https');
|
|
12
|
-
const { execSync } = require('child_process');
|
|
13
|
-
|
|
14
|
-
const VERSION = '0.1.
|
|
15
|
-
const REPO = 'varun29ankuS/shodh-memory';
|
|
16
|
-
const BIN_DIR = path.join(__dirname, '..', 'bin');
|
|
17
|
-
|
|
18
|
-
// Platform detection
|
|
19
|
-
function getPlatformInfo() {
|
|
20
|
-
const platform = process.platform;
|
|
21
|
-
const arch = process.arch;
|
|
22
|
-
|
|
23
|
-
if (platform === 'linux' && arch === 'x64') {
|
|
24
|
-
return { name: 'shodh-memory-linux-x64', ext: '.tar.gz', binary: 'shodh-memory-server' };
|
|
25
|
-
} else if (platform === 'linux' && arch === 'arm64') {
|
|
26
|
-
return { name: 'shodh-memory-linux-arm64', ext: '.tar.gz', binary: 'shodh-memory-server' };
|
|
27
|
-
} else if (platform === 'darwin' && arch === 'x64') {
|
|
28
|
-
return { name: 'shodh-memory-macos-x64', ext: '.tar.gz', binary: 'shodh-memory-server' };
|
|
29
|
-
} else if (platform === 'darwin' && arch === 'arm64') {
|
|
30
|
-
return { name: 'shodh-memory-macos-arm64', ext: '.tar.gz', binary: 'shodh-memory-server' };
|
|
31
|
-
} else if (platform === 'win32' && arch === 'x64') {
|
|
32
|
-
return { name: 'shodh-memory-windows-x64', ext: '.zip', binary: 'shodh-memory-server.exe' };
|
|
33
|
-
} else {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Download file with redirect following
|
|
39
|
-
function download(url, dest) {
|
|
40
|
-
return new Promise((resolve, reject) => {
|
|
41
|
-
const file = fs.createWriteStream(dest);
|
|
42
|
-
|
|
43
|
-
const request = (url) => {
|
|
44
|
-
https.get(url, (response) => {
|
|
45
|
-
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
46
|
-
// Follow redirect
|
|
47
|
-
request(response.headers.location);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (response.statusCode !== 200) {
|
|
52
|
-
reject(new Error(`Failed to download: ${response.statusCode}`));
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
response.pipe(file);
|
|
57
|
-
file.on('finish', () => {
|
|
58
|
-
file.close();
|
|
59
|
-
resolve();
|
|
60
|
-
});
|
|
61
|
-
}).on('error', (err) => {
|
|
62
|
-
fs.unlink(dest, () => {});
|
|
63
|
-
reject(err);
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
request(url);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Extract archive
|
|
72
|
-
function extract(archive, dest, platformInfo) {
|
|
73
|
-
if (platformInfo.ext === '.tar.gz') {
|
|
74
|
-
execSync(`tar -xzf "${archive}" -C "${dest}"`, { stdio: 'inherit' });
|
|
75
|
-
} else if (platformInfo.ext === '.zip') {
|
|
76
|
-
// Use PowerShell on Windows
|
|
77
|
-
execSync(`powershell -Command "Expand-Archive -Path '${archive}' -DestinationPath '${dest}' -Force"`, { stdio: 'inherit' });
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
async function main() {
|
|
82
|
-
const platformInfo = getPlatformInfo();
|
|
83
|
-
|
|
84
|
-
if (!platformInfo) {
|
|
85
|
-
console.log('[shodh-memory] Unsupported platform:', process.platform, process.arch);
|
|
86
|
-
console.log('[shodh-memory] You will need to run the server manually.');
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
console.log('[shodh-memory] Installing server binary for', process.platform, process.arch);
|
|
91
|
-
|
|
92
|
-
// Create bin directory
|
|
93
|
-
if (!fs.existsSync(BIN_DIR)) {
|
|
94
|
-
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const binaryPath = path.join(BIN_DIR, platformInfo.binary);
|
|
98
|
-
|
|
99
|
-
// Check if already installed
|
|
100
|
-
if (fs.existsSync(binaryPath)) {
|
|
101
|
-
console.log('[shodh-memory] Binary already installed at', binaryPath);
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Download URL
|
|
106
|
-
const downloadUrl = `https://github.com/${REPO}/releases/download/v${VERSION}/${platformInfo.name}${platformInfo.ext}`;
|
|
107
|
-
const archivePath = path.join(BIN_DIR, `${platformInfo.name}${platformInfo.ext}`);
|
|
108
|
-
|
|
109
|
-
console.log('[shodh-memory] Downloading from', downloadUrl);
|
|
110
|
-
|
|
111
|
-
try {
|
|
112
|
-
await download(downloadUrl, archivePath);
|
|
113
|
-
console.log('[shodh-memory] Downloaded archive');
|
|
114
|
-
|
|
115
|
-
// Extract
|
|
116
|
-
extract(archivePath, BIN_DIR, platformInfo);
|
|
117
|
-
console.log('[shodh-memory] Extracted binary');
|
|
118
|
-
|
|
119
|
-
// Clean up archive
|
|
120
|
-
fs.unlinkSync(archivePath);
|
|
121
|
-
|
|
122
|
-
// Make executable (Unix)
|
|
123
|
-
if (process.platform !== 'win32') {
|
|
124
|
-
fs.chmodSync(binaryPath, 0o755);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
console.log('[shodh-memory] Server binary installed at', binaryPath);
|
|
128
|
-
} catch (err) {
|
|
129
|
-
console.error('[shodh-memory] Failed to install binary:', err.message);
|
|
130
|
-
console.log('[shodh-memory] You can manually download from:', `https://github.com/${REPO}/releases`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
main();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Postinstall script for @shodh/memory-mcp
|
|
4
|
+
*
|
|
5
|
+
* Downloads the appropriate shodh-memory-server binary for the current platform
|
|
6
|
+
* from GitHub releases.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const https = require('https');
|
|
12
|
+
const { execSync } = require('child_process');
|
|
13
|
+
|
|
14
|
+
const VERSION = '0.1.73';
|
|
15
|
+
const REPO = 'varun29ankuS/shodh-memory';
|
|
16
|
+
const BIN_DIR = path.join(__dirname, '..', 'bin');
|
|
17
|
+
|
|
18
|
+
// Platform detection
|
|
19
|
+
function getPlatformInfo() {
|
|
20
|
+
const platform = process.platform;
|
|
21
|
+
const arch = process.arch;
|
|
22
|
+
|
|
23
|
+
if (platform === 'linux' && arch === 'x64') {
|
|
24
|
+
return { name: 'shodh-memory-linux-x64', ext: '.tar.gz', binary: 'shodh-memory-server' };
|
|
25
|
+
} else if (platform === 'linux' && arch === 'arm64') {
|
|
26
|
+
return { name: 'shodh-memory-linux-arm64', ext: '.tar.gz', binary: 'shodh-memory-server' };
|
|
27
|
+
} else if (platform === 'darwin' && arch === 'x64') {
|
|
28
|
+
return { name: 'shodh-memory-macos-x64', ext: '.tar.gz', binary: 'shodh-memory-server' };
|
|
29
|
+
} else if (platform === 'darwin' && arch === 'arm64') {
|
|
30
|
+
return { name: 'shodh-memory-macos-arm64', ext: '.tar.gz', binary: 'shodh-memory-server' };
|
|
31
|
+
} else if (platform === 'win32' && arch === 'x64') {
|
|
32
|
+
return { name: 'shodh-memory-windows-x64', ext: '.zip', binary: 'shodh-memory-server.exe' };
|
|
33
|
+
} else {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Download file with redirect following
|
|
39
|
+
function download(url, dest) {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
const file = fs.createWriteStream(dest);
|
|
42
|
+
|
|
43
|
+
const request = (url) => {
|
|
44
|
+
https.get(url, (response) => {
|
|
45
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
46
|
+
// Follow redirect
|
|
47
|
+
request(response.headers.location);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (response.statusCode !== 200) {
|
|
52
|
+
reject(new Error(`Failed to download: ${response.statusCode}`));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
response.pipe(file);
|
|
57
|
+
file.on('finish', () => {
|
|
58
|
+
file.close();
|
|
59
|
+
resolve();
|
|
60
|
+
});
|
|
61
|
+
}).on('error', (err) => {
|
|
62
|
+
fs.unlink(dest, () => {});
|
|
63
|
+
reject(err);
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
request(url);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Extract archive
|
|
72
|
+
function extract(archive, dest, platformInfo) {
|
|
73
|
+
if (platformInfo.ext === '.tar.gz') {
|
|
74
|
+
execSync(`tar -xzf "${archive}" -C "${dest}"`, { stdio: 'inherit' });
|
|
75
|
+
} else if (platformInfo.ext === '.zip') {
|
|
76
|
+
// Use PowerShell on Windows
|
|
77
|
+
execSync(`powershell -Command "Expand-Archive -Path '${archive}' -DestinationPath '${dest}' -Force"`, { stdio: 'inherit' });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function main() {
|
|
82
|
+
const platformInfo = getPlatformInfo();
|
|
83
|
+
|
|
84
|
+
if (!platformInfo) {
|
|
85
|
+
console.log('[shodh-memory] Unsupported platform:', process.platform, process.arch);
|
|
86
|
+
console.log('[shodh-memory] You will need to run the server manually.');
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
console.log('[shodh-memory] Installing server binary for', process.platform, process.arch);
|
|
91
|
+
|
|
92
|
+
// Create bin directory
|
|
93
|
+
if (!fs.existsSync(BIN_DIR)) {
|
|
94
|
+
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const binaryPath = path.join(BIN_DIR, platformInfo.binary);
|
|
98
|
+
|
|
99
|
+
// Check if already installed
|
|
100
|
+
if (fs.existsSync(binaryPath)) {
|
|
101
|
+
console.log('[shodh-memory] Binary already installed at', binaryPath);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Download URL
|
|
106
|
+
const downloadUrl = `https://github.com/${REPO}/releases/download/v${VERSION}/${platformInfo.name}${platformInfo.ext}`;
|
|
107
|
+
const archivePath = path.join(BIN_DIR, `${platformInfo.name}${platformInfo.ext}`);
|
|
108
|
+
|
|
109
|
+
console.log('[shodh-memory] Downloading from', downloadUrl);
|
|
110
|
+
|
|
111
|
+
try {
|
|
112
|
+
await download(downloadUrl, archivePath);
|
|
113
|
+
console.log('[shodh-memory] Downloaded archive');
|
|
114
|
+
|
|
115
|
+
// Extract
|
|
116
|
+
extract(archivePath, BIN_DIR, platformInfo);
|
|
117
|
+
console.log('[shodh-memory] Extracted binary');
|
|
118
|
+
|
|
119
|
+
// Clean up archive
|
|
120
|
+
fs.unlinkSync(archivePath);
|
|
121
|
+
|
|
122
|
+
// Make executable (Unix)
|
|
123
|
+
if (process.platform !== 'win32') {
|
|
124
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
console.log('[shodh-memory] Server binary installed at', binaryPath);
|
|
128
|
+
} catch (err) {
|
|
129
|
+
console.error('[shodh-memory] Failed to install binary:', err.message);
|
|
130
|
+
console.log('[shodh-memory] You can manually download from:', `https://github.com/${REPO}/releases`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
main();
|