@alucardeht/may-la-mcp 0.1.0

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 (4) hide show
  1. package/LICENSE +200 -0
  2. package/cli.js +48 -0
  3. package/install.js +293 -0
  4. package/package.json +33 -0
package/LICENSE ADDED
@@ -0,0 +1,200 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined in Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or Object
36
+ form, made available under the License, as indicated by a copyright
37
+ notice that is included in or attached to the work (an example is
38
+ provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original Work and any Derivative Works thereof, submitted to,
50
+ displayed in, or distributed with the Work (or Derivative Works thereof)
51
+ where such submission takes place and includes any modifications
52
+ proposed or made to the Work or Derivative Works thereof by You to
53
+ Licensor or its representatives, as indicated by a notice in the Source
54
+ form or by communication with Licensor or its representatives (including,
55
+ but not limited to, email, mailing lists, or source code control systems).
56
+ Notwithstanding the above definition of Contribution, Contribution shall
57
+ not include communications that are conspicuously marked or otherwise
58
+ designated in writing by You as "Not a Contribution."
59
+
60
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
61
+ whom a Contribution has been received by Licensor and subsequently
62
+ incorporated within the Work.
63
+
64
+ 2. Grant of Copyright License. Subject to the terms and conditions of
65
+ this License, each Contributor hereby grants to You a perpetual,
66
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
67
+ copyright license to reproduce, prepare Derivative Works of,
68
+ publicly display, publicly perform, sublicense, and distribute the
69
+ Work and such Derivative Works in Source or Object form.
70
+
71
+ 3. Grant of Patent License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ (except as stated in this section) patent license to make, have made,
75
+ use, offer to sell, sell, import, and otherwise transfer the Work,
76
+ where such license applies only to those patent claims licensable
77
+ by such Contributor that are necessarily infringed by their
78
+ Contribution(s) alone or by combination of their Contribution(s)
79
+ with the Work to which such Contribution(s) was submitted. If You
80
+ institute patent litigation against any entity (including a
81
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
82
+ or a Contribution incorporated within the Work constitutes direct
83
+ or contributory patent infringement, then any patent licenses
84
+ granted to You under this License for that Work shall terminate
85
+ as of the date such litigation is filed.
86
+
87
+ 4. Redistribution. You may reproduce and distribute copies of the
88
+ Work or Derivative Works thereof in any medium, with or without
89
+ modifications, and in Source or Object form, provided that You
90
+ meet the following conditions:
91
+
92
+ (a) You must give any other recipients of the Work or
93
+ Derivative Works a copy of this License; and
94
+
95
+ (b) You must cause any modified files to carry prominent notices
96
+ stating that You changed the files; and
97
+
98
+ (c) You must retain, in the Source form of any Derivative Works
99
+ that You distribute, all copyright, patent, trademark, and
100
+ attribution notices from the Source form of the Work,
101
+ excluding those notices that do not pertain to any part of
102
+ the Derivative Works; and
103
+
104
+ (d) If the Work includes a "NOTICE" text file, then any
105
+ Derivative Works that You distribute must include a readable
106
+ copy of the attribution notices contained
107
+ within such NOTICE file, excluding those notices that do not
108
+ pertain to any part of the Derivative Works, in at least one
109
+ of the following places: within a NOTICE text file distributed
110
+ as part of the Derivative Works; within the Source form or
111
+ documentation, if provided along with the Derivative Works; or,
112
+ within a display generated by the Derivative Works, if and
113
+ wherever such third-party notices normally appear. The contents
114
+ of the NOTICE file are for informational purposes only and
115
+ do not modify the License. You may add Your own attribution
116
+ notices within Derivative Works that You distribute, alongside
117
+ or as an addendum to the NOTICE from the Work, provided that
118
+ such additional attribution notices cannot be construed
119
+ as modifying the License.
120
+
121
+ You may add Your own copyright statement to Your modifications and
122
+ may provide additional or different license terms and conditions
123
+ for use, reproduction, or distribution of Your modifications, or
124
+ for any such Derivative Works as a whole, provided Your use,
125
+ reproduction, and distribution of the Work otherwise complies with
126
+ the conditions of this License.
127
+
128
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
129
+ any Contribution intentionally submitted for inclusion in the Work
130
+ by You to Licensor shall be under the terms and conditions of
131
+ this License, without any additional terms or conditions.
132
+ Notwithstanding the above, nothing herein shall supersede or modify
133
+ the terms of any separate license agreement you may have executed
134
+ with Licensor regarding such Contribution.
135
+
136
+ 6. Trademarks. This License does not grant permission to use the trade
137
+ names, trademarks, service marks, or product names of the Licensor,
138
+ except as required for reasonable and customary use in describing the
139
+ origin of the Work and reproducing the content of the NOTICE file.
140
+
141
+ 7. Disclaimer of Warranty. Unless required by applicable law or
142
+ agreed to in writing, Licensor provides the Work (and each
143
+ Contributor provides its Contributions) on an "AS IS" BASIS,
144
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
145
+ or implied, including, without limitation, any warranties or
146
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
147
+ FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
148
+ determining the appropriateness of using or redistributing the Work
149
+ and assume any risks associated with Your exercise of permissions
150
+ under this License.
151
+
152
+ 8. Limitation of Liability. In no event and under no legal theory,
153
+ whether in tort (including negligence), contract, or otherwise,
154
+ unless required by applicable law (such as deliberate and grossly
155
+ negligent acts) or agreed to in writing, shall any Contributor be
156
+ liable to You for damages, including any direct, indirect, special,
157
+ incidental, or consequential damages of any character arising as a
158
+ result of this License or out of the use or inability to use the
159
+ Work (including but not limited to damages for loss of goodwill,
160
+ work stoppage, computer failure or malfunction, or any and all
161
+ other commercial damages or losses), even if such Contributor
162
+ has been advised of the possibility of such damages.
163
+
164
+ 9. Accepting Warranty or Additional Liability. While redistributing
165
+ the Work or Derivative Works thereof, You may choose to offer,
166
+ and charge a fee for, acceptance of support, warranty, indemnity,
167
+ or other liability obligations and/or rights consistent with this
168
+ License. However, in accepting such obligations, You may act only
169
+ on Your own behalf and on Your sole responsibility, not on behalf
170
+ of any other Contributor, and only if You agree to indemnify,
171
+ defend, and hold each Contributor harmless for any liability
172
+ incurred by, or claims asserted against, such Contributor by reason
173
+ of your accepting any such warranty or additional liability.
174
+
175
+ END OF TERMS AND CONDITIONS
176
+
177
+ APPENDIX: How to apply the Apache License to your work.
178
+
179
+ To apply the Apache License to your work, attach the following
180
+ boilerplate notice, with the fields enclosed by brackets "[]"
181
+ replaced with your own identifying information. (Don't include
182
+ the brackets!) The text should be enclosed in the appropriate
183
+ comment syntax for the file format. We also recommend that a
184
+ file or class name and description of purpose be included on the
185
+ same "printed page" as the copyright notice for easier
186
+ identification within third-party archives.
187
+
188
+ Copyright 2024-2025 alucardeht
189
+
190
+ Licensed under the Apache License, Version 2.0 (the "License");
191
+ you may not use this file except in compliance with the License.
192
+ You may obtain a copy of the License at
193
+
194
+ http://www.apache.org/licenses/LICENSE-2.0
195
+
196
+ Unless required by applicable law or agreed to in writing, software
197
+ distributed under the License is distributed on an "AS IS" BASIS,
198
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
+ See the License for the specific language governing permissions and
200
+ limitations under the License.
package/cli.js ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ const path = require('node:path');
6
+ const os = require('node:os');
7
+ const fs = require('node:fs');
8
+ const { spawn } = require('node:child_process');
9
+
10
+ const binaryName = process.platform === 'win32' ? 'mayla.exe' : 'mayla';
11
+ const binaryPath = path.join(os.homedir(), '.mayla', binaryName);
12
+
13
+ if (!fs.existsSync(binaryPath)) {
14
+ process.stderr.write(
15
+ `\n \u2717 may-la binary not found at: ${binaryPath}\n\n` +
16
+ ` The binary may not have been downloaded during installation.\n` +
17
+ ` Try reinstalling:\n\n` +
18
+ ` npm install -g @alucardeht/may-la-mcp\n\n` +
19
+ ` Or download manually from:\n` +
20
+ ` https://github.com/alucardeht/may-la-mcp/releases\n\n`
21
+ );
22
+ process.exit(1);
23
+ }
24
+
25
+ const child = spawn(binaryPath, process.argv.slice(2), {
26
+ stdio: 'inherit',
27
+ });
28
+
29
+ process.on('SIGINT', () => {
30
+ child.kill('SIGINT');
31
+ });
32
+
33
+ process.on('SIGTERM', () => {
34
+ child.kill('SIGTERM');
35
+ });
36
+
37
+ child.on('exit', (code, signal) => {
38
+ if (signal) {
39
+ process.kill(process.pid, signal);
40
+ } else {
41
+ process.exit(code ?? 0);
42
+ }
43
+ });
44
+
45
+ child.on('error', (err) => {
46
+ process.stderr.write(`\n \u2717 Failed to start may-la: ${err.message}\n\n`);
47
+ process.exit(1);
48
+ });
package/install.js ADDED
@@ -0,0 +1,293 @@
1
+ #!/usr/bin/env node
2
+
3
+ 'use strict';
4
+
5
+ const https = require('node:https');
6
+ const fs = require('node:fs');
7
+ const path = require('node:path');
8
+ const os = require('node:os');
9
+ const { execSync } = require('node:child_process');
10
+
11
+ const stderr = (msg) => process.stderr.write(msg);
12
+ const stderrln = (msg) => process.stderr.write(msg + '\n');
13
+
14
+ const PLATFORM_MAP = {
15
+ darwin: 'darwin',
16
+ linux: 'linux',
17
+ win32: 'windows',
18
+ };
19
+
20
+ const ARCH_MAP = {
21
+ x64: 'amd64',
22
+ arm64: 'arm64',
23
+ };
24
+
25
+ const UNSUPPORTED_COMBOS = new Set(['linux_arm64', 'windows_arm64']);
26
+
27
+ function detectPlatform() {
28
+ const platform = PLATFORM_MAP[process.platform];
29
+ const arch = ARCH_MAP[process.arch];
30
+
31
+ if (!platform) {
32
+ throw new Error(`Unsupported platform: ${process.platform}`);
33
+ }
34
+ if (!arch) {
35
+ throw new Error(`Unsupported architecture: ${process.arch}`);
36
+ }
37
+ if (UNSUPPORTED_COMBOS.has(`${platform}_${arch}`)) {
38
+ throw new Error(
39
+ `Unsupported platform combination: ${platform} ${arch}\n` +
40
+ ` Please open an issue at https://github.com/alucardeht/may-la-mcp/issues`
41
+ );
42
+ }
43
+
44
+ return { platform, arch };
45
+ }
46
+
47
+ function resolveInstallDir() {
48
+ const sudoUser = process.env.SUDO_USER;
49
+ if (sudoUser) {
50
+ const homeBase = process.platform === 'darwin' ? '/Users' : '/home';
51
+ return path.join(homeBase, sudoUser, '.mayla');
52
+ }
53
+ return path.join(os.homedir(), '.mayla');
54
+ }
55
+
56
+ function readPackageVersion() {
57
+ const pkgPath = path.join(__dirname, 'package.json');
58
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
59
+ return pkg.version;
60
+ }
61
+
62
+ function buildDownloadUrl(binaryName, version, platform, arch) {
63
+ const suffix = platform === 'windows' ? '.exe' : '';
64
+ const fileName = `${binaryName}-${platform}_${arch}${suffix}`;
65
+ return `https://github.com/alucardeht/may-la-mcp/releases/download/v${version}/${fileName}`;
66
+ }
67
+
68
+ function buildAuthHeaders() {
69
+ const token = process.env.MAYLA_GITHUB_TOKEN || process.env.GITHUB_TOKEN;
70
+ if (token) {
71
+ return { Authorization: `Bearer ${token}` };
72
+ }
73
+ return {};
74
+ }
75
+
76
+ function downloadFile(url, destPath, maxRedirects = 5) {
77
+ return new Promise((resolve, reject) => {
78
+ const tmpPath = destPath + '.tmp';
79
+
80
+ function follow(currentUrl, redirectsLeft) {
81
+ const parsedUrl = new URL(currentUrl);
82
+ const options = {
83
+ hostname: parsedUrl.hostname,
84
+ path: parsedUrl.pathname + parsedUrl.search,
85
+ headers: {
86
+ 'User-Agent': 'may-la-mcp-installer',
87
+ ...buildAuthHeaders(),
88
+ },
89
+ };
90
+
91
+ const req = https.get(options, (res) => {
92
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
93
+ if (redirectsLeft === 0) {
94
+ reject(new Error('Too many redirects'));
95
+ return;
96
+ }
97
+ follow(res.headers.location, redirectsLeft - 1);
98
+ return;
99
+ }
100
+
101
+ if (res.statusCode === 403 || res.statusCode === 429) {
102
+ reject(
103
+ new Error(
104
+ `GitHub API rate limited (HTTP ${res.statusCode}).\n` +
105
+ ` Set MAYLA_GITHUB_TOKEN or GITHUB_TOKEN env var to authenticate.`
106
+ )
107
+ );
108
+ return;
109
+ }
110
+
111
+ if (res.statusCode !== 200) {
112
+ reject(new Error(`HTTP ${res.statusCode} downloading ${currentUrl}`));
113
+ return;
114
+ }
115
+
116
+ const totalBytes = parseInt(res.headers['content-length'] || '0', 10);
117
+ let receivedBytes = 0;
118
+
119
+ const fileStream = fs.createWriteStream(tmpPath);
120
+
121
+ res.on('data', (chunk) => {
122
+ receivedBytes += chunk.length;
123
+ });
124
+
125
+ res.pipe(fileStream);
126
+
127
+ fileStream.on('finish', () => {
128
+ fileStream.close(() => {
129
+ fs.renameSync(tmpPath, destPath);
130
+ resolve({ receivedBytes, totalBytes });
131
+ });
132
+ });
133
+
134
+ fileStream.on('error', (err) => {
135
+ fs.unlink(tmpPath, () => {});
136
+ reject(err);
137
+ });
138
+ });
139
+
140
+ req.on('error', (err) => {
141
+ fs.unlink(tmpPath, () => {});
142
+ reject(err);
143
+ });
144
+ }
145
+
146
+ follow(url, maxRedirects);
147
+ });
148
+ }
149
+
150
+ function formatBytes(bytes) {
151
+ if (bytes === 0) return 'unknown size';
152
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
153
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
154
+ }
155
+
156
+ function padEnd(str, length) {
157
+ while (str.length < length) str += ' ';
158
+ return str;
159
+ }
160
+
161
+ function makeBinaryExecutable(filePath) {
162
+ fs.chmodSync(filePath, 0o755);
163
+ }
164
+
165
+ function removeQuarantine(filePath) {
166
+ if (process.platform !== 'darwin') return;
167
+ try {
168
+ execSync(`xattr -d com.apple.quarantine "${filePath}"`, { stdio: 'ignore' });
169
+ } catch {
170
+ // quarantine attribute may not be present — safe to ignore
171
+ }
172
+ }
173
+
174
+ function binaryExists(installDir, platform) {
175
+ const suffix = platform === 'windows' ? '.exe' : '';
176
+ const maylaPath = path.join(installDir, `mayla${suffix}`);
177
+ const daemonPath = path.join(installDir, `mayla-daemon${suffix}`);
178
+ return fs.existsSync(maylaPath) && fs.existsSync(daemonPath);
179
+ }
180
+
181
+ function printHeader(platform, arch, version) {
182
+ stderrln('');
183
+ stderrln(' \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557');
184
+ stderrln(' \u2551 may-la MCP \u2014 Installation \u2551');
185
+ stderrln(' \u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563');
186
+ stderrln(` \u2551 Platform: ${padEnd(`${platform} ${arch}`, 42)}\u2551`);
187
+ stderrln(` \u2551 Version: ${padEnd(`v${version}`, 42)}\u2551`);
188
+ stderrln(' \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d');
189
+ stderrln('');
190
+ }
191
+
192
+ function printSuccessBox(installDir) {
193
+ const displayDir = installDir.replace(os.homedir(), '~');
194
+ stderrln(` \u2713 Binaries installed to ${displayDir}/`);
195
+ stderrln('');
196
+ stderrln(' \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510');
197
+ stderrln(' \u2502 \u2502');
198
+ stderrln(' \u2502 \u2713 Ready! Add to your MCP client: \u2502');
199
+ stderrln(' \u2502 \u2502');
200
+ stderrln(' \u2502 Claude Code: \u2502');
201
+ stderrln(' \u2502 claude mcp add may-la -- may-la-mcp \u2502');
202
+ stderrln(' \u2502 \u2502');
203
+ stderrln(' \u2502 Other MCP clients: \u2502');
204
+ stderrln(' \u2502 Command: may-la-mcp \u2502');
205
+ stderrln(' \u2502 \u2502');
206
+ stderrln(' \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518');
207
+ stderrln('');
208
+ }
209
+
210
+ async function downloadBinary(name, url, destPath) {
211
+ const label = padEnd(` \u2b07 Downloading ${name}...`, 46);
212
+ stderr(label);
213
+
214
+ const { receivedBytes, totalBytes } = await downloadFile(url, destPath);
215
+ const size = formatBytes(totalBytes || receivedBytes);
216
+ stderrln(`\u2713 ${size}`);
217
+ }
218
+
219
+ async function main() {
220
+ let platform, arch;
221
+
222
+ try {
223
+ ({ platform, arch } = detectPlatform());
224
+ } catch (err) {
225
+ stderrln(`\n \u2717 ${err.message}\n`);
226
+ return;
227
+ }
228
+
229
+ const version = readPackageVersion();
230
+ const installDir = resolveInstallDir();
231
+
232
+ printHeader(platform, arch, version);
233
+
234
+ fs.mkdirSync(installDir, { recursive: true });
235
+
236
+ const suffix = platform === 'windows' ? '.exe' : '';
237
+ const binaries = [
238
+ {
239
+ name: 'mayla',
240
+ url: buildDownloadUrl('mayla', version, platform, arch),
241
+ dest: path.join(installDir, `mayla${suffix}`),
242
+ },
243
+ {
244
+ name: 'mayla-daemon',
245
+ url: buildDownloadUrl('mayla-daemon', version, platform, arch),
246
+ dest: path.join(installDir, `mayla-daemon${suffix}`),
247
+ },
248
+ ];
249
+
250
+ const existingBinaries = binaryExists(installDir, platform);
251
+ let downloadFailed = false;
252
+
253
+ for (const binary of binaries) {
254
+ try {
255
+ await downloadBinary(binary.name, binary.url, binary.dest);
256
+
257
+ if (platform !== 'windows') {
258
+ makeBinaryExecutable(binary.dest);
259
+ removeQuarantine(binary.dest);
260
+ }
261
+ } catch (err) {
262
+ downloadFailed = true;
263
+ stderrln(`\u2717 failed`);
264
+ stderrln(`\n \u26a0 Failed to download ${binary.name}: ${err.message}`);
265
+ }
266
+ }
267
+
268
+ if (downloadFailed) {
269
+ if (existingBinaries) {
270
+ stderrln('');
271
+ stderrln(' \u26a0 Download failed, but existing binaries were found.');
272
+ stderrln(' Using previously installed version.');
273
+ stderrln('');
274
+ } else {
275
+ stderrln('');
276
+ stderrln(' \u2717 Installation failed. No existing binaries found.');
277
+ stderrln('');
278
+ stderrln(' Manual installation:');
279
+ stderrln(' https://github.com/alucardeht/may-la-mcp/releases');
280
+ stderrln('');
281
+ return;
282
+ }
283
+ }
284
+
285
+ fs.writeFileSync(path.join(installDir, 'version'), `v${version}`, 'utf8');
286
+
287
+ stderrln('');
288
+ printSuccessBox(installDir);
289
+ }
290
+
291
+ main().catch((err) => {
292
+ stderrln(`\n \u2717 Unexpected error during installation: ${err.message}\n`);
293
+ });
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@alucardeht/may-la-mcp",
3
+ "version": "0.1.0",
4
+ "description": "High-performance MCP server for code navigation — powered by Go, installed via npm",
5
+ "bin": {
6
+ "may-la-mcp": "./cli.js"
7
+ },
8
+ "scripts": {
9
+ "postinstall": "node install.js"
10
+ },
11
+ "engines": {
12
+ "node": ">=18.0.0"
13
+ },
14
+ "os": ["darwin", "linux", "win32"],
15
+ "cpu": ["x64", "arm64"],
16
+ "files": [
17
+ "cli.js",
18
+ "install.js",
19
+ "LICENSE"
20
+ ],
21
+ "keywords": ["mcp", "code-navigation", "claude", "may-la", "model-context-protocol"],
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "https://github.com/alucardeht/may-la-mcp",
25
+ "directory": "npm"
26
+ },
27
+ "license": "Apache-2.0",
28
+ "author": "alucardeht",
29
+ "homepage": "https://github.com/alucardeht/may-la-mcp",
30
+ "publishConfig": {
31
+ "access": "public"
32
+ }
33
+ }