@wplaunchify/ml-mcp-server 2.5.7 → 2.5.8

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.
@@ -19,6 +19,9 @@ export declare function makeWordPressRequest(method: string, endpoint: string, d
19
19
  /**
20
20
  * Detect which plugins are installed and active
21
21
  * Returns a set of plugin slugs that are active
22
+ *
23
+ * IMPORTANT: This function makes an HTTP request and should NOT block server startup.
24
+ * It has a timeout and fails gracefully to prevent Claude Desktop crashes.
22
25
  */
23
26
  export declare function detectInstalledPlugins(): Promise<Set<string>>;
24
27
  /**
@@ -148,25 +148,45 @@ Data: ${JSON.stringify(error.response?.data || {}, null, 2)}
148
148
  /**
149
149
  * Detect which plugins are installed and active
150
150
  * Returns a set of plugin slugs that are active
151
+ *
152
+ * IMPORTANT: This function makes an HTTP request and should NOT block server startup.
153
+ * It has a timeout and fails gracefully to prevent Claude Desktop crashes.
151
154
  */
152
155
  export async function detectInstalledPlugins() {
153
156
  const installedPlugins = new Set();
157
+ // Check if plugin detection should be skipped
158
+ const skipDetection = process.env.SKIP_PLUGIN_DETECTION === 'true';
159
+ if (skipDetection) {
160
+ logToFile('Plugin detection skipped (SKIP_PLUGIN_DETECTION=true)');
161
+ return installedPlugins; // Return empty set - will load all tools
162
+ }
154
163
  try {
155
- // Get list of active plugins
156
- const response = await makeWordPressRequest('GET', 'wp/v2/plugins', { status: 'active' });
157
- if (Array.isArray(response)) {
158
- response.forEach((plugin) => {
159
- // Extract plugin slug from plugin path (e.g., "fluent-crm/fluent-crm.php" -> "fluent-crm")
160
- const slug = plugin.plugin?.split('/')[0] || plugin.slug;
161
- if (slug) {
162
- installedPlugins.add(slug);
163
- }
164
- });
165
- }
166
- logToFile(`Detected active plugins: ${Array.from(installedPlugins).join(', ')}`);
164
+ // Add timeout to prevent blocking server startup
165
+ const timeoutMs = 3000; // 3 seconds max
166
+ const timeoutPromise = new Promise((_, reject) => {
167
+ setTimeout(() => reject(new Error('Plugin detection timeout')), timeoutMs);
168
+ });
169
+ const detectionPromise = (async () => {
170
+ // Get list of active plugins
171
+ const response = await makeWordPressRequest('GET', 'wp/v2/plugins', { status: 'active' });
172
+ if (Array.isArray(response)) {
173
+ response.forEach((plugin) => {
174
+ // Extract plugin slug from plugin path (e.g., "fluent-crm/fluent-crm.php" -> "fluent-crm")
175
+ const slug = plugin.plugin?.split('/')[0] || plugin.slug;
176
+ if (slug) {
177
+ installedPlugins.add(slug);
178
+ }
179
+ });
180
+ }
181
+ return installedPlugins;
182
+ })();
183
+ // Race between detection and timeout
184
+ await Promise.race([detectionPromise, timeoutPromise]);
185
+ logToFile(`✓ Detected active plugins: ${Array.from(installedPlugins).join(', ')}`);
167
186
  }
168
187
  catch (error) {
169
188
  // Silently fail - if we can't detect plugins, we'll load all tools
189
+ // This prevents server crashes when WordPress is slow or endpoint requires auth
170
190
  logToFile(`Plugin detection failed (will load all tools): ${error.message}`);
171
191
  }
172
192
  return installedPlugins;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wplaunchify/ml-mcp-server",
3
- "version": "2.5.7",
3
+ "version": "2.5.8",
4
4
  "description": "Universal MCP Server for WordPress + Fluent Suite (Community, CRM, Cart) + FluentMCP Pro. Comprehensive tools for AI-powered WordPress management via Claude, Cursor, and other MCP clients.",
5
5
  "type": "module",
6
6
  "main": "./build/server.js",