@wplaunchify/ml-mcp-server 2.5.2 → 2.5.5
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 +25 -12
- package/build/tools/ml-simple-site.d.ts +173 -0
- package/build/tools/ml-simple-site.js +232 -0
- package/package.json +1 -1
package/build/server.js
CHANGED
|
@@ -61,15 +61,27 @@ for (const tool of allTools) {
|
|
|
61
61
|
continue;
|
|
62
62
|
}
|
|
63
63
|
const wrappedHandler = async (args) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
try {
|
|
65
|
+
// The handler functions are already typed with their specific parameter types
|
|
66
|
+
const result = await handler(args);
|
|
67
|
+
return {
|
|
68
|
+
content: result.toolResult.content.map((item) => ({
|
|
69
|
+
...item,
|
|
70
|
+
type: "text"
|
|
71
|
+
})),
|
|
72
|
+
isError: result.toolResult.isError
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
// Return error as tool result instead of throwing
|
|
77
|
+
return {
|
|
78
|
+
content: [{
|
|
79
|
+
type: "text",
|
|
80
|
+
text: `Error executing ${tool.name}: ${error.message || String(error)}`
|
|
81
|
+
}],
|
|
82
|
+
isError: true
|
|
83
|
+
};
|
|
84
|
+
}
|
|
73
85
|
};
|
|
74
86
|
// console.log(`Registering tool: ${tool.name}`);
|
|
75
87
|
// console.log(`Input schema: ${JSON.stringify(tool.inputSchema)}`);
|
|
@@ -110,7 +122,7 @@ async function main() {
|
|
|
110
122
|
throw error;
|
|
111
123
|
}
|
|
112
124
|
}
|
|
113
|
-
// Handle process signals
|
|
125
|
+
// Handle process signals gracefully
|
|
114
126
|
process.on('SIGTERM', () => {
|
|
115
127
|
console.log('Received SIGTERM signal, shutting down...');
|
|
116
128
|
process.exit(0);
|
|
@@ -119,13 +131,14 @@ process.on('SIGINT', () => {
|
|
|
119
131
|
console.log('Received SIGINT signal, shutting down...');
|
|
120
132
|
process.exit(0);
|
|
121
133
|
});
|
|
134
|
+
// Log errors but don't kill the server - let MCP SDK handle tool errors gracefully
|
|
122
135
|
process.on('uncaughtException', (error) => {
|
|
123
136
|
console.error('Uncaught exception:', error);
|
|
124
|
-
|
|
137
|
+
// Don't exit - let the server continue running
|
|
125
138
|
});
|
|
126
139
|
process.on('unhandledRejection', (error) => {
|
|
127
140
|
console.error('Unhandled rejection:', error);
|
|
128
|
-
|
|
141
|
+
// Don't exit - let the server continue running
|
|
129
142
|
});
|
|
130
143
|
main().catch((error) => {
|
|
131
144
|
console.error('Startup error:', error);
|
|
@@ -106,6 +106,60 @@ export declare const mlSimpleSiteTools: ({
|
|
|
106
106
|
hide_from_nav: z.ZodOptional<z.ZodBoolean>;
|
|
107
107
|
};
|
|
108
108
|
};
|
|
109
|
+
} | {
|
|
110
|
+
name: string;
|
|
111
|
+
description: string;
|
|
112
|
+
inputSchema: {
|
|
113
|
+
type: "object";
|
|
114
|
+
properties: {
|
|
115
|
+
block_order: z.ZodArray<z.ZodNumber, "many">;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
} | {
|
|
119
|
+
name: string;
|
|
120
|
+
description: string;
|
|
121
|
+
inputSchema: {
|
|
122
|
+
type: "object";
|
|
123
|
+
properties: {
|
|
124
|
+
block_index: z.ZodNumber;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
} | {
|
|
128
|
+
name: string;
|
|
129
|
+
description: string;
|
|
130
|
+
inputSchema: {
|
|
131
|
+
type: "object";
|
|
132
|
+
properties: {
|
|
133
|
+
email: z.ZodString;
|
|
134
|
+
full_name: z.ZodOptional<z.ZodString>;
|
|
135
|
+
first_name: z.ZodOptional<z.ZodString>;
|
|
136
|
+
last_name: z.ZodOptional<z.ZodString>;
|
|
137
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
138
|
+
company: z.ZodOptional<z.ZodString>;
|
|
139
|
+
title: z.ZodOptional<z.ZodString>;
|
|
140
|
+
location: z.ZodOptional<z.ZodString>;
|
|
141
|
+
list_id: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
} | {
|
|
146
|
+
name: string;
|
|
147
|
+
description: string;
|
|
148
|
+
inputSchema: {
|
|
149
|
+
type: "object";
|
|
150
|
+
properties: {
|
|
151
|
+
revision_index: z.ZodNumber;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
} | {
|
|
155
|
+
name: string;
|
|
156
|
+
description: string;
|
|
157
|
+
inputSchema: {
|
|
158
|
+
type: "object";
|
|
159
|
+
properties: {
|
|
160
|
+
description: z.ZodOptional<z.ZodString>;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
109
163
|
})[];
|
|
110
164
|
export declare const mlSimpleSiteHandlers: {
|
|
111
165
|
mlss_get_site: (args: any) => Promise<{
|
|
@@ -193,4 +247,123 @@ export declare const mlSimpleSiteHandlers: {
|
|
|
193
247
|
}[];
|
|
194
248
|
};
|
|
195
249
|
}>;
|
|
250
|
+
mlss_edit_block: (args: any) => Promise<{
|
|
251
|
+
toolResult: {
|
|
252
|
+
content: {
|
|
253
|
+
type: string;
|
|
254
|
+
text: string;
|
|
255
|
+
}[];
|
|
256
|
+
isError?: undefined;
|
|
257
|
+
};
|
|
258
|
+
} | {
|
|
259
|
+
toolResult: {
|
|
260
|
+
isError: boolean;
|
|
261
|
+
content: {
|
|
262
|
+
type: string;
|
|
263
|
+
text: string;
|
|
264
|
+
}[];
|
|
265
|
+
};
|
|
266
|
+
}>;
|
|
267
|
+
mlss_reorder_blocks: (args: any) => Promise<{
|
|
268
|
+
toolResult: {
|
|
269
|
+
content: {
|
|
270
|
+
type: string;
|
|
271
|
+
text: string;
|
|
272
|
+
}[];
|
|
273
|
+
isError?: undefined;
|
|
274
|
+
};
|
|
275
|
+
} | {
|
|
276
|
+
toolResult: {
|
|
277
|
+
isError: boolean;
|
|
278
|
+
content: {
|
|
279
|
+
type: string;
|
|
280
|
+
text: string;
|
|
281
|
+
}[];
|
|
282
|
+
};
|
|
283
|
+
}>;
|
|
284
|
+
mlss_delete_block: (args: any) => Promise<{
|
|
285
|
+
toolResult: {
|
|
286
|
+
content: {
|
|
287
|
+
type: string;
|
|
288
|
+
text: string;
|
|
289
|
+
}[];
|
|
290
|
+
isError?: undefined;
|
|
291
|
+
};
|
|
292
|
+
} | {
|
|
293
|
+
toolResult: {
|
|
294
|
+
isError: boolean;
|
|
295
|
+
content: {
|
|
296
|
+
type: string;
|
|
297
|
+
text: string;
|
|
298
|
+
}[];
|
|
299
|
+
};
|
|
300
|
+
}>;
|
|
301
|
+
mlss_create_contact: (args: any) => Promise<{
|
|
302
|
+
toolResult: {
|
|
303
|
+
content: {
|
|
304
|
+
type: string;
|
|
305
|
+
text: string;
|
|
306
|
+
}[];
|
|
307
|
+
isError?: undefined;
|
|
308
|
+
};
|
|
309
|
+
} | {
|
|
310
|
+
toolResult: {
|
|
311
|
+
isError: boolean;
|
|
312
|
+
content: {
|
|
313
|
+
type: string;
|
|
314
|
+
text: string;
|
|
315
|
+
}[];
|
|
316
|
+
};
|
|
317
|
+
}>;
|
|
318
|
+
mlss_get_revisions: (args: any) => Promise<{
|
|
319
|
+
toolResult: {
|
|
320
|
+
content: {
|
|
321
|
+
type: string;
|
|
322
|
+
text: string;
|
|
323
|
+
}[];
|
|
324
|
+
isError?: undefined;
|
|
325
|
+
};
|
|
326
|
+
} | {
|
|
327
|
+
toolResult: {
|
|
328
|
+
isError: boolean;
|
|
329
|
+
content: {
|
|
330
|
+
type: string;
|
|
331
|
+
text: string;
|
|
332
|
+
}[];
|
|
333
|
+
};
|
|
334
|
+
}>;
|
|
335
|
+
mlss_restore_revision: (args: any) => Promise<{
|
|
336
|
+
toolResult: {
|
|
337
|
+
content: {
|
|
338
|
+
type: string;
|
|
339
|
+
text: string;
|
|
340
|
+
}[];
|
|
341
|
+
isError?: undefined;
|
|
342
|
+
};
|
|
343
|
+
} | {
|
|
344
|
+
toolResult: {
|
|
345
|
+
isError: boolean;
|
|
346
|
+
content: {
|
|
347
|
+
type: string;
|
|
348
|
+
text: string;
|
|
349
|
+
}[];
|
|
350
|
+
};
|
|
351
|
+
}>;
|
|
352
|
+
mlss_save_revision: (args: any) => Promise<{
|
|
353
|
+
toolResult: {
|
|
354
|
+
content: {
|
|
355
|
+
type: string;
|
|
356
|
+
text: string;
|
|
357
|
+
}[];
|
|
358
|
+
isError?: undefined;
|
|
359
|
+
};
|
|
360
|
+
} | {
|
|
361
|
+
toolResult: {
|
|
362
|
+
isError: boolean;
|
|
363
|
+
content: {
|
|
364
|
+
type: string;
|
|
365
|
+
text: string;
|
|
366
|
+
}[];
|
|
367
|
+
};
|
|
368
|
+
}>;
|
|
196
369
|
};
|
|
@@ -69,6 +69,70 @@ export const mlSimpleSiteTools = [
|
|
|
69
69
|
description: 'Get the frontend preview URL for the ML Simple Site',
|
|
70
70
|
inputSchema: { type: 'object', properties: {} },
|
|
71
71
|
},
|
|
72
|
+
{
|
|
73
|
+
name: 'mlss_edit_block',
|
|
74
|
+
description: 'Edit a specific block with surgical precision. Supports full replacement or find/replace mode.',
|
|
75
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
76
|
+
block_index: z.number().describe('Index of block to edit (0-based)'),
|
|
77
|
+
name: z.string().optional().describe('New block name'),
|
|
78
|
+
html: z.string().optional().describe('New HTML content (replaces entire HTML)'),
|
|
79
|
+
css: z.string().optional().describe('New CSS content (replaces entire CSS)'),
|
|
80
|
+
find_html: z.string().optional().describe('HTML string to find and replace'),
|
|
81
|
+
replace_html: z.string().optional().describe('HTML string to replace with'),
|
|
82
|
+
find_css: z.string().optional().describe('CSS string to find and replace'),
|
|
83
|
+
replace_css: z.string().optional().describe('CSS string to replace with'),
|
|
84
|
+
hide_from_nav: z.boolean().optional().describe('Hide block from navigation'),
|
|
85
|
+
}).shape },
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'mlss_reorder_blocks',
|
|
89
|
+
description: 'Reorder blocks by providing new order as array of indices (e.g., [2, 0, 1, 3] moves block 2 to position 0)',
|
|
90
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
91
|
+
block_order: z.array(z.number()).describe('New order of blocks by index (must include all blocks)'),
|
|
92
|
+
}).shape },
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'mlss_delete_block',
|
|
96
|
+
description: 'Delete a specific block by index',
|
|
97
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
98
|
+
block_index: z.number().describe('Index of block to delete (0-based)'),
|
|
99
|
+
}).shape },
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: 'mlss_create_contact',
|
|
103
|
+
description: 'Create contact in FluentCRM with optional list and tags. One-call contact creation.',
|
|
104
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
105
|
+
email: z.string().describe('Contact email address (required)'),
|
|
106
|
+
full_name: z.string().optional().describe('Full name (will be split into first/last)'),
|
|
107
|
+
first_name: z.string().optional().describe('First name'),
|
|
108
|
+
last_name: z.string().optional().describe('Last name'),
|
|
109
|
+
phone: z.string().optional().describe('Phone number'),
|
|
110
|
+
company: z.string().optional().describe('Company name'),
|
|
111
|
+
title: z.string().optional().describe('Job title'),
|
|
112
|
+
location: z.string().optional().describe('Location/address'),
|
|
113
|
+
list_id: z.number().optional().describe('FluentCRM list ID to add contact to'),
|
|
114
|
+
tags: z.array(z.string()).optional().describe('Array of tags to add'),
|
|
115
|
+
}).shape },
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'mlss_get_revisions',
|
|
119
|
+
description: 'List all saved revisions of the SimpleSite with metadata (index, description, timestamp, user, block count). Use this to show version history or before restoring.',
|
|
120
|
+
inputSchema: { type: 'object', properties: {} },
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'mlss_restore_revision',
|
|
124
|
+
description: 'Restore a specific revision by index. Automatically saves current state before restoring. Perfect for rolling back changes or A/B testing.',
|
|
125
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
126
|
+
revision_index: z.number().describe('Index of revision to restore (0 = oldest, get from mlss_get_revisions)'),
|
|
127
|
+
}).shape },
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'mlss_save_revision',
|
|
131
|
+
description: 'Save current state as a revision with optional description. Use before making experimental changes.',
|
|
132
|
+
inputSchema: { type: 'object', properties: z.object({
|
|
133
|
+
description: z.string().optional().describe('Description of this revision (e.g., "Before major redesign")'),
|
|
134
|
+
}).shape },
|
|
135
|
+
},
|
|
72
136
|
];
|
|
73
137
|
export const mlSimpleSiteHandlers = {
|
|
74
138
|
mlss_get_site: async (args) => {
|
|
@@ -191,4 +255,172 @@ export const mlSimpleSiteHandlers = {
|
|
|
191
255
|
};
|
|
192
256
|
}
|
|
193
257
|
},
|
|
258
|
+
mlss_edit_block: async (args) => {
|
|
259
|
+
try {
|
|
260
|
+
const response = await makeWordPressRequest('POST', 'mlss/v1/blocks/edit', args);
|
|
261
|
+
return {
|
|
262
|
+
toolResult: {
|
|
263
|
+
content: [{
|
|
264
|
+
type: 'text',
|
|
265
|
+
text: JSON.stringify(response, null, 2)
|
|
266
|
+
}]
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
return {
|
|
272
|
+
toolResult: {
|
|
273
|
+
isError: true,
|
|
274
|
+
content: [{
|
|
275
|
+
type: 'text',
|
|
276
|
+
text: `Error editing block: ${error.message}`
|
|
277
|
+
}]
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
mlss_reorder_blocks: async (args) => {
|
|
283
|
+
try {
|
|
284
|
+
const response = await makeWordPressRequest('POST', 'mlss/v1/blocks/reorder', args);
|
|
285
|
+
return {
|
|
286
|
+
toolResult: {
|
|
287
|
+
content: [{
|
|
288
|
+
type: 'text',
|
|
289
|
+
text: JSON.stringify(response, null, 2)
|
|
290
|
+
}]
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
catch (error) {
|
|
295
|
+
return {
|
|
296
|
+
toolResult: {
|
|
297
|
+
isError: true,
|
|
298
|
+
content: [{
|
|
299
|
+
type: 'text',
|
|
300
|
+
text: `Error reordering blocks: ${error.message}`
|
|
301
|
+
}]
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
mlss_delete_block: async (args) => {
|
|
307
|
+
try {
|
|
308
|
+
const response = await makeWordPressRequest('POST', 'mlss/v1/blocks/delete', args);
|
|
309
|
+
return {
|
|
310
|
+
toolResult: {
|
|
311
|
+
content: [{
|
|
312
|
+
type: 'text',
|
|
313
|
+
text: JSON.stringify(response, null, 2)
|
|
314
|
+
}]
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
catch (error) {
|
|
319
|
+
return {
|
|
320
|
+
toolResult: {
|
|
321
|
+
isError: true,
|
|
322
|
+
content: [{
|
|
323
|
+
type: 'text',
|
|
324
|
+
text: `Error deleting block: ${error.message}`
|
|
325
|
+
}]
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
mlss_create_contact: async (args) => {
|
|
331
|
+
try {
|
|
332
|
+
const response = await makeWordPressRequest('POST', 'mlss/v1/contacts/create', args);
|
|
333
|
+
return {
|
|
334
|
+
toolResult: {
|
|
335
|
+
content: [{
|
|
336
|
+
type: 'text',
|
|
337
|
+
text: JSON.stringify(response, null, 2)
|
|
338
|
+
}]
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
return {
|
|
344
|
+
toolResult: {
|
|
345
|
+
isError: true,
|
|
346
|
+
content: [{
|
|
347
|
+
type: 'text',
|
|
348
|
+
text: `Error creating contact: ${error.message}`
|
|
349
|
+
}]
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
mlss_get_revisions: async (args) => {
|
|
355
|
+
try {
|
|
356
|
+
const response = await makeWordPressRequest('GET', 'mlss/v1/revisions');
|
|
357
|
+
return {
|
|
358
|
+
toolResult: {
|
|
359
|
+
content: [{
|
|
360
|
+
type: 'text',
|
|
361
|
+
text: JSON.stringify(response, null, 2)
|
|
362
|
+
}]
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
catch (error) {
|
|
367
|
+
return {
|
|
368
|
+
toolResult: {
|
|
369
|
+
isError: true,
|
|
370
|
+
content: [{
|
|
371
|
+
type: 'text',
|
|
372
|
+
text: `Error getting revisions: ${error.message}`
|
|
373
|
+
}]
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
mlss_restore_revision: async (args) => {
|
|
379
|
+
try {
|
|
380
|
+
const response = await makeWordPressRequest('POST', 'mlss/v1/restore-revision', args);
|
|
381
|
+
return {
|
|
382
|
+
toolResult: {
|
|
383
|
+
content: [{
|
|
384
|
+
type: 'text',
|
|
385
|
+
text: JSON.stringify(response, null, 2)
|
|
386
|
+
}]
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
catch (error) {
|
|
391
|
+
return {
|
|
392
|
+
toolResult: {
|
|
393
|
+
isError: true,
|
|
394
|
+
content: [{
|
|
395
|
+
type: 'text',
|
|
396
|
+
text: `Error restoring revision: ${error.message}`
|
|
397
|
+
}]
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
mlss_save_revision: async (args) => {
|
|
403
|
+
try {
|
|
404
|
+
const response = await makeWordPressRequest('POST', 'mlss/v1/save-revision', args);
|
|
405
|
+
return {
|
|
406
|
+
toolResult: {
|
|
407
|
+
content: [{
|
|
408
|
+
type: 'text',
|
|
409
|
+
text: JSON.stringify(response, null, 2)
|
|
410
|
+
}]
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
catch (error) {
|
|
415
|
+
return {
|
|
416
|
+
toolResult: {
|
|
417
|
+
isError: true,
|
|
418
|
+
content: [{
|
|
419
|
+
type: 'text',
|
|
420
|
+
text: `Error saving revision: ${error.message}`
|
|
421
|
+
}]
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
},
|
|
194
426
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wplaunchify/ml-mcp-server",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.5",
|
|
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",
|