@wplaunchify/ml-mcp-server 2.4.8 → 2.4.10
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 +7 -4
- package/build/tools/fluent-crm.js +98 -0
- package/package.json +1 -1
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
|
-
|
|
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('
|
|
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
|
-
|
|
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
|
|
@@ -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
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wplaunchify/ml-mcp-server",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.10",
|
|
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",
|