@wplaunchify/ml-mcp-server 2.0.0 → 2.1.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.
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
// src/tools/fluent-community-learning.ts
|
|
2
|
+
// COMM2 - Learning & Admin (36 tools)
|
|
3
|
+
// Use case: "I create courses, manage lessons, and configure community settings"
|
|
4
|
+
import { makeWordPressRequest } from '../wordpress.js';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
// ==================== SCHEMA DEFINITIONS ====================
|
|
7
|
+
// Courses
|
|
8
|
+
const listCoursesSchema = z.object({
|
|
9
|
+
space_id: z.number().optional().describe('Filter courses by space ID'),
|
|
10
|
+
status: z.enum(['published', 'draft', 'archived']).optional().describe('Filter by status'),
|
|
11
|
+
limit: z.number().optional().default(20).describe('Number of courses to return'),
|
|
12
|
+
search: z.string().optional().describe('Search term')
|
|
13
|
+
});
|
|
14
|
+
const getCourseSchema = z.object({
|
|
15
|
+
id: z.number().describe('The ID of the course to retrieve')
|
|
16
|
+
});
|
|
17
|
+
const createCourseSchema = z.object({
|
|
18
|
+
title: z.string().describe('Course title'),
|
|
19
|
+
space_id: z.number().describe('The space ID where the course will be created'),
|
|
20
|
+
description: z.string().optional().describe('Course description'),
|
|
21
|
+
featured_image: z.string().optional().describe('Featured image URL'),
|
|
22
|
+
status: z.enum(['published', 'draft']).optional().default('draft').describe('Course status'),
|
|
23
|
+
settings: z.object({
|
|
24
|
+
enrollment_type: z.enum(['open', 'approval', 'closed']).optional(),
|
|
25
|
+
certificate_enabled: z.boolean().optional(),
|
|
26
|
+
drip_enabled: z.boolean().optional()
|
|
27
|
+
}).optional().describe('Course settings')
|
|
28
|
+
});
|
|
29
|
+
const updateCourseSchema = z.object({
|
|
30
|
+
id: z.number().describe('The ID of the course to update'),
|
|
31
|
+
title: z.string().optional().describe('Course title'),
|
|
32
|
+
description: z.string().optional().describe('Course description'),
|
|
33
|
+
featured_image: z.string().optional().describe('Featured image URL'),
|
|
34
|
+
status: z.enum(['published', 'draft', 'archived']).optional().describe('Course status'),
|
|
35
|
+
settings: z.object({
|
|
36
|
+
enrollment_type: z.enum(['open', 'approval', 'closed']).optional(),
|
|
37
|
+
certificate_enabled: z.boolean().optional(),
|
|
38
|
+
drip_enabled: z.boolean().optional()
|
|
39
|
+
}).optional().describe('Course settings')
|
|
40
|
+
});
|
|
41
|
+
const deleteCourseSchema = z.object({
|
|
42
|
+
id: z.number().describe('The ID of the course to delete')
|
|
43
|
+
});
|
|
44
|
+
// Lessons
|
|
45
|
+
const listLessonsSchema = z.object({
|
|
46
|
+
course_id: z.number().describe('The course ID to list lessons from'),
|
|
47
|
+
limit: z.number().optional().default(50).describe('Number of lessons to return')
|
|
48
|
+
});
|
|
49
|
+
const getLessonSchema = z.object({
|
|
50
|
+
course_id: z.number().describe('The course ID'),
|
|
51
|
+
id: z.number().describe('The ID of the lesson to retrieve')
|
|
52
|
+
});
|
|
53
|
+
const createLessonSchema = z.object({
|
|
54
|
+
course_id: z.number().describe('The course ID where the lesson will be created'),
|
|
55
|
+
title: z.string().describe('Lesson title'),
|
|
56
|
+
content: z.string().describe('Lesson content (HTML supported)'),
|
|
57
|
+
order: z.number().optional().describe('Lesson order/position'),
|
|
58
|
+
type: z.enum(['lesson', 'quiz', 'assignment']).optional().default('lesson').describe('Lesson type'),
|
|
59
|
+
settings: z.object({
|
|
60
|
+
video_url: z.string().optional(),
|
|
61
|
+
duration: z.number().optional(),
|
|
62
|
+
downloadable: z.boolean().optional()
|
|
63
|
+
}).optional().describe('Lesson settings')
|
|
64
|
+
});
|
|
65
|
+
const updateLessonSchema = z.object({
|
|
66
|
+
course_id: z.number().describe('The course ID'),
|
|
67
|
+
id: z.number().describe('The ID of the lesson to update'),
|
|
68
|
+
title: z.string().optional().describe('Lesson title'),
|
|
69
|
+
content: z.string().optional().describe('Lesson content (HTML supported)'),
|
|
70
|
+
order: z.number().optional().describe('Lesson order/position'),
|
|
71
|
+
type: z.enum(['lesson', 'quiz', 'assignment']).optional().describe('Lesson type'),
|
|
72
|
+
settings: z.object({
|
|
73
|
+
video_url: z.string().optional(),
|
|
74
|
+
duration: z.number().optional(),
|
|
75
|
+
downloadable: z.boolean().optional()
|
|
76
|
+
}).optional().describe('Lesson settings')
|
|
77
|
+
});
|
|
78
|
+
const deleteLessonSchema = z.object({
|
|
79
|
+
course_id: z.number().describe('The course ID'),
|
|
80
|
+
id: z.number().describe('The ID of the lesson to delete')
|
|
81
|
+
});
|
|
82
|
+
// Course Progress
|
|
83
|
+
const getCourseProgressSchema = z.object({
|
|
84
|
+
course_id: z.number().describe('The course ID to get progress for'),
|
|
85
|
+
user_id: z.number().optional().describe('User ID (defaults to current user)')
|
|
86
|
+
});
|
|
87
|
+
const updateCourseProgressSchema = z.object({
|
|
88
|
+
course_id: z.number().describe('The course ID'),
|
|
89
|
+
lesson_id: z.number().describe('The lesson ID to mark progress for'),
|
|
90
|
+
status: z.enum(['completed', 'in_progress']).describe('Progress status'),
|
|
91
|
+
user_id: z.number().optional().describe('User ID (defaults to current user)')
|
|
92
|
+
});
|
|
93
|
+
const getMyCoursesSchema = z.object({
|
|
94
|
+
status: z.enum(['enrolled', 'completed', 'in_progress']).optional().describe('Filter by enrollment status'),
|
|
95
|
+
limit: z.number().optional().default(20).describe('Number of courses to return')
|
|
96
|
+
});
|
|
97
|
+
// Quizzes
|
|
98
|
+
const listQuizzesSchema = z.object({
|
|
99
|
+
course_id: z.number().describe('The course ID'),
|
|
100
|
+
limit: z.number().optional().default(50).describe('Number of quizzes to return')
|
|
101
|
+
});
|
|
102
|
+
const getQuizSchema = z.object({
|
|
103
|
+
course_id: z.number().describe('The course ID'),
|
|
104
|
+
id: z.number().describe('The quiz ID')
|
|
105
|
+
});
|
|
106
|
+
const createQuizSchema = z.object({
|
|
107
|
+
course_id: z.number().describe('The course ID'),
|
|
108
|
+
title: z.string().describe('Quiz title'),
|
|
109
|
+
questions: z.array(z.object({
|
|
110
|
+
question: z.string(),
|
|
111
|
+
answers: z.array(z.string()),
|
|
112
|
+
correct_answer: z.number()
|
|
113
|
+
})).describe('Quiz questions'),
|
|
114
|
+
passing_score: z.number().optional().describe('Passing score percentage')
|
|
115
|
+
});
|
|
116
|
+
const updateQuizSchema = z.object({
|
|
117
|
+
course_id: z.number().describe('The course ID'),
|
|
118
|
+
id: z.number().describe('The quiz ID'),
|
|
119
|
+
title: z.string().optional().describe('Quiz title'),
|
|
120
|
+
questions: z.array(z.object({
|
|
121
|
+
question: z.string(),
|
|
122
|
+
answers: z.array(z.string()),
|
|
123
|
+
correct_answer: z.number()
|
|
124
|
+
})).optional().describe('Quiz questions'),
|
|
125
|
+
passing_score: z.number().optional().describe('Passing score percentage')
|
|
126
|
+
});
|
|
127
|
+
const deleteQuizSchema = z.object({
|
|
128
|
+
course_id: z.number().describe('The course ID'),
|
|
129
|
+
id: z.number().describe('The quiz ID')
|
|
130
|
+
});
|
|
131
|
+
// Media
|
|
132
|
+
const listMediaSchema = z.object({
|
|
133
|
+
limit: z.number().optional().default(50).describe('Number of media items to return')
|
|
134
|
+
});
|
|
135
|
+
const uploadMediaSchema = z.object({
|
|
136
|
+
file_url: z.string().describe('URL of file to upload'),
|
|
137
|
+
file_name: z.string().optional().describe('File name')
|
|
138
|
+
});
|
|
139
|
+
// Giphy
|
|
140
|
+
const searchGiphySchema = z.object({
|
|
141
|
+
query: z.string().describe('Search query for GIFs'),
|
|
142
|
+
limit: z.number().optional().default(20).describe('Number of GIFs to return')
|
|
143
|
+
});
|
|
144
|
+
// Webhooks
|
|
145
|
+
const listWebhooksSchema = z.object({
|
|
146
|
+
limit: z.number().optional().default(50).describe('Number of webhooks to return')
|
|
147
|
+
});
|
|
148
|
+
const createWebhookSchema = z.object({
|
|
149
|
+
url: z.string().describe('Webhook URL'),
|
|
150
|
+
events: z.array(z.string()).describe('Events to trigger webhook'),
|
|
151
|
+
secret: z.string().optional().describe('Webhook secret for verification')
|
|
152
|
+
});
|
|
153
|
+
const deleteWebhookSchema = z.object({
|
|
154
|
+
id: z.number().describe('Webhook ID')
|
|
155
|
+
});
|
|
156
|
+
// Leaderboard
|
|
157
|
+
const getLeaderboardSchema = z.object({
|
|
158
|
+
period: z.enum(['daily', 'weekly', 'monthly', 'all_time']).optional().default('all_time').describe('Leaderboard period'),
|
|
159
|
+
limit: z.number().optional().default(50).describe('Number of users to return')
|
|
160
|
+
});
|
|
161
|
+
const addPointsSchema = z.object({
|
|
162
|
+
user_id: z.number().describe('User ID'),
|
|
163
|
+
points: z.number().describe('Points to add'),
|
|
164
|
+
reason: z.string().optional().describe('Reason for points')
|
|
165
|
+
});
|
|
166
|
+
// ==================== TOOL DEFINITIONS (36 tools) ====================
|
|
167
|
+
export const fluentCommunityLearningTools = [
|
|
168
|
+
// Courses (5)
|
|
169
|
+
{ name: 'fc_list_courses', description: 'List all courses in FluentCommunity', inputSchema: { type: 'object', properties: listCoursesSchema.shape } },
|
|
170
|
+
{ name: 'fc_get_course', description: 'Get a specific course by ID', inputSchema: { type: 'object', properties: getCourseSchema.shape } },
|
|
171
|
+
{ name: 'fc_create_course', description: 'Create a new course', inputSchema: { type: 'object', properties: createCourseSchema.shape } },
|
|
172
|
+
{ name: 'fc_update_course', description: 'Update an existing course', inputSchema: { type: 'object', properties: updateCourseSchema.shape } },
|
|
173
|
+
{ name: 'fc_delete_course', description: 'Delete a course', inputSchema: { type: 'object', properties: deleteCourseSchema.shape } },
|
|
174
|
+
// Lessons (5)
|
|
175
|
+
{ name: 'fc_list_lessons', description: 'List all lessons in a course', inputSchema: { type: 'object', properties: listLessonsSchema.shape } },
|
|
176
|
+
{ name: 'fc_get_lesson', description: 'Get a specific lesson by ID', inputSchema: { type: 'object', properties: getLessonSchema.shape } },
|
|
177
|
+
{ name: 'fc_create_lesson', description: 'Create a new lesson in a course', inputSchema: { type: 'object', properties: createLessonSchema.shape } },
|
|
178
|
+
{ name: 'fc_update_lesson', description: 'Update an existing lesson', inputSchema: { type: 'object', properties: updateLessonSchema.shape } },
|
|
179
|
+
{ name: 'fc_delete_lesson', description: 'Delete a lesson', inputSchema: { type: 'object', properties: deleteLessonSchema.shape } },
|
|
180
|
+
// Course Progress (3)
|
|
181
|
+
{ name: 'fc_get_course_progress', description: 'Get course progress for a user', inputSchema: { type: 'object', properties: getCourseProgressSchema.shape } },
|
|
182
|
+
{ name: 'fc_update_course_progress', description: 'Update course progress (mark lesson completed)', inputSchema: { type: 'object', properties: updateCourseProgressSchema.shape } },
|
|
183
|
+
{ name: 'fc_get_my_courses', description: 'Get all courses the current user is enrolled in', inputSchema: { type: 'object', properties: getMyCoursesSchema.shape } },
|
|
184
|
+
// Quizzes (5)
|
|
185
|
+
{ name: 'fc_list_quizzes', description: 'List quizzes for a course', inputSchema: { type: 'object', properties: listQuizzesSchema.shape } },
|
|
186
|
+
{ name: 'fc_get_quiz', description: 'Get a specific quiz by ID', inputSchema: { type: 'object', properties: getQuizSchema.shape } },
|
|
187
|
+
{ name: 'fc_create_quiz', description: 'Create a new quiz in a course', inputSchema: { type: 'object', properties: createQuizSchema.shape } },
|
|
188
|
+
{ name: 'fc_update_quiz', description: 'Update an existing quiz', inputSchema: { type: 'object', properties: updateQuizSchema.shape } },
|
|
189
|
+
{ name: 'fc_delete_quiz', description: 'Delete a quiz', inputSchema: { type: 'object', properties: deleteQuizSchema.shape } },
|
|
190
|
+
// Media (2)
|
|
191
|
+
{ name: 'fc_list_media', description: 'List media items', inputSchema: { type: 'object', properties: listMediaSchema.shape } },
|
|
192
|
+
{ name: 'fc_upload_media', description: 'Upload media file', inputSchema: { type: 'object', properties: uploadMediaSchema.shape } },
|
|
193
|
+
// Giphy (1)
|
|
194
|
+
{ name: 'fc_search_giphy', description: 'Search Giphy for GIFs', inputSchema: { type: 'object', properties: searchGiphySchema.shape } },
|
|
195
|
+
// Webhooks (3)
|
|
196
|
+
{ name: 'fc_list_webhooks', description: 'List all webhooks', inputSchema: { type: 'object', properties: listWebhooksSchema.shape } },
|
|
197
|
+
{ name: 'fc_create_webhook', description: 'Create a new webhook', inputSchema: { type: 'object', properties: createWebhookSchema.shape } },
|
|
198
|
+
{ name: 'fc_delete_webhook', description: 'Delete a webhook', inputSchema: { type: 'object', properties: deleteWebhookSchema.shape } },
|
|
199
|
+
// Leaderboard & Points (2)
|
|
200
|
+
{ name: 'fc_get_leaderboard', description: 'Get the community leaderboard', inputSchema: { type: 'object', properties: getLeaderboardSchema.shape } },
|
|
201
|
+
{ name: 'fc_add_points', description: 'Add points to a user', inputSchema: { type: 'object', properties: addPointsSchema.shape } },
|
|
202
|
+
];
|
|
203
|
+
// Note: Admin tools (fc_cleanup_members, fc_list_terms) are in fluent-community-admin.ts
|
|
204
|
+
// Note: Design tools (colors, portal, branding) are in fluent-community-design.ts
|
|
205
|
+
// Note: Layout tools are in fluent-community-layout.ts
|
|
206
|
+
// These are automatically included when using fluentcommunity-learning
|
|
207
|
+
// ==================== HANDLERS ====================
|
|
208
|
+
export const fluentCommunityLearningHandlers = {
|
|
209
|
+
// Courses
|
|
210
|
+
fc_list_courses: async (args) => {
|
|
211
|
+
try {
|
|
212
|
+
const params = { per_page: args.limit || 20 };
|
|
213
|
+
if (args.space_id)
|
|
214
|
+
params.space_id = args.space_id;
|
|
215
|
+
if (args.status)
|
|
216
|
+
params.status = args.status;
|
|
217
|
+
if (args.search)
|
|
218
|
+
params.search = args.search;
|
|
219
|
+
const response = await makeWordPressRequest('GET', 'fc-manager/v1/courses', params);
|
|
220
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
221
|
+
}
|
|
222
|
+
catch (error) {
|
|
223
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
fc_get_course: async (args) => {
|
|
227
|
+
try {
|
|
228
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/courses/${args.id}`);
|
|
229
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
fc_create_course: async (args) => {
|
|
236
|
+
try {
|
|
237
|
+
const courseData = { title: args.title, space_id: args.space_id, status: args.status || 'draft' };
|
|
238
|
+
if (args.description)
|
|
239
|
+
courseData.description = args.description;
|
|
240
|
+
if (args.featured_image)
|
|
241
|
+
courseData.featured_image = args.featured_image;
|
|
242
|
+
if (args.settings)
|
|
243
|
+
courseData.settings = args.settings;
|
|
244
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/courses', courseData);
|
|
245
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
fc_update_course: async (args) => {
|
|
252
|
+
try {
|
|
253
|
+
const { id, ...updateData } = args;
|
|
254
|
+
const response = await makeWordPressRequest('PUT', `fc-manager/v1/courses/${id}`, updateData);
|
|
255
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
fc_delete_course: async (args) => {
|
|
262
|
+
try {
|
|
263
|
+
const response = await makeWordPressRequest('DELETE', `fc-manager/v1/courses/${args.id}`);
|
|
264
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
// Lessons
|
|
271
|
+
fc_list_lessons: async (args) => {
|
|
272
|
+
try {
|
|
273
|
+
const params = { per_page: args.limit || 50 };
|
|
274
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/courses/${args.course_id}/lessons`, params);
|
|
275
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
fc_get_lesson: async (args) => {
|
|
282
|
+
try {
|
|
283
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/courses/${args.course_id}/lessons/${args.id}`);
|
|
284
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
fc_create_lesson: async (args) => {
|
|
291
|
+
try {
|
|
292
|
+
const lessonData = { title: args.title, content: args.content, type: args.type || 'lesson' };
|
|
293
|
+
if (args.order)
|
|
294
|
+
lessonData.order = args.order;
|
|
295
|
+
if (args.settings)
|
|
296
|
+
lessonData.settings = args.settings;
|
|
297
|
+
const response = await makeWordPressRequest('POST', `fc-manager/v1/courses/${args.course_id}/lessons`, lessonData);
|
|
298
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
fc_update_lesson: async (args) => {
|
|
305
|
+
try {
|
|
306
|
+
const { course_id, id, ...updateData } = args;
|
|
307
|
+
const response = await makeWordPressRequest('PUT', `fc-manager/v1/courses/${course_id}/lessons/${id}`, updateData);
|
|
308
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
309
|
+
}
|
|
310
|
+
catch (error) {
|
|
311
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
fc_delete_lesson: async (args) => {
|
|
315
|
+
try {
|
|
316
|
+
const response = await makeWordPressRequest('DELETE', `fc-manager/v1/courses/${args.course_id}/lessons/${args.id}`);
|
|
317
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
318
|
+
}
|
|
319
|
+
catch (error) {
|
|
320
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
// Course Progress
|
|
324
|
+
fc_get_course_progress: async (args) => {
|
|
325
|
+
try {
|
|
326
|
+
const params = {};
|
|
327
|
+
if (args.user_id)
|
|
328
|
+
params.user_id = args.user_id;
|
|
329
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/courses/${args.course_id}/progress`, params);
|
|
330
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
fc_update_course_progress: async (args) => {
|
|
337
|
+
try {
|
|
338
|
+
const progressData = { lesson_id: args.lesson_id, status: args.status };
|
|
339
|
+
if (args.user_id)
|
|
340
|
+
progressData.user_id = args.user_id;
|
|
341
|
+
const response = await makeWordPressRequest('POST', `fc-manager/v1/courses/${args.course_id}/progress`, progressData);
|
|
342
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
fc_get_my_courses: async (args) => {
|
|
349
|
+
try {
|
|
350
|
+
const params = { per_page: args.limit || 20 };
|
|
351
|
+
if (args.status)
|
|
352
|
+
params.status = args.status;
|
|
353
|
+
const response = await makeWordPressRequest('GET', 'fc-manager/v1/courses/my-courses', params);
|
|
354
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
355
|
+
}
|
|
356
|
+
catch (error) {
|
|
357
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
// Quizzes
|
|
361
|
+
fc_list_quizzes: async (args) => {
|
|
362
|
+
try {
|
|
363
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/courses/${args.course_id}/quizzes`, { per_page: args.limit || 50 });
|
|
364
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
365
|
+
}
|
|
366
|
+
catch (error) {
|
|
367
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
fc_get_quiz: async (args) => {
|
|
371
|
+
try {
|
|
372
|
+
const response = await makeWordPressRequest('GET', `fc-manager/v1/courses/${args.course_id}/quizzes/${args.id}`);
|
|
373
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
374
|
+
}
|
|
375
|
+
catch (error) {
|
|
376
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
fc_create_quiz: async (args) => {
|
|
380
|
+
try {
|
|
381
|
+
const { course_id, ...quizData } = args;
|
|
382
|
+
const response = await makeWordPressRequest('POST', `fc-manager/v1/courses/${course_id}/quizzes`, quizData);
|
|
383
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
384
|
+
}
|
|
385
|
+
catch (error) {
|
|
386
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
fc_update_quiz: async (args) => {
|
|
390
|
+
try {
|
|
391
|
+
const { course_id, id, ...updateData } = args;
|
|
392
|
+
const response = await makeWordPressRequest('PUT', `fc-manager/v1/courses/${course_id}/quizzes/${id}`, updateData);
|
|
393
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
394
|
+
}
|
|
395
|
+
catch (error) {
|
|
396
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
fc_delete_quiz: async (args) => {
|
|
400
|
+
try {
|
|
401
|
+
const response = await makeWordPressRequest('DELETE', `fc-manager/v1/courses/${args.course_id}/quizzes/${args.id}`);
|
|
402
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
403
|
+
}
|
|
404
|
+
catch (error) {
|
|
405
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
// Media
|
|
409
|
+
fc_list_media: async (args) => {
|
|
410
|
+
try {
|
|
411
|
+
const response = await makeWordPressRequest('GET', 'fc-manager/v1/media', { per_page: args.limit || 50 });
|
|
412
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
413
|
+
}
|
|
414
|
+
catch (error) {
|
|
415
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
fc_upload_media: async (args) => {
|
|
419
|
+
try {
|
|
420
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/media', args);
|
|
421
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
422
|
+
}
|
|
423
|
+
catch (error) {
|
|
424
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
425
|
+
}
|
|
426
|
+
},
|
|
427
|
+
// Giphy
|
|
428
|
+
fc_search_giphy: async (args) => {
|
|
429
|
+
try {
|
|
430
|
+
const params = { query: args.query, limit: args.limit || 20 };
|
|
431
|
+
const response = await makeWordPressRequest('GET', 'fc-manager/v1/giphy/search', params);
|
|
432
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
433
|
+
}
|
|
434
|
+
catch (error) {
|
|
435
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
// Webhooks
|
|
439
|
+
fc_list_webhooks: async (args) => {
|
|
440
|
+
try {
|
|
441
|
+
const response = await makeWordPressRequest('GET', 'fc-manager/v1/webhooks', { per_page: args.limit || 50 });
|
|
442
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
443
|
+
}
|
|
444
|
+
catch (error) {
|
|
445
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
fc_create_webhook: async (args) => {
|
|
449
|
+
try {
|
|
450
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/webhooks', args);
|
|
451
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
452
|
+
}
|
|
453
|
+
catch (error) {
|
|
454
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
455
|
+
}
|
|
456
|
+
},
|
|
457
|
+
fc_delete_webhook: async (args) => {
|
|
458
|
+
try {
|
|
459
|
+
const response = await makeWordPressRequest('DELETE', `fc-manager/v1/webhooks/${args.id}`);
|
|
460
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
461
|
+
}
|
|
462
|
+
catch (error) {
|
|
463
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
// Leaderboard
|
|
467
|
+
fc_get_leaderboard: async (args) => {
|
|
468
|
+
try {
|
|
469
|
+
const params = { per_page: args.limit || 50 };
|
|
470
|
+
if (args.period)
|
|
471
|
+
params.period = args.period;
|
|
472
|
+
const response = await makeWordPressRequest('GET', 'fc-manager/v1/leaderboard', params);
|
|
473
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
474
|
+
}
|
|
475
|
+
catch (error) {
|
|
476
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
fc_add_points: async (args) => {
|
|
480
|
+
try {
|
|
481
|
+
const response = await makeWordPressRequest('POST', 'fc-manager/v1/leaderboard/points', args);
|
|
482
|
+
return { toolResult: { content: [{ type: 'text', text: JSON.stringify(response, null, 2) }] } };
|
|
483
|
+
}
|
|
484
|
+
catch (error) {
|
|
485
|
+
return { toolResult: { isError: true, content: [{ type: 'text', text: `Error: ${error.message}` }] } };
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
};
|
package/build/tools/index.js
CHANGED
|
@@ -20,6 +20,8 @@ import { fluentCartLicensingTools, fluentCartLicensingHandlers } from './fluent-
|
|
|
20
20
|
import { fluentCartAdminTools, fluentCartAdminHandlers } from './fluent-cart-admin.js';
|
|
21
21
|
import { fluentCommunityChatTools, fluentCommunityChatHandlers } from './fluent-community-chat.js';
|
|
22
22
|
import { fluentCommunityAdminTools, fluentCommunityAdminHandlers } from './fluent-community-admin.js';
|
|
23
|
+
import { fluentCommunityCoreTools, fluentCommunityCoreHandlers } from './fluent-community-core.js';
|
|
24
|
+
import { fluentCommunityLearningTools, fluentCommunityLearningHandlers } from './fluent-community-learning.js';
|
|
23
25
|
// Tool categories for selective loading
|
|
24
26
|
const toolCategories = {
|
|
25
27
|
wordpress: [
|
|
@@ -31,6 +33,7 @@ const toolCategories = {
|
|
|
31
33
|
...pluginRepositoryTools,
|
|
32
34
|
...commentTools
|
|
33
35
|
],
|
|
36
|
+
// Full FluentCommunity (91 tools) - legacy support
|
|
34
37
|
fluentcommunity: [
|
|
35
38
|
...fluentCommunityTools,
|
|
36
39
|
...fluentCommunityDesignTools,
|
|
@@ -38,6 +41,18 @@ const toolCategories = {
|
|
|
38
41
|
...fluentCommunityChatTools,
|
|
39
42
|
...fluentCommunityAdminTools
|
|
40
43
|
],
|
|
44
|
+
// COMM1 - Community Core (55 tools) - posts, spaces, members, engagement
|
|
45
|
+
'fluentcommunity-core': [
|
|
46
|
+
...fluentCommunityCoreTools,
|
|
47
|
+
...fluentCommunityChatTools // Chat is part of core community
|
|
48
|
+
],
|
|
49
|
+
// COMM2 - Learning & Admin (36 tools) - courses, lessons, settings
|
|
50
|
+
'fluentcommunity-learning': [
|
|
51
|
+
...fluentCommunityLearningTools,
|
|
52
|
+
...fluentCommunityDesignTools,
|
|
53
|
+
...fluentCommunityLayoutTools,
|
|
54
|
+
...fluentCommunityAdminTools
|
|
55
|
+
],
|
|
41
56
|
fluentcart: [
|
|
42
57
|
...fluentCartTools,
|
|
43
58
|
...fluentCartAnalyticsTools,
|
|
@@ -74,6 +89,16 @@ const handlerCategories = {
|
|
|
74
89
|
...fluentCommunityChatHandlers,
|
|
75
90
|
...fluentCommunityAdminHandlers
|
|
76
91
|
},
|
|
92
|
+
'fluentcommunity-core': {
|
|
93
|
+
...fluentCommunityCoreHandlers,
|
|
94
|
+
...fluentCommunityChatHandlers
|
|
95
|
+
},
|
|
96
|
+
'fluentcommunity-learning': {
|
|
97
|
+
...fluentCommunityLearningHandlers,
|
|
98
|
+
...fluentCommunityDesignHandlers,
|
|
99
|
+
...fluentCommunityLayoutHandlers,
|
|
100
|
+
...fluentCommunityAdminHandlers
|
|
101
|
+
},
|
|
77
102
|
fluentcart: {
|
|
78
103
|
...fluentCartHandlers,
|
|
79
104
|
...fluentCartAnalyticsHandlers,
|
|
@@ -93,11 +118,11 @@ const handlerCategories = {
|
|
|
93
118
|
...debugHandlers
|
|
94
119
|
}
|
|
95
120
|
};
|
|
96
|
-
// Filter tools based on
|
|
121
|
+
// Filter tools based on ENABLED_TOOLS environment variable
|
|
97
122
|
function getFilteredTools() {
|
|
98
|
-
const
|
|
99
|
-
if (!
|
|
100
|
-
// No filter - load all tools
|
|
123
|
+
const enabledTools = process.env.ENABLED_TOOLS?.toLowerCase();
|
|
124
|
+
if (!enabledTools || enabledTools === 'all') {
|
|
125
|
+
// No filter or 'all' - load all tools
|
|
101
126
|
return [
|
|
102
127
|
...toolCategories.wordpress,
|
|
103
128
|
...toolCategories.fluentcommunity,
|
|
@@ -107,13 +132,28 @@ function getFilteredTools() {
|
|
|
107
132
|
...toolCategories.debug
|
|
108
133
|
];
|
|
109
134
|
}
|
|
110
|
-
//
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
135
|
+
// Map user-friendly names to internal category names
|
|
136
|
+
const categoryMap = {
|
|
137
|
+
'wordpress': 'wordpress',
|
|
138
|
+
'fluent-community': 'fluentcommunity',
|
|
139
|
+
'fluentcommunity': 'fluentcommunity',
|
|
140
|
+
'fluentcommunity-core': 'fluentcommunity-core',
|
|
141
|
+
'fluent-community-core': 'fluentcommunity-core',
|
|
142
|
+
'fluentcommunity-learning': 'fluentcommunity-learning',
|
|
143
|
+
'fluent-community-learning': 'fluentcommunity-learning',
|
|
144
|
+
'fluent-cart': 'fluentcart',
|
|
145
|
+
'fluentcart': 'fluentcart',
|
|
146
|
+
'fluent-crm': 'fluentcrm',
|
|
147
|
+
'fluentcrm': 'fluentcrm',
|
|
148
|
+
'mlplugins': 'mlplugins',
|
|
149
|
+
'debug': 'debug'
|
|
150
|
+
};
|
|
151
|
+
const category = categoryMap[enabledTools];
|
|
152
|
+
if (category && toolCategories[category]) {
|
|
153
|
+
console.error(`📦 Loading only: ${enabledTools} (${toolCategories[category].length} tools)`);
|
|
114
154
|
return toolCategories[category];
|
|
115
155
|
}
|
|
116
|
-
console.error(`⚠️ Unknown
|
|
156
|
+
console.error(`⚠️ Unknown ENABLED_TOOLS value: ${enabledTools}. Loading all tools.`);
|
|
117
157
|
return [
|
|
118
158
|
...toolCategories.wordpress,
|
|
119
159
|
...toolCategories.fluentcommunity,
|
|
@@ -124,9 +164,9 @@ function getFilteredTools() {
|
|
|
124
164
|
];
|
|
125
165
|
}
|
|
126
166
|
function getFilteredHandlers() {
|
|
127
|
-
const
|
|
128
|
-
if (!
|
|
129
|
-
// No filter - load all handlers
|
|
167
|
+
const enabledTools = process.env.ENABLED_TOOLS?.toLowerCase();
|
|
168
|
+
if (!enabledTools || enabledTools === 'all') {
|
|
169
|
+
// No filter or 'all' - load all handlers
|
|
130
170
|
return {
|
|
131
171
|
...handlerCategories.wordpress,
|
|
132
172
|
...handlerCategories.fluentcommunity,
|
|
@@ -136,9 +176,24 @@ function getFilteredHandlers() {
|
|
|
136
176
|
...handlerCategories.debug
|
|
137
177
|
};
|
|
138
178
|
}
|
|
139
|
-
//
|
|
140
|
-
const
|
|
141
|
-
|
|
179
|
+
// Map user-friendly names to internal category names
|
|
180
|
+
const categoryMap = {
|
|
181
|
+
'wordpress': 'wordpress',
|
|
182
|
+
'fluent-community': 'fluentcommunity',
|
|
183
|
+
'fluentcommunity': 'fluentcommunity',
|
|
184
|
+
'fluentcommunity-core': 'fluentcommunity-core',
|
|
185
|
+
'fluent-community-core': 'fluentcommunity-core',
|
|
186
|
+
'fluentcommunity-learning': 'fluentcommunity-learning',
|
|
187
|
+
'fluent-community-learning': 'fluentcommunity-learning',
|
|
188
|
+
'fluent-cart': 'fluentcart',
|
|
189
|
+
'fluentcart': 'fluentcart',
|
|
190
|
+
'fluent-crm': 'fluentcrm',
|
|
191
|
+
'fluentcrm': 'fluentcrm',
|
|
192
|
+
'mlplugins': 'mlplugins',
|
|
193
|
+
'debug': 'debug'
|
|
194
|
+
};
|
|
195
|
+
const category = categoryMap[enabledTools];
|
|
196
|
+
if (category && handlerCategories[category]) {
|
|
142
197
|
return handlerCategories[category];
|
|
143
198
|
}
|
|
144
199
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wplaunchify/ml-mcp-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
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",
|