@wplaunchify/ml-mcp-server 2.1.3 → 2.1.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/tools/index.js +5 -2
- package/build/tools/media.d.ts +36 -0
- package/build/tools/media.js +68 -0
- package/package.json +1 -1
package/build/tools/index.js
CHANGED
|
@@ -31,7 +31,8 @@ const toolCategories = {
|
|
|
31
31
|
...mediaTools,
|
|
32
32
|
...userTools,
|
|
33
33
|
...pluginRepositoryTools,
|
|
34
|
-
...commentTools
|
|
34
|
+
...commentTools,
|
|
35
|
+
...mlCanvasTools
|
|
35
36
|
],
|
|
36
37
|
// Full FluentCommunity (91 tools) - legacy support
|
|
37
38
|
fluentcommunity: [
|
|
@@ -73,6 +74,7 @@ const toolCategories = {
|
|
|
73
74
|
]
|
|
74
75
|
};
|
|
75
76
|
const handlerCategories = {
|
|
77
|
+
// WP (ENABLED_TOOLS=wordpress) - 40 tools
|
|
76
78
|
wordpress: {
|
|
77
79
|
...unifiedContentHandlers,
|
|
78
80
|
...unifiedTaxonomyHandlers,
|
|
@@ -80,7 +82,8 @@ const handlerCategories = {
|
|
|
80
82
|
...mediaHandlers,
|
|
81
83
|
...userHandlers,
|
|
82
84
|
...pluginRepositoryHandlers,
|
|
83
|
-
...commentHandlers
|
|
85
|
+
...commentHandlers,
|
|
86
|
+
...mlCanvasHandlers // ML Canvas is part of WordPress category
|
|
84
87
|
},
|
|
85
88
|
fluentcommunity: {
|
|
86
89
|
...fluentCommunityHandlers,
|
package/build/tools/media.d.ts
CHANGED
|
@@ -61,6 +61,25 @@ declare const deleteMediaSchema: z.ZodObject<{
|
|
|
61
61
|
id: number;
|
|
62
62
|
force?: boolean | undefined;
|
|
63
63
|
}>;
|
|
64
|
+
declare const uploadMediaSchema: z.ZodObject<{
|
|
65
|
+
file_path: z.ZodString;
|
|
66
|
+
title: z.ZodOptional<z.ZodString>;
|
|
67
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
68
|
+
caption: z.ZodOptional<z.ZodString>;
|
|
69
|
+
description: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, "strict", z.ZodTypeAny, {
|
|
71
|
+
file_path: string;
|
|
72
|
+
title?: string | undefined;
|
|
73
|
+
description?: string | undefined;
|
|
74
|
+
alt_text?: string | undefined;
|
|
75
|
+
caption?: string | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
file_path: string;
|
|
78
|
+
title?: string | undefined;
|
|
79
|
+
description?: string | undefined;
|
|
80
|
+
alt_text?: string | undefined;
|
|
81
|
+
caption?: string | undefined;
|
|
82
|
+
}>;
|
|
64
83
|
export declare const mediaTools: Tool[];
|
|
65
84
|
export declare const mediaHandlers: {
|
|
66
85
|
list_media: (params: z.infer<typeof listMediaSchema>) => Promise<{
|
|
@@ -97,6 +116,23 @@ export declare const mediaHandlers: {
|
|
|
97
116
|
}[];
|
|
98
117
|
};
|
|
99
118
|
}>;
|
|
119
|
+
upload_media: (params: z.infer<typeof uploadMediaSchema>) => Promise<{
|
|
120
|
+
toolResult: {
|
|
121
|
+
isError: boolean;
|
|
122
|
+
content: {
|
|
123
|
+
type: string;
|
|
124
|
+
text: string;
|
|
125
|
+
}[];
|
|
126
|
+
};
|
|
127
|
+
} | {
|
|
128
|
+
toolResult: {
|
|
129
|
+
content: {
|
|
130
|
+
type: string;
|
|
131
|
+
text: string;
|
|
132
|
+
}[];
|
|
133
|
+
isError?: undefined;
|
|
134
|
+
};
|
|
135
|
+
}>;
|
|
100
136
|
edit_media: (params: z.infer<typeof editMediaSchema>) => Promise<{
|
|
101
137
|
toolResult: {
|
|
102
138
|
content: {
|
package/build/tools/media.js
CHANGED
|
@@ -27,6 +27,14 @@ const deleteMediaSchema = z.object({
|
|
|
27
27
|
id: z.number().describe("Media ID to delete"),
|
|
28
28
|
force: z.boolean().optional().describe("Force deletion bypassing trash")
|
|
29
29
|
}).strict();
|
|
30
|
+
// Schema for uploading a local file to WordPress media library
|
|
31
|
+
const uploadMediaSchema = z.object({
|
|
32
|
+
file_path: z.string().describe("Local file path to upload"),
|
|
33
|
+
title: z.string().optional().describe("Media title"),
|
|
34
|
+
alt_text: z.string().optional().describe("Alternate text for the media"),
|
|
35
|
+
caption: z.string().optional().describe("Caption of the media"),
|
|
36
|
+
description: z.string().optional().describe("Description of the media")
|
|
37
|
+
}).strict();
|
|
30
38
|
// Define the tool set for media operations
|
|
31
39
|
export const mediaTools = [
|
|
32
40
|
{
|
|
@@ -39,6 +47,11 @@ export const mediaTools = [
|
|
|
39
47
|
description: "Creates a new media item",
|
|
40
48
|
inputSchema: { type: "object", properties: createMediaSchema.shape }
|
|
41
49
|
},
|
|
50
|
+
{
|
|
51
|
+
name: "upload_media",
|
|
52
|
+
description: "Uploads a local file to WordPress media library",
|
|
53
|
+
inputSchema: { type: "object", properties: uploadMediaSchema.shape }
|
|
54
|
+
},
|
|
42
55
|
{
|
|
43
56
|
name: "edit_media",
|
|
44
57
|
description: "Updates an existing media item",
|
|
@@ -125,6 +138,61 @@ export const mediaHandlers = {
|
|
|
125
138
|
};
|
|
126
139
|
}
|
|
127
140
|
},
|
|
141
|
+
upload_media: async (params) => {
|
|
142
|
+
try {
|
|
143
|
+
const fs = await import('fs');
|
|
144
|
+
const path = await import('path');
|
|
145
|
+
const axios = (await import('axios')).default;
|
|
146
|
+
const FormData = (await import('form-data')).default;
|
|
147
|
+
// Check if file exists
|
|
148
|
+
if (!fs.existsSync(params.file_path)) {
|
|
149
|
+
return {
|
|
150
|
+
toolResult: {
|
|
151
|
+
isError: true,
|
|
152
|
+
content: [{ type: "text", text: `File not found: ${params.file_path}` }]
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
// Read the file
|
|
157
|
+
const fileBuffer = fs.readFileSync(params.file_path);
|
|
158
|
+
const fileName = path.basename(params.file_path);
|
|
159
|
+
// Create form data
|
|
160
|
+
const form = new FormData();
|
|
161
|
+
form.append('file', fileBuffer, {
|
|
162
|
+
filename: fileName,
|
|
163
|
+
contentType: 'application/octet-stream'
|
|
164
|
+
});
|
|
165
|
+
// Append additional fields if provided
|
|
166
|
+
if (params.title)
|
|
167
|
+
form.append('title', params.title);
|
|
168
|
+
if (params.alt_text)
|
|
169
|
+
form.append('alt_text', params.alt_text);
|
|
170
|
+
if (params.caption)
|
|
171
|
+
form.append('caption', params.caption);
|
|
172
|
+
if (params.description)
|
|
173
|
+
form.append('description', params.description);
|
|
174
|
+
// Upload to WordPress via our custom endpoint
|
|
175
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/wordpress/media/upload', form, {
|
|
176
|
+
isFormData: true,
|
|
177
|
+
headers: form.getHeaders(),
|
|
178
|
+
rawResponse: true
|
|
179
|
+
});
|
|
180
|
+
return {
|
|
181
|
+
toolResult: {
|
|
182
|
+
content: [{ type: "text", text: JSON.stringify(response.data, null, 2) }]
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
188
|
+
return {
|
|
189
|
+
toolResult: {
|
|
190
|
+
isError: true,
|
|
191
|
+
content: [{ type: "text", text: `Error uploading media: ${errorMessage}` }]
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
},
|
|
128
196
|
edit_media: async (params) => {
|
|
129
197
|
try {
|
|
130
198
|
const { id, ...updateData } = params;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wplaunchify/ml-mcp-server",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
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",
|