@wplaunchify/ml-mcp-server 2.4.7 → 2.4.9

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.
@@ -59,6 +59,18 @@ const createCampaignSchema = z.object({
59
59
  status: z.enum(['draft', 'scheduled']).optional(),
60
60
  scheduled_at: z.string().optional(),
61
61
  });
62
+ // Template schemas
63
+ const listTemplatesSchema = z.object({
64
+ page: z.number().optional(),
65
+ per_page: z.number().optional(),
66
+ search: z.string().optional(),
67
+ });
68
+ const createTemplateSchema = z.object({
69
+ post_title: z.string(),
70
+ post_content: z.string(),
71
+ email_subject: z.string().optional(),
72
+ design_template: z.enum(['simple', 'plain', 'classic', 'raw_classic', 'raw_html']).optional(),
73
+ });
62
74
  // ==================== TOOL DEFINITIONS ====================
63
75
  export const fluentCRMTools = [
64
76
  // Contact Management
@@ -177,6 +189,38 @@ export const fluentCRMTools = [
177
189
  scheduled_at: z.string().optional(),
178
190
  }).shape }
179
191
  },
192
+ // Template Management
193
+ {
194
+ name: 'fcrm_list_templates',
195
+ description: 'List all FluentCRM email templates',
196
+ inputSchema: { type: 'object', properties: listTemplatesSchema.shape }
197
+ },
198
+ {
199
+ name: 'fcrm_get_template',
200
+ description: 'Get a specific FluentCRM email template by ID',
201
+ inputSchema: { type: 'object', properties: z.object({ id: z.number() }).shape }
202
+ },
203
+ {
204
+ name: 'fcrm_create_template',
205
+ description: 'Create a new FluentCRM email template',
206
+ inputSchema: { type: 'object', properties: createTemplateSchema.shape }
207
+ },
208
+ {
209
+ name: 'fcrm_update_template',
210
+ description: 'Update an existing FluentCRM email template',
211
+ inputSchema: { type: 'object', properties: z.object({
212
+ id: z.number(),
213
+ post_title: z.string().optional(),
214
+ post_content: z.string().optional(),
215
+ email_subject: z.string().optional(),
216
+ design_template: z.enum(['simple', 'plain', 'classic', 'raw_classic', 'raw_html']).optional(),
217
+ }).shape }
218
+ },
219
+ {
220
+ name: 'fcrm_delete_template',
221
+ description: 'Delete a FluentCRM email template',
222
+ inputSchema: { type: 'object', properties: z.object({ id: z.number() }).shape }
223
+ },
180
224
  ];
181
225
  // ==================== TOOL HANDLERS ====================
182
226
  export const fluentCRMHandlers = {
@@ -389,4 +433,58 @@ export const fluentCRMHandlers = {
389
433
  return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
390
434
  }
391
435
  },
436
+ // Template handlers
437
+ fcrm_list_templates: async (args) => {
438
+ try {
439
+ const params = new URLSearchParams();
440
+ if (args.page)
441
+ params.append('page', args.page);
442
+ if (args.per_page)
443
+ params.append('per_page', args.per_page);
444
+ if (args.search)
445
+ params.append('search', args.search);
446
+ const response = await makeWordPressRequest('GET', `fc-manager/v1/fcrm/templates?${params}`);
447
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
448
+ }
449
+ catch (error) {
450
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
451
+ }
452
+ },
453
+ fcrm_get_template: async (args) => {
454
+ try {
455
+ const response = await makeWordPressRequest('GET', `fc-manager/v1/fcrm/templates/${args.id}`);
456
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
457
+ }
458
+ catch (error) {
459
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
460
+ }
461
+ },
462
+ fcrm_create_template: async (args) => {
463
+ try {
464
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/fcrm/templates', args);
465
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
466
+ }
467
+ catch (error) {
468
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
469
+ }
470
+ },
471
+ fcrm_update_template: async (args) => {
472
+ try {
473
+ const { id, ...data } = args;
474
+ const response = await makeWordPressRequest('PUT', `fc-manager/v1/fcrm/templates/${id}`, data);
475
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
476
+ }
477
+ catch (error) {
478
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
479
+ }
480
+ },
481
+ fcrm_delete_template: async (args) => {
482
+ try {
483
+ const response = await makeWordPressRequest('DELETE', `fc-manager/v1/fcrm/templates/${args.id}`);
484
+ return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
485
+ }
486
+ catch (error) {
487
+ return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
488
+ }
489
+ },
392
490
  };
@@ -42,14 +42,22 @@ export async function initWordPress() {
42
42
  };
43
43
  }
44
44
  wpClient = axios.create(config);
45
- // Verify connection to WordPress API
46
- try {
47
- await wpClient.get('');
48
- logToFile('Successfully connected to WordPress API');
45
+ // Optionally verify connection to WordPress API (don't crash if it fails)
46
+ // This prevents startup crashes when multiple servers start simultaneously
47
+ const skipInitCheck = process.env.SKIP_INIT_CHECK === 'true';
48
+ if (!skipInitCheck) {
49
+ try {
50
+ await wpClient.get('');
51
+ logToFile('Successfully connected to WordPress API');
52
+ }
53
+ catch (error) {
54
+ logToFile(`Warning: Failed to verify WordPress API connection: ${error.message}`);
55
+ logToFile('Server will continue anyway. Connection will be verified on first tool call.');
56
+ // Don't throw - let the server start and fail gracefully on first tool call if needed
57
+ }
49
58
  }
50
- catch (error) {
51
- logToFile(`Failed to connect to WordPress API: ${error.message}`);
52
- throw new Error(`Failed to connect to WordPress API: ${error.message}`);
59
+ else {
60
+ logToFile('Skipping WordPress API connection verification (SKIP_INIT_CHECK=true)');
53
61
  }
54
62
  }
55
63
  // Configure logging
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wplaunchify/ml-mcp-server",
3
- "version": "2.4.7",
3
+ "version": "2.4.9",
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",