@wplaunchify/ml-mcp-server 2.4.9 → 2.4.11

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/build/server.js CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  // src/server.ts
3
3
  import * as dotenv from 'dotenv';
4
- dotenv.config(); // Load environment variables from .env first
4
+ // Load environment variables from .env file if it exists (optional for npx usage)
5
+ dotenv.config({ path: '.env' });
5
6
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
7
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
8
  import { allTools, toolHandlers } from './tools/index.js';
@@ -88,9 +89,10 @@ console.error(`✅ Registered ${registeredCount} of ${allTools.length} tools`);
88
89
  async function main() {
89
90
  const { logToFile } = await import('./wordpress.js');
90
91
  logToFile('Starting WordPress MCP server...');
92
+ // Environment variables are passed by MCP client (Claude Desktop, Cursor, etc.)
93
+ // Don't exit here - let initWordPress() handle the validation
91
94
  if (!process.env.WORDPRESS_API_URL) {
92
- logToFile('Missing required environment variables. Please check your .env file.');
93
- process.exit(1);
95
+ logToFile('Warning: WORDPRESS_API_URL not set. Will fail on first tool call if not provided by MCP client.');
94
96
  }
95
97
  try {
96
98
  logToFile('Initializing WordPress client...');
@@ -104,7 +106,8 @@ async function main() {
104
106
  }
105
107
  catch (error) {
106
108
  logToFile(`Failed to initialize server: ${error}`);
107
- process.exit(1);
109
+ // Don't exit immediately - let the MCP client handle the error
110
+ throw error;
108
111
  }
109
112
  }
110
113
  // Handle process signals and errors
@@ -240,7 +240,8 @@ export const fluentCRMHandlers = {
240
240
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
241
241
  }
242
242
  catch (error) {
243
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
243
+ const errorMessage = error.response?.data?.message || error.message;
244
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
244
245
  }
245
246
  },
246
247
  fcrm_get_contact: async (args) => {
@@ -249,7 +250,8 @@ export const fluentCRMHandlers = {
249
250
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
250
251
  }
251
252
  catch (error) {
252
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
253
+ const errorMessage = error.response?.data?.message || error.message;
254
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
253
255
  }
254
256
  },
255
257
  fcrm_create_contact: async (args) => {
@@ -258,7 +260,8 @@ export const fluentCRMHandlers = {
258
260
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
259
261
  }
260
262
  catch (error) {
261
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
263
+ const errorMessage = error.response?.data?.message || error.message;
264
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
262
265
  }
263
266
  },
264
267
  fcrm_update_contact: async (args) => {
@@ -268,7 +271,8 @@ export const fluentCRMHandlers = {
268
271
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
269
272
  }
270
273
  catch (error) {
271
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
274
+ const errorMessage = error.response?.data?.message || error.message;
275
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
272
276
  }
273
277
  },
274
278
  fcrm_delete_contact: async (args) => {
@@ -277,7 +281,8 @@ export const fluentCRMHandlers = {
277
281
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
278
282
  }
279
283
  catch (error) {
280
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
284
+ const errorMessage = error.response?.data?.message || error.message;
285
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
281
286
  }
282
287
  },
283
288
  // List handlers
@@ -294,7 +299,8 @@ export const fluentCRMHandlers = {
294
299
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
295
300
  }
296
301
  catch (error) {
297
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
302
+ const errorMessage = error.response?.data?.message || error.message;
303
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
298
304
  }
299
305
  },
300
306
  fcrm_get_list: async (args) => {
@@ -303,7 +309,8 @@ export const fluentCRMHandlers = {
303
309
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
304
310
  }
305
311
  catch (error) {
306
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
312
+ const errorMessage = error.response?.data?.message || error.message;
313
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
307
314
  }
308
315
  },
309
316
  fcrm_create_list: async (args) => {
@@ -312,7 +319,8 @@ export const fluentCRMHandlers = {
312
319
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
313
320
  }
314
321
  catch (error) {
315
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
322
+ const errorMessage = error.response?.data?.message || error.message;
323
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
316
324
  }
317
325
  },
318
326
  fcrm_update_list: async (args) => {
@@ -322,7 +330,8 @@ export const fluentCRMHandlers = {
322
330
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
323
331
  }
324
332
  catch (error) {
325
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
333
+ const errorMessage = error.response?.data?.message || error.message;
334
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
326
335
  }
327
336
  },
328
337
  fcrm_delete_list: async (args) => {
@@ -331,7 +340,8 @@ export const fluentCRMHandlers = {
331
340
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
332
341
  }
333
342
  catch (error) {
334
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
343
+ const errorMessage = error.response?.data?.message || error.message;
344
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
335
345
  }
336
346
  },
337
347
  // Tag handlers
