fastmode-mcp 1.0.0 → 1.0.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/package.json CHANGED
@@ -1,17 +1,16 @@
1
1
  {
2
2
  "name": "fastmode-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "MCP server for FastMode CMS. Convert websites, validate packages, and deploy directly to FastMode. Includes authentication, project creation, schema sync, and one-click deployment.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
7
- "fastmode-mcp": "./bin/run.js"
7
+ "fastmode-mcp": "./dist/index.js"
8
8
  },
9
9
  "type": "commonjs",
10
10
  "scripts": {
11
11
  "build": "NODE_OPTIONS='--max-old-space-size=4096' tsc --skipLibCheck && chmod +x dist/index.js",
12
12
  "dev": "ts-node src/index.ts",
13
- "start": "node dist/index.js",
14
- "postinstall": "node scripts/postinstall.js"
13
+ "start": "node dist/index.js"
15
14
  },
16
15
  "keywords": [
17
16
  "mcp",
package/bin/run.js DELETED
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Entry point that tries to run the native binary first, then falls back to Node.js.
4
- * This allows the MCP server to work regardless of how Node.js is installed.
5
- */
6
- const { spawn } = require('child_process');
7
- const path = require('path');
8
- const fs = require('fs');
9
-
10
- const BINARY_NAME = 'fastmode-mcp';
11
-
12
- function getNativeBinaryPath() {
13
- const ext = process.platform === 'win32' ? '.exe' : '';
14
- const binaryPath = path.join(__dirname, `${BINARY_NAME}${ext}`);
15
-
16
- if (fs.existsSync(binaryPath)) {
17
- return binaryPath;
18
- }
19
-
20
- return null;
21
- }
22
-
23
- function runNativeBinary(binaryPath) {
24
- const child = spawn(binaryPath, process.argv.slice(2), {
25
- stdio: 'inherit',
26
- env: process.env,
27
- });
28
-
29
- child.on('error', (error) => {
30
- console.error(`Failed to run native binary: ${error.message}`);
31
- runNodeFallback();
32
- });
33
-
34
- child.on('exit', (code) => {
35
- process.exit(code || 0);
36
- });
37
- }
38
-
39
- function runNodeFallback() {
40
- // Fall back to the Node.js version
41
- require('../dist/index.js');
42
- }
43
-
44
- const nativeBinary = getNativeBinaryPath();
45
-
46
- if (nativeBinary) {
47
- runNativeBinary(nativeBinary);
48
- } else {
49
- runNodeFallback();
50
- }
@@ -1,129 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Postinstall script that downloads the correct prebuilt binary for the current platform.
4
- * This allows the MCP server to run without Node.js in the PATH.
5
- */
6
- const https = require('https');
7
- const fs = require('fs');
8
- const path = require('path');
9
-
10
- const PACKAGE_NAME = 'fastmode-mcp';
11
- const BINARY_NAME = 'fastmode-mcp';
12
-
13
- // Get package version from package.json
14
- const packageJson = require('../package.json');
15
- const VERSION = packageJson.version;
16
-
17
- // Platform/arch mapping
18
- const PLATFORM_MAP = {
19
- 'darwin-arm64': 'macos-arm64',
20
- 'darwin-x64': 'macos-x64',
21
- 'linux-arm64': 'linux-arm64',
22
- 'linux-x64': 'linux-x64',
23
- 'win32-x64': 'win-x64',
24
- 'win32-arm64': 'win-arm64',
25
- };
26
-
27
- function getPlatformKey() {
28
- const platform = process.platform;
29
- const arch = process.arch;
30
- return `${platform}-${arch}`;
31
- }
32
-
33
- function getBinaryUrl(version, platformKey) {
34
- const platformSuffix = PLATFORM_MAP[platformKey];
35
- if (!platformSuffix) {
36
- return null;
37
- }
38
-
39
- const ext = process.platform === 'win32' ? '.exe' : '';
40
- const filename = `${BINARY_NAME}-${platformSuffix}${ext}`;
41
-
42
- // Download from GitHub Releases (public repo for binaries)
43
- return `https://github.com/arihgoldstein/fastmode-mcp/releases/download/v${version}/${filename}`;
44
- }
45
-
46
- function downloadFile(url, destPath) {
47
- return new Promise((resolve, reject) => {
48
- const file = fs.createWriteStream(destPath);
49
-
50
- const request = (url) => {
51
- https.get(url, (response) => {
52
- // Handle redirects
53
- if (response.statusCode === 301 || response.statusCode === 302) {
54
- request(response.headers.location);
55
- return;
56
- }
57
-
58
- if (response.statusCode === 404) {
59
- file.close();
60
- fs.unlinkSync(destPath);
61
- reject(new Error(`Binary not found at ${url}`));
62
- return;
63
- }
64
-
65
- if (response.statusCode !== 200) {
66
- file.close();
67
- fs.unlinkSync(destPath);
68
- reject(new Error(`Failed to download: ${response.statusCode}`));
69
- return;
70
- }
71
-
72
- response.pipe(file);
73
- file.on('finish', () => {
74
- file.close();
75
- resolve();
76
- });
77
- }).on('error', (err) => {
78
- file.close();
79
- fs.unlinkSync(destPath);
80
- reject(err);
81
- });
82
- };
83
-
84
- request(url);
85
- });
86
- }
87
-
88
- async function main() {
89
- const platformKey = getPlatformKey();
90
- const binaryUrl = getBinaryUrl(VERSION, platformKey);
91
-
92
- if (!binaryUrl) {
93
- console.log(`No prebuilt binary available for ${platformKey}`);
94
- console.log('Falling back to Node.js execution');
95
- return;
96
- }
97
-
98
- const binDir = path.join(__dirname, '..', 'bin');
99
- const ext = process.platform === 'win32' ? '.exe' : '';
100
- const binaryPath = path.join(binDir, `${BINARY_NAME}${ext}`);
101
-
102
- // Create bin directory if it doesn't exist
103
- if (!fs.existsSync(binDir)) {
104
- fs.mkdirSync(binDir, { recursive: true });
105
- }
106
-
107
- console.log(`Downloading ${PACKAGE_NAME} binary for ${platformKey}...`);
108
-
109
- try {
110
- await downloadFile(binaryUrl, binaryPath);
111
-
112
- // Make executable on Unix
113
- if (process.platform !== 'win32') {
114
- fs.chmodSync(binaryPath, 0o755);
115
- }
116
-
117
- console.log(`Successfully installed ${BINARY_NAME} binary`);
118
- } catch (error) {
119
- // Binary download failed - this is OK, we'll fall back to Node.js
120
- console.log(`Binary download failed: ${error.message}`);
121
- console.log('Falling back to Node.js execution');
122
- }
123
- }
124
-
125
- main().catch((error) => {
126
- // Don't fail the install if binary download fails
127
- console.error('Postinstall warning:', error.message);
128
- process.exit(0);
129
- });