@spuentesp/lain-mcp 0.8.0 → 0.9.1

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/README.md CHANGED
@@ -8,6 +8,20 @@
8
8
  npm install -g @spuentesp/lain-mcp
9
9
  ```
10
10
 
11
+ If npm fails with `EEXIST: file already exists` for `lain`, an
12
+ unrelated `lain` file already sits in npm's global bin directory (often
13
+ an older manual copy). Move or remove it, or install under a different
14
+ prefix:
15
+
16
+ ```bash
17
+ npm install -g --prefix ~/.local/lain-npm @spuentesp/lain-mcp
18
+ ```
19
+
20
+ When npm install scripts are disabled (`--ignore-scripts`, a
21
+ locked-down CI), the binary is not downloaded at install time. The
22
+ first `lain` run fetches and verifies it, so that first run needs
23
+ network access; once cached, it works offline.
24
+
11
25
  Or with npx (downloads binary on first run):
12
26
  ```bash
13
27
  npx @spuentesp/lain-mcp mcp
@@ -42,7 +56,18 @@ Set `LAIN_VERSION` to run a different published version. Set
42
56
 
43
57
  ## Usage
44
58
 
45
- After installation, add Lain to your MCP configuration:
59
+ From a repository you want Lain to index, the real path is the setup
60
+ command — it writes this package's MCP registration into your agent's
61
+ configuration and verifies the connection:
62
+
63
+ ```bash
64
+ lain setup --agent claude-code # also: codex, cursor, vscode, continue, generic
65
+ ```
66
+
67
+ `lain setup` registers the absolute path of the verified cache binary
68
+ (see "What this installs"), not the bare `lain` launcher — MCP hosts
69
+ rarely inherit the shell `PATH` that would resolve it. A hand-written
70
+ entry that calls the launcher works too when `PATH` reaches it:
46
71
 
47
72
  ```json
48
73
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spuentesp/lain-mcp",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
4
4
  "mcpName": "io.github.spuentesp/lain",
5
5
  "description": "High-performance knowledge graph MCP server for AI coding agents with semantic search.",
6
6
  "keywords": [
@@ -50,6 +50,14 @@ test('checksum mismatch fails closed', () => {
50
50
  } finally { fs.rmSync(directory, { recursive: true, force: true }); }
51
51
  });
52
52
 
53
+ test('Windows extraction uses System32 bsdtar, not the first tar on PATH', () => {
54
+ const env = { SystemRoot: 'C:\\Windows' };
55
+ assert.strictEqual(runtime.tarExecutable('win32', env, () => true), 'C:\\Windows\\System32\\tar.exe');
56
+ assert.strictEqual(runtime.tarExecutable('win32', env, () => false), 'tar');
57
+ assert.strictEqual(runtime.tarExecutable('win32', {}, () => true), 'tar');
58
+ assert.strictEqual(runtime.tarExecutable('linux', env, () => true), 'tar');
59
+ });
60
+
53
61
  test('Windows runtime DLLs are installed beside the executable', () => {
54
62
  const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'lain-windows-dlls-'));
55
63
  const source = path.join(directory, 'source');
@@ -104,6 +104,20 @@ function verifyWindowsRuntimeDlls(directory, platform = process.platform) {
104
104
  }
105
105
  }
106
106
 
107
+ // On Windows, `tar` on PATH is whatever comes first. Under Git Bash (the
108
+ // shell GitHub's Windows runners and many dev setups use) that is Git's GNU
109
+ // tar, which fails on these archives with `gzip: stdin: unexpected end of
110
+ // file`. Windows ships bsdtar at System32\tar.exe; use it when present.
111
+ function tarExecutable(platform = process.platform, env = process.env, exists = fs.existsSync) {
112
+ if (platform !== 'win32') return 'tar';
113
+ const root = env.SystemRoot || env.SYSTEMROOT || env.windir || env.WINDIR;
114
+ if (root) {
115
+ const system = path.win32.join(root, 'System32', 'tar.exe');
116
+ if (exists(system)) return system;
117
+ }
118
+ return 'tar';
119
+ }
120
+
107
121
  function download(url, destination, redirects = 5) {
108
122
  return new Promise((resolve, reject) => {
109
123
  const request = https.get(url, { headers: { 'User-Agent': '@spuentesp/lain-mcp' } }, (response) => {
@@ -165,7 +179,7 @@ async function ensureBinary(options = {}) {
165
179
  await fetch(releaseUrl(version, 'SHA256SUMS'), sums);
166
180
  await fetch(releaseUrl(version, asset), archive);
167
181
  verifyArchive(archive, parseChecksum(fs.readFileSync(sums, 'utf8'), asset));
168
- execFileSync('tar', ['xzf', archive, '-C', temporary], { stdio: ['ignore', 'ignore', 'inherit'] });
182
+ execFileSync(tarExecutable(platform, env), ['xzf', archive, '-C', temporary], { stdio: ['ignore', 'ignore', 'inherit'] });
169
183
  const extracted = path.join(temporary, platform === 'win32' ? 'lain.exe' : 'lain');
170
184
  if (!fs.existsSync(extracted)) throw new Error(`${asset} does not contain the Lain executable at its root`);
171
185
  if (platform !== 'win32') fs.chmodSync(extracted, 0o755);
@@ -194,4 +208,4 @@ async function ensureBinary(options = {}) {
194
208
  }
195
209
  }
196
210
 
197
- module.exports = { assetName, binaryPath, cacheRoot, ensureBinary, installWindowsRuntimeDlls, normalizeVersion, parseChecksum, releaseUrl, selectedVersion, sha256, targetFor, verifyArchive, verifyBinary, verifySidecarBinary, verifyWindowsRuntimeDlls };
211
+ module.exports = { assetName, binaryPath, cacheRoot, ensureBinary, installWindowsRuntimeDlls, normalizeVersion, parseChecksum, releaseUrl, selectedVersion, sha256, tarExecutable, targetFor, verifyArchive, verifyBinary, verifySidecarBinary, verifyWindowsRuntimeDlls };