@wplaunchify/ml-mcp-server 1.0.0
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/LICENSE +22 -0
- package/README.md +220 -0
- package/build/cli.d.ts +2 -0
- package/build/cli.js +52 -0
- package/build/server.d.ts +2 -0
- package/build/server.js +97 -0
- package/build/tools/comments.d.ts +212 -0
- package/build/tools/comments.js +181 -0
- package/build/tools/fluent-affiliate.d.ts +2 -0
- package/build/tools/fluent-affiliate.js +3 -0
- package/build/tools/fluent-cart.d.ts +706 -0
- package/build/tools/fluent-cart.js +642 -0
- package/build/tools/fluent-community-BACKUP.d.ts +364 -0
- package/build/tools/fluent-community-BACKUP.js +883 -0
- package/build/tools/fluent-community-MINIMAL.d.ts +69 -0
- package/build/tools/fluent-community-MINIMAL.js +92 -0
- package/build/tools/fluent-community-design.d.ts +3 -0
- package/build/tools/fluent-community-design.js +150 -0
- package/build/tools/fluent-community-layout.d.ts +119 -0
- package/build/tools/fluent-community-layout.js +88 -0
- package/build/tools/fluent-community.d.ts +364 -0
- package/build/tools/fluent-community.js +528 -0
- package/build/tools/fluent-crm.d.ts +3 -0
- package/build/tools/fluent-crm.js +392 -0
- package/build/tools/index.d.ts +2205 -0
- package/build/tools/index.js +54 -0
- package/build/tools/media.d.ts +135 -0
- package/build/tools/media.js +168 -0
- package/build/tools/ml-canvas.d.ts +91 -0
- package/build/tools/ml-canvas.js +109 -0
- package/build/tools/ml-image-editor.d.ts +230 -0
- package/build/tools/ml-image-editor.js +270 -0
- package/build/tools/ml-media-hub.d.ts +575 -0
- package/build/tools/ml-media-hub.js +714 -0
- package/build/tools/plugin-repository.d.ts +62 -0
- package/build/tools/plugin-repository.js +149 -0
- package/build/tools/plugins.d.ts +129 -0
- package/build/tools/plugins.js +148 -0
- package/build/tools/unified-content.d.ts +313 -0
- package/build/tools/unified-content.js +615 -0
- package/build/tools/unified-taxonomies.d.ts +229 -0
- package/build/tools/unified-taxonomies.js +479 -0
- package/build/tools/users.d.ts +227 -0
- package/build/tools/users.js +182 -0
- package/build/types/wordpress-types.d.ts +151 -0
- package/build/types/wordpress-types.js +2 -0
- package/build/wordpress.d.ts +26 -0
- package/build/wordpress.js +223 -0
- package/package.json +67 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { makeWordPressRequest } from '../wordpress.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
// Schema for listing comments
|
|
4
|
+
const listCommentsSchema = z.object({
|
|
5
|
+
page: z.number().optional().describe("Page number (default 1)"),
|
|
6
|
+
per_page: z.number().min(1).max(100).optional().describe("Items per page (default 10, max 100)"),
|
|
7
|
+
search: z.string().optional().describe("Search term for comment content"),
|
|
8
|
+
after: z.string().optional().describe("ISO8601 date string to get comments published after this date"),
|
|
9
|
+
author: z.union([z.number(), z.array(z.number())]).optional().describe("Author ID or array of IDs"),
|
|
10
|
+
author_email: z.string().email().optional().describe("Author email address"),
|
|
11
|
+
author_exclude: z.array(z.number()).optional().describe("Array of author IDs to exclude"),
|
|
12
|
+
post: z.number().optional().describe("Post ID to retrieve comments for"),
|
|
13
|
+
status: z.enum(['approve', 'hold', 'spam', 'trash']).optional().describe("Comment status"),
|
|
14
|
+
type: z.string().optional().describe("Comment type"),
|
|
15
|
+
orderby: z.enum(['date', 'date_gmt', 'id', 'include', 'post', 'parent', 'type']).optional().describe("Sort comments by parameter"),
|
|
16
|
+
order: z.enum(['asc', 'desc']).optional().describe("Order sort attribute ascending or descending")
|
|
17
|
+
});
|
|
18
|
+
// Schema for getting a single comment
|
|
19
|
+
const getCommentSchema = z.object({
|
|
20
|
+
id: z.number().describe("Comment ID")
|
|
21
|
+
}).strict();
|
|
22
|
+
// Schema for creating a comment
|
|
23
|
+
const createCommentSchema = z.object({
|
|
24
|
+
post: z.number().describe("The ID of the post object the comment is for"),
|
|
25
|
+
author: z.number().optional().describe("The ID of the user object, if the author is a registered user"),
|
|
26
|
+
author_name: z.string().optional().describe("Display name for the comment author"),
|
|
27
|
+
author_email: z.string().email().optional().describe("Email address for the comment author"),
|
|
28
|
+
author_url: z.string().url().optional().describe("URL for the comment author"),
|
|
29
|
+
content: z.string().describe("The content of the comment"),
|
|
30
|
+
parent: z.number().optional().describe("The ID of the parent comment"),
|
|
31
|
+
status: z.enum(['approve', 'hold']).optional().describe("State of the comment")
|
|
32
|
+
}).strict();
|
|
33
|
+
// Schema for updating a comment
|
|
34
|
+
const updateCommentSchema = z.object({
|
|
35
|
+
id: z.number().describe("Comment ID"),
|
|
36
|
+
post: z.number().optional().describe("The ID of the post object the comment is for"),
|
|
37
|
+
author: z.number().optional().describe("The ID of the user object, if the author is a registered user"),
|
|
38
|
+
author_name: z.string().optional().describe("Display name for the comment author"),
|
|
39
|
+
author_email: z.string().email().optional().describe("Email address for the comment author"),
|
|
40
|
+
author_url: z.string().url().optional().describe("URL for the comment author"),
|
|
41
|
+
content: z.string().optional().describe("The content of the comment"),
|
|
42
|
+
parent: z.number().optional().describe("The ID of the parent comment"),
|
|
43
|
+
status: z.enum(['approve', 'hold', 'spam', 'trash']).optional().describe("State of the comment")
|
|
44
|
+
}).strict();
|
|
45
|
+
// Schema for deleting a comment
|
|
46
|
+
const deleteCommentSchema = z.object({
|
|
47
|
+
id: z.number().describe("Comment ID"),
|
|
48
|
+
force: z.boolean().optional().describe("Whether to bypass trash and force deletion")
|
|
49
|
+
}).strict();
|
|
50
|
+
// Define the tools
|
|
51
|
+
export const commentTools = [
|
|
52
|
+
{
|
|
53
|
+
name: "list_comments",
|
|
54
|
+
description: "Lists comments with filtering, sorting, and pagination options",
|
|
55
|
+
inputSchema: { type: "object", properties: listCommentsSchema.shape }
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "get_comment",
|
|
59
|
+
description: "Gets a comment by ID",
|
|
60
|
+
inputSchema: { type: "object", properties: getCommentSchema.shape }
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "create_comment",
|
|
64
|
+
description: "Creates a new comment",
|
|
65
|
+
inputSchema: { type: "object", properties: createCommentSchema.shape }
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "update_comment",
|
|
69
|
+
description: "Updates an existing comment",
|
|
70
|
+
inputSchema: { type: "object", properties: updateCommentSchema.shape }
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "delete_comment",
|
|
74
|
+
description: "Deletes a comment",
|
|
75
|
+
inputSchema: { type: "object", properties: deleteCommentSchema.shape }
|
|
76
|
+
}
|
|
77
|
+
];
|
|
78
|
+
// Implement the handlers
|
|
79
|
+
export const commentHandlers = {
|
|
80
|
+
list_comments: async (params) => {
|
|
81
|
+
try {
|
|
82
|
+
const response = await makeWordPressRequest('GET', "wp/v2/comments", params);
|
|
83
|
+
const comments = response;
|
|
84
|
+
return {
|
|
85
|
+
toolResult: {
|
|
86
|
+
content: [{ type: 'text', text: JSON.stringify(comments, null, 2) }],
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
92
|
+
return {
|
|
93
|
+
toolResult: {
|
|
94
|
+
isError: true,
|
|
95
|
+
content: [{ type: 'text', text: `Error listing comments: ${errorMessage}` }],
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
get_comment: async (params) => {
|
|
101
|
+
try {
|
|
102
|
+
const response = await makeWordPressRequest('GET', `wp/v2/comments/${params.id}`);
|
|
103
|
+
const comment = response;
|
|
104
|
+
return {
|
|
105
|
+
toolResult: {
|
|
106
|
+
content: [{ type: 'text', text: JSON.stringify(comment, null, 2) }],
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
112
|
+
return {
|
|
113
|
+
toolResult: {
|
|
114
|
+
isError: true,
|
|
115
|
+
content: [{ type: 'text', text: `Error getting comment: ${errorMessage}` }],
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
create_comment: async (params) => {
|
|
121
|
+
try {
|
|
122
|
+
const response = await makeWordPressRequest('POST', "wp/v2/comments", params);
|
|
123
|
+
const comment = response;
|
|
124
|
+
return {
|
|
125
|
+
toolResult: {
|
|
126
|
+
content: [{ type: 'text', text: JSON.stringify(comment, null, 2) }],
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
132
|
+
return {
|
|
133
|
+
toolResult: {
|
|
134
|
+
isError: true,
|
|
135
|
+
content: [{ type: 'text', text: `Error creating comment: ${errorMessage}` }],
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
update_comment: async (params) => {
|
|
141
|
+
try {
|
|
142
|
+
const { id, ...updateData } = params;
|
|
143
|
+
const response = await makeWordPressRequest('POST', `wp/v2/comments/${id}`, updateData);
|
|
144
|
+
const comment = response;
|
|
145
|
+
return {
|
|
146
|
+
toolResult: {
|
|
147
|
+
content: [{ type: 'text', text: JSON.stringify(comment, null, 2) }],
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
153
|
+
return {
|
|
154
|
+
toolResult: {
|
|
155
|
+
isError: true,
|
|
156
|
+
content: [{ type: 'text', text: `Error updating comment: ${errorMessage}` }],
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
delete_comment: async (params) => {
|
|
162
|
+
try {
|
|
163
|
+
const response = await makeWordPressRequest('DELETE', `wp/v2/comments/${params.id}`, { force: params.force });
|
|
164
|
+
const comment = response;
|
|
165
|
+
return {
|
|
166
|
+
toolResult: {
|
|
167
|
+
content: [{ type: 'text', text: JSON.stringify(comment, null, 2) }],
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
173
|
+
return {
|
|
174
|
+
toolResult: {
|
|
175
|
+
isError: true,
|
|
176
|
+
content: [{ type: 'text', text: `Error deleting comment: ${errorMessage}` }],
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|