@volute_cvc/cvc-mcp 0.1.0 โ†’ 0.3.5

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/bin/cvc-mcp.js CHANGED
@@ -44,7 +44,7 @@ function download(url, dest) {
44
44
  return new Promise((resolve, reject) => {
45
45
  const file = fs.createWriteStream(dest);
46
46
  https.get(url, (response) => {
47
- if (response.statusCode === 301 || response.statusCode === 302) {
47
+ if ([301, 302, 307, 308].includes(response.statusCode)) {
48
48
  return download(response.headers.location, dest).then(resolve).catch(reject);
49
49
  }
50
50
  if (response.statusCode !== 200) {
package/bin/cvc.js ADDED
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env node
2
+
3
+ const os = require('os');
4
+ const path = require('path');
5
+ const fs = require('fs');
6
+ const https = require('https');
7
+ const child_process = require('child_process');
8
+
9
+ const CACHE_DIR = path.join(os.homedir(), '.cvc', 'mcp-cache');
10
+
11
+ function getPlatformDetails() {
12
+ const platform = os.platform();
13
+ const arch = os.arch();
14
+
15
+ let osTag = '';
16
+ let archTag = '';
17
+
18
+ // Determine OS Tag
19
+ if (platform === 'linux') {
20
+ osTag = 'unknown-linux-gnu';
21
+ } else if (platform === 'darwin') {
22
+ osTag = 'apple-darwin';
23
+ } else if (platform === 'win32') {
24
+ osTag = 'pc-windows-msvc';
25
+ } else {
26
+ console.error(`Unsupported OS: ${platform}`);
27
+ process.exit(1);
28
+ }
29
+
30
+ // Determine Arch Tag
31
+ if (arch === 'x64') {
32
+ archTag = 'x86_64';
33
+ } else if (arch === 'arm64' || arch === 'aarch64') {
34
+ archTag = 'aarch64';
35
+ } else {
36
+ console.error(`Unsupported Architecture: ${arch}`);
37
+ process.exit(1);
38
+ }
39
+
40
+ return { platform, osTag, archTag };
41
+ }
42
+
43
+ function download(url, dest) {
44
+ return new Promise((resolve, reject) => {
45
+ const file = fs.createWriteStream(dest);
46
+ https.get(url, (response) => {
47
+ if ([301, 302, 307, 308].includes(response.statusCode)) {
48
+ return download(response.headers.location, dest).then(resolve).catch(reject);
49
+ }
50
+ if (response.statusCode !== 200) {
51
+ return reject(new Error(`Failed to download ${url}: ${response.statusCode}`));
52
+ }
53
+ response.pipe(file);
54
+ file.on('finish', () => {
55
+ file.close(resolve);
56
+ });
57
+ }).on('error', (err) => {
58
+ fs.unlink(dest, () => reject(err));
59
+ });
60
+ });
61
+ }
62
+
63
+ function extract(archivePath, destDir, platform) {
64
+ if (platform === 'win32') {
65
+ // Basic unzipping on windows using powershell
66
+ child_process.execSync(`powershell -Command "Expand-Archive -Path '${archivePath}' -DestinationPath '${destDir}' -Force"`, { stdio: 'inherit' });
67
+ } else {
68
+ // Assuming tar is available on Unix
69
+ child_process.execSync(`tar -xzf "${archivePath}" -C "${destDir}"`, { stdio: 'inherit' });
70
+ }
71
+ }
72
+
73
+ async function main() {
74
+ const { platform, osTag, archTag } = getPlatformDetails();
75
+ const ext = platform === 'win32' ? 'zip' : 'tar.gz';
76
+ const binName = platform === 'win32' ? 'cvc.exe' : 'cvc';
77
+ const assetName = `cvc-${archTag}-${osTag}.${ext}`;
78
+ const downloadUrl = `https://cvc.dev/api/download/${assetName}`;
79
+
80
+ const binPath = path.join(CACHE_DIR, binName);
81
+
82
+ if (!fs.existsSync(binPath)) {
83
+ console.error(`CVC CLI not found locally. Downloading from ${downloadUrl}...`);
84
+ fs.mkdirSync(CACHE_DIR, { recursive: true });
85
+ const tmpArchive = path.join(CACHE_DIR, assetName);
86
+
87
+ try {
88
+ await download(downloadUrl, tmpArchive);
89
+ console.error('Extracting...');
90
+ extract(tmpArchive, CACHE_DIR, platform);
91
+ fs.unlinkSync(tmpArchive); // Clean up archive
92
+ if (platform !== 'win32') {
93
+ fs.chmodSync(binPath, 0o755);
94
+ // Also ensure MCP and LSP are executable since they are extracted together
95
+ const mcpPath = path.join(CACHE_DIR, 'cvc-mcp');
96
+ const lspPath = path.join(CACHE_DIR, 'cvc-lsp');
97
+ if (fs.existsSync(mcpPath)) fs.chmodSync(mcpPath, 0o755);
98
+ if (fs.existsSync(lspPath)) fs.chmodSync(lspPath, 0o755);
99
+ }
100
+ console.error('Download and extraction complete.');
101
+ } catch (e) {
102
+ console.error(`Failed to install CVC CLI: ${e.message}`);
103
+ process.exit(1);
104
+ }
105
+ }
106
+
107
+ // Execute the binary
108
+ const args = process.argv.slice(2);
109
+ const child = child_process.spawn(binPath, args, {
110
+ stdio: 'inherit'
111
+ });
112
+
113
+ child.on('close', (code) => {
114
+ process.exit(code);
115
+ });
116
+ }
117
+
118
+ main().catch(e => {
119
+ console.error(e);
120
+ process.exit(1);
121
+ });
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@volute_cvc/cvc-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.3.5",
4
4
  "description": "CVC Model Context Protocol Server",
5
5
  "bin": {
6
- "cvc-mcp": "./bin/cvc-mcp.js"
6
+ "cvc-mcp": "./bin/cvc-mcp.js",
7
+ "cvc": "./bin/cvc.js"
7
8
  },
8
9
  "scripts": {
9
10
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -13,7 +14,7 @@
13
14
  "url": "git+https://github.com/meirka8/cvc.git"
14
15
  },
15
16
  "author": "Volute",
16
- "license": "ISC",
17
+ "license": "UNLICENSED",
17
18
  "publishConfig": {
18
19
  "access": "public"
19
20
  }
@@ -0,0 +1,29 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ LOCAL_INSTALL=false
5
+ if [ "$1" == "--local" ]; then
6
+ LOCAL_INSTALL=true
7
+ fi
8
+
9
+ echo "๐Ÿงน Cleaning up global cvc-mcp installation..."
10
+ npm uninstall -g @volute_cvc/cvc-mcp || true
11
+
12
+ echo "๐Ÿ—‘๏ธ Removing downloaded binary cache..."
13
+ rm -rf ~/.cvc/mcp-cache
14
+
15
+ if [ "$LOCAL_INSTALL" = true ]; then
16
+ echo "๐Ÿ“ฆ Packing local npm package..."
17
+ cd "$(dirname "$0")"
18
+ TARBALL=$(npm pack)
19
+
20
+ echo "๐Ÿš€ Installing local tarball globally..."
21
+ npm install -g "./$TARBALL"
22
+ else
23
+ echo "๐Ÿš€ Installing from NPM registry..."
24
+ npm install -g @volute_cvc/cvc-mcp
25
+ fi
26
+
27
+ echo "โœ… Installed successfully!"
28
+ echo "You can now test the CLI by running: cvc --version"
29
+ echo "And test the MCP server by running: cvc-mcp"