@@ -348,7 +358,8 @@ export const fluentCRMHandlers = {
348
358
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
349
359
  }
350
360
  catch (error) {
351
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
361
+ const errorMessage = error.response?.data?.message || error.message;
362
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
352
363
  }
353
364
  },
354
365
  fcrm_get_tag: async (args) => {
@@ -357,7 +368,8 @@ export const fluentCRMHandlers = {
357
368
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
358
369
  }
359
370
  catch (error) {
360
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
371
+ const errorMessage = error.response?.data?.message || error.message;
372
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
361
373
  }
362
374
  },
363
375
  fcrm_create_tag: async (args) => {
@@ -366,7 +378,8 @@ export const fluentCRMHandlers = {
366
378
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
367
379
  }
368
380
  catch (error) {
369
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
381
+ const errorMessage = error.response?.data?.message || error.message;
382
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
370
383
  }
371
384
  },
372
385
  fcrm_update_tag: async (args) => {
@@ -376,7 +389,8 @@ export const fluentCRMHandlers = {
376
389
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
377
390
  }
378
391
  catch (error) {
379
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
392
+ const errorMessage = error.response?.data?.message || error.message;
393
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
380
394
  }
381
395
  },
382
396
  fcrm_delete_tag: async (args) => {
@@ -385,7 +399,8 @@ export const fluentCRMHandlers = {
385
399
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
386
400
  }
387
401
  catch (error) {
388
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
402
+ const errorMessage = error.response?.data?.message || error.message;
403
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
389
404
  }
390
405
  },
391
406
  // Campaign handlers
@@ -402,7 +417,8 @@ export const fluentCRMHandlers = {
402
417
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
403
418
  }
404
419
  catch (error) {
405
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
420
+ const errorMessage = error.response?.data?.message || error.message;
421
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
406
422
  }
407
423
  },
408
424
  fcrm_get_campaign: async (args) => {
@@ -411,7 +427,8 @@ export const fluentCRMHandlers = {
411
427
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
412
428
  }
413
429
  catch (error) {
414
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
430
+ const errorMessage = error.response?.data?.message || error.message;
431
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
415
432
  }
416
433
  },
417
434
  fcrm_create_campaign: async (args) => {
@@ -420,7 +437,8 @@ export const fluentCRMHandlers = {
420
437
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
421
438
  }
422
439
  catch (error) {
423
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
440
+ const errorMessage = error.response?.data?.message || error.message;
441
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
424
442
  }
425
443
  },
426
444
  fcrm_send_campaign: async (args) => {
@@ -430,7 +448,8 @@ export const fluentCRMHandlers = {
430
448
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
431
449
  }
432
450
  catch (error) {
433
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
451
+ const errorMessage = error.response?.data?.message || error.message;
452
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
434
453
  }
435
454
  },
436
455
  // Template handlers
@@ -447,7 +466,8 @@ export const fluentCRMHandlers = {
447
466
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
448
467
  }
449
468
  catch (error) {
450
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
469
+ const errorMessage = error.response?.data?.message || error.message;
470
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
451
471
  }
452
472
  },
453
473
  fcrm_get_template: async (args) => {
@@ -456,7 +476,8 @@ export const fluentCRMHandlers = {
456
476
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
457
477
  }
458
478
  catch (error) {
459
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
479
+ const errorMessage = error.response?.data?.message || error.message;
480
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
460
481
  }
461
482
  },
462
483
  fcrm_create_template: async (args) => {
@@ -465,7 +486,8 @@ export const fluentCRMHandlers = {
465
486
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
466
487
  }
467
488
  catch (error) {
468
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
489
+ const errorMessage = error.response?.data?.message || error.message;
490
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
469
491
  }
470
492
  },
471
493
  fcrm_update_template: async (args) => {
@@ -475,7 +497,8 @@ export const fluentCRMHandlers = {
475
497
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
476
498
  }
477
499
  catch (error) {
478
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
500
+ const errorMessage = error.response?.data?.message || error.message;
501
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
479
502
  }
480
503
  },
481
504
  fcrm_delete_template: async (args) => {
@@ -484,7 +507,8 @@ export const fluentCRMHandlers = {
484
507
  return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
485
508
  }
486
509
  catch (error) {
487
- return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
510
+ const errorMessage = error.response?.data?.message || error.message;
511
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${errorMessage}` }] } };
488
512
  }
489
513
  },
490
514
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wplaunchify/ml-mcp-server",
3
- "version": "2.4.9",
3
+ "version": "2.4.11",
4
4
  "description": "Universal MCP Server for WordPress + Fluent Suite (Community, CRM, Cart) + MinuteLaunch Plugins. Comprehensive tools for AI-powered WordPress management via Claude, Cursor, and other MCP clients.",
5
5
  "type": "module",
6
6
  "main": "./build/server.js",