@connect-xlab/mcp-server 0.2.1 → 0.3.1

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.
Files changed (52) hide show
  1. package/dist/index.js +95 -0
  2. package/dist/tools/approveAssistantAction.js +40 -0
  3. package/dist/tools/correctAssistantAction.js +36 -0
  4. package/dist/tools/createDmSequence.js +36 -0
  5. package/dist/tools/createLinkInBioBlock.js +27 -18
  6. package/dist/tools/createQuiz.js +38 -0
  7. package/dist/tools/createQuizAnswer.js +42 -0
  8. package/dist/tools/createQuizItem.js +46 -0
  9. package/dist/tools/createQuizProfile.js +50 -0
  10. package/dist/tools/createShopProduct.js +7 -5
  11. package/dist/tools/deleteQuiz.js +33 -0
  12. package/dist/tools/deleteQuizAnswer.js +37 -0
  13. package/dist/tools/deleteQuizItem.js +35 -0
  14. package/dist/tools/deleteQuizProfile.js +35 -0
  15. package/dist/tools/getAssistantAction.js +33 -0
  16. package/dist/tools/getAssistantProducts.js +31 -0
  17. package/dist/tools/getAssistantSettings.js +31 -0
  18. package/dist/tools/getAssistantSummary.js +36 -0
  19. package/dist/tools/getDmSequence.js +33 -0
  20. package/dist/tools/getDmSequenceSettings.js +31 -0
  21. package/dist/tools/getDmSequenceStats.js +38 -0
  22. package/dist/tools/getLinkInBioCatalog.js +31 -0
  23. package/dist/tools/getQuiz.js +33 -0
  24. package/dist/tools/getQuizLead.js +35 -0
  25. package/dist/tools/getQuizSettings.js +31 -0
  26. package/dist/tools/getQuizStats.js +33 -0
  27. package/dist/tools/listAssistantActions.js +40 -0
  28. package/dist/tools/listDmEnrollments.js +40 -0
  29. package/dist/tools/listDmSequenceTargetPosts.js +31 -0
  30. package/dist/tools/listDmSequences.js +31 -0
  31. package/dist/tools/listQuizLeads.js +48 -0
  32. package/dist/tools/listQuizTemplates.js +31 -0
  33. package/dist/tools/listQuizzes.js +31 -0
  34. package/dist/tools/manageDmEnrollment.js +36 -0
  35. package/dist/tools/previewDmSequence.js +40 -0
  36. package/dist/tools/rejectAssistantAction.js +33 -0
  37. package/dist/tools/reorderQuizItems.js +36 -0
  38. package/dist/tools/requestAssistantPostDraft.js +38 -0
  39. package/dist/tools/setDmSequenceStatus.js +36 -0
  40. package/dist/tools/setQuizPublished.js +35 -0
  41. package/dist/tools/updateAssistantProducts.js +34 -0
  42. package/dist/tools/updateAssistantSettings.js +90 -0
  43. package/dist/tools/updateDmSequence.js +44 -0
  44. package/dist/tools/updateDmSequenceSettings.js +44 -0
  45. package/dist/tools/updateLinkInBioBlock.js +13 -8
  46. package/dist/tools/updateQuiz.js +56 -0
  47. package/dist/tools/updateQuizAnswer.js +44 -0
  48. package/dist/tools/updateQuizItem.js +46 -0
  49. package/dist/tools/updateQuizProfile.js +52 -0
  50. package/dist/tools/updateQuizSettings.js +34 -0
  51. package/dist/tools/updateShopProduct.js +7 -5
  52. package/package.json +1 -1
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Tool `update_quiz_answer` — modifie une reponse.
3
+ * Scope : quiz.write.
4
+ */
5
+ import { z } from 'zod';
6
+ import { http, formatApiError } from '../http.js';
7
+ export const updateQuizAnswerTool = {
8
+ name: 'update_quiz_answer',
9
+ description: "Modifie une reponse (label, points 0-4, profile_id). Seuls les champs fournis changent.",
10
+ inputSchema: {
11
+ type: 'object',
12
+ properties: {
13
+ lab: { type: 'string', description: 'group_url ou id du Lab' },
14
+ quiz_id: { type: 'number', minimum: 1, description: 'id du quiz (list_quizzes)' },
15
+ item_id: { type: 'number', minimum: 1, description: 'id de la question / page (get_quiz)' },
16
+ answer_id: { type: 'number', minimum: 1, description: 'id de la reponse (get_quiz)' },
17
+ label: { type: 'string', maxLength: 300 },
18
+ points: { type: 'number', minimum: 0, maximum: 4 },
19
+ profile_id: { type: 'number', minimum: 1 },
20
+ },
21
+ required: ['lab', 'quiz_id', 'item_id', 'answer_id'],
22
+ additionalProperties: false,
23
+ },
24
+ zodSchema: z.object({
25
+ lab: z.string(),
26
+ quiz_id: z.number().int().positive(),
27
+ item_id: z.number().int().positive(),
28
+ answer_id: z.number().int().positive(),
29
+ label: z.string().max(300).nullable().optional(),
30
+ points: z.number().int().min(0).max(4).optional(),
31
+ profile_id: z.number().int().min(1).nullable().optional(),
32
+ }),
33
+ async handler(args) {
34
+ const { lab, quiz_id, item_id, answer_id, ...body } = this.zodSchema.parse(args);
35
+ const p = { lab, quiz_id, item_id, answer_id };
36
+ try {
37
+ const { data } = await http.put(`/mcp/labs/${encodeURIComponent(p.lab)}/quiz/quizzes/${p.quiz_id}/items/${p.item_id}/answers/${p.answer_id}`, body);
38
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
39
+ }
40
+ catch (err) {
41
+ return { isError: true, content: [{ type: 'text', text: formatApiError(err) }] };
42
+ }
43
+ },
44
+ };
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Tool `update_quiz_item` — modifie une question / page.
3
+ * Scope : quiz.write.
4
+ */
5
+ import { z } from 'zod';
6
+ import { http, formatApiError } from '../http.js';
7
+ export const updateQuizItemTool = {
8
+ name: 'update_quiz_item',
9
+ description: "Modifie une question ou page intermediaire (seuls les champs fournis changent). Le type (kind) ne se change pas.",
10
+ inputSchema: {
11
+ type: 'object',
12
+ properties: {
13
+ lab: { type: 'string', description: 'group_url ou id du Lab' },
14
+ quiz_id: { type: 'number', minimum: 1, description: 'id du quiz (list_quizzes)' },
15
+ item_id: { type: 'number', minimum: 1, description: 'id de la question / page (get_quiz)' },
16
+ title: { type: 'string', maxLength: 500 },
17
+ body: { type: 'string' },
18
+ image_path: { type: 'string', maxLength: 255 },
19
+ button_label: { type: 'string', maxLength: 120 },
20
+ key: { type: 'string', maxLength: 60 },
21
+ },
22
+ required: ['lab', 'quiz_id', 'item_id'],
23
+ additionalProperties: false,
24
+ },
25
+ zodSchema: z.object({
26
+ lab: z.string(),
27
+ quiz_id: z.number().int().positive(),
28
+ item_id: z.number().int().positive(),
29
+ title: z.string().max(500).nullable().optional(),
30
+ body: z.string().nullable().optional(),
31
+ image_path: z.string().max(255).nullable().optional(),
32
+ button_label: z.string().max(120).nullable().optional(),
33
+ key: z.string().max(60).nullable().optional(),
34
+ }),
35
+ async handler(args) {
36
+ const { lab, quiz_id, item_id, ...body } = this.zodSchema.parse(args);
37
+ const p = { lab, quiz_id, item_id };
38
+ try {
39
+ const { data } = await http.put(`/mcp/labs/${encodeURIComponent(p.lab)}/quiz/quizzes/${p.quiz_id}/items/${p.item_id}`, body);
40
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
41
+ }
42
+ catch (err) {
43
+ return { isError: true, content: [{ type: 'text', text: formatApiError(err) }] };
44
+ }
45
+ },
46
+ };
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Tool `update_quiz_profile` — modifie un profil de resultat.
3
+ * Scope : quiz.write.
4
+ */
5
+ import { z } from 'zod';
6
+ import { http, formatApiError } from '../http.js';
7
+ export const updateQuizProfileTool = {
8
+ name: 'update_quiz_profile',
9
+ description: "Modifie un profil de resultat (seuls les champs fournis changent). Memes champs que create_quiz_profile.",
10
+ inputSchema: {
11
+ type: 'object',
12
+ properties: {
13
+ lab: { type: 'string', description: 'group_url ou id du Lab' },
14
+ quiz_id: { type: 'number', minimum: 1, description: 'id du quiz (list_quizzes)' },
15
+ profile_id: { type: 'number', minimum: 1, description: 'id du profil de resultat (get_quiz)' },
16
+ name: { type: 'string', maxLength: 120 },
17
+ color: { type: 'string', maxLength: 16 },
18
+ diagnosis: { type: 'string' },
19
+ video_url: { type: 'string', maxLength: 500 },
20
+ plan: { type: 'array', maxItems: 5, items: { type: 'object', properties: { text: { type: 'string' }, locked: { type: 'boolean' } }, required: ['text', 'locked'] } },
21
+ cta_label: { type: 'string', maxLength: 120 },
22
+ destination_type: { type: 'string', enum: ['product', 'join', 'calendar', 'url'] },
23
+ destination_ref: { type: 'string', maxLength: 255 },
24
+ },
25
+ required: ['lab', 'quiz_id', 'profile_id'],
26
+ additionalProperties: false,
27
+ },
28
+ zodSchema: z.object({
29
+ lab: z.string(),
30
+ quiz_id: z.number().int().positive(),
31
+ profile_id: z.number().int().positive(),
32
+ name: z.string().max(120).nullable().optional(),
33
+ color: z.string().max(16).nullable().optional(),
34
+ diagnosis: z.string().nullable().optional(),
35
+ video_url: z.string().max(500).nullable().optional(),
36
+ plan: z.array(z.object({ text: z.string(), locked: z.boolean() })).max(5).nullable().optional(),
37
+ cta_label: z.string().max(120).nullable().optional(),
38
+ destination_type: z.enum(['product', 'join', 'calendar', 'url']).optional(),
39
+ destination_ref: z.string().max(255).nullable().optional(),
40
+ }),
41
+ async handler(args) {
42
+ const { lab, quiz_id, profile_id, ...body } = this.zodSchema.parse(args);
43
+ const p = { lab, quiz_id, profile_id };
44
+ try {
45
+ const { data } = await http.put(`/mcp/labs/${encodeURIComponent(p.lab)}/quiz/quizzes/${p.quiz_id}/profiles/${p.profile_id}`, body);
46
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
47
+ }
48
+ catch (err) {
49
+ return { isError: true, content: [{ type: 'text', text: formatApiError(err) }] };
50
+ }
51
+ },
52
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Tool `update_quiz_settings` — active / desactive le plug-in Quiz.
3
+ * Scope : quiz.write.
4
+ */
5
+ import { z } from 'zod';
6
+ import { http, formatApiError } from '../http.js';
7
+ export const updateQuizSettingsTool = {
8
+ name: 'update_quiz_settings',
9
+ description: "Active ou desactive le plug-in Quiz du Lab. Desactive, plus aucun quiz n'est accessible publiquement (meme publie).",
10
+ inputSchema: {
11
+ type: 'object',
12
+ properties: {
13
+ lab: { type: 'string', description: 'group_url ou id du Lab' },
14
+ enabled: { type: 'boolean' },
15
+ },
16
+ required: ['lab', 'enabled'],
17
+ additionalProperties: false,
18
+ },
19
+ zodSchema: z.object({
20
+ lab: z.string(),
21
+ enabled: z.boolean(),
22
+ }),
23
+ async handler(args) {
24
+ const { lab, ...body } = this.zodSchema.parse(args);
25
+ const p = { lab };
26
+ try {
27
+ const { data } = await http.put(`/mcp/labs/${encodeURIComponent(p.lab)}/quiz/settings`, body);
28
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
29
+ }
30
+ catch (err) {
31
+ return { isError: true, content: [{ type: 'text', text: formatApiError(err) }] };
32
+ }
33
+ },
34
+ };
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { http, formatApiError } from '../http.js';
3
3
  export const updateShopProductTool = {
4
4
  name: 'update_shop_product',
5
- description: "Modifie un produit boutique (titre, prix, description, publication, type d'offre). Champs optionnels. Prix en centimes. Passe offer_type=formation + course_id (list_classes) pour que l'achat debloque un cours ; tout autre offer_type detache le cours lie.",
5
+ description: "Modifie un produit boutique (titre, prix, description, publication, type d'offre, quiz embarque). Champs optionnels. Prix en centimes. Paiement toujours via Stripe ConnectXLab. Passe offer_type=formation + course_id (list_classes) pour que l'achat debloque un cours ; tout autre offer_type detache le cours lie. offer_type=digital : quiz_id (list_quizzes, null pour retirer), quiz_cta_label, quiz_cta_subtext ; tout autre type detache le quiz.",
6
6
  inputSchema: {
7
7
  type: 'object',
8
8
  properties: {
@@ -14,9 +14,10 @@ export const updateShopProductTool = {
14
14
  price_cents: { type: 'number', minimum: 0 },
15
15
  offer_type: { type: 'string', enum: ['digital', 'calendar', 'formation'] },
16
16
  course_id: { type: 'number', description: "Id d'un cours du Lab (list_classes) — requis/utilise quand offer_type=formation." },
17
- payment_mode: { type: 'string', enum: ['external', 'stripe'] },
18
- payment_link_text: { type: 'string', maxLength: 255 },
19
17
  support_email: { type: 'string', format: 'email' },
18
+ quiz_id: { type: ['number', 'null'], description: 'offer_type=digital : id du quiz a embarquer (list_quizzes), null pour le retirer' },
19
+ quiz_cta_label: { type: 'string', maxLength: 150 },
20
+ quiz_cta_subtext: { type: 'string', maxLength: 500 },
20
21
  is_published: { type: 'boolean' },
21
22
  },
22
23
  required: ['lab', 'shop_id'],
@@ -31,9 +32,10 @@ export const updateShopProductTool = {
31
32
  price_cents: z.number().int().min(0).nullable().optional(),
32
33
  offer_type: z.enum(['digital', 'calendar', 'formation']).optional(),
33
34
  course_id: z.number().int().positive().nullable().optional(),
34
- payment_mode: z.enum(['external', 'stripe']).optional(),
35
- payment_link_text: z.string().max(255).nullable().optional(),
36
35
  support_email: z.string().email().nullable().optional(),
36
+ quiz_id: z.number().int().positive().nullable().optional(),
37
+ quiz_cta_label: z.string().max(150).nullable().optional(),
38
+ quiz_cta_subtext: z.string().max(500).nullable().optional(),
37
39
  is_published: z.boolean().optional(),
38
40
  }),
39
41
  async handler(args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connect-xlab/mcp-server",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "Serveur MCP pour piloter ton Lab ConnectXLab depuis Claude Desktop / Cursor / n'importe quel client MCP.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",