@lyrra/mcp-server 1.0.0 → 1.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.
Files changed (87) hide show
  1. package/Dockerfile +16 -0
  2. package/README.md +59 -4
  3. package/dist/client.d.ts +7 -1
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +5 -5
  6. package/dist/client.js.map +1 -1
  7. package/dist/config.d.ts +1 -0
  8. package/dist/config.d.ts.map +1 -1
  9. package/dist/config.js +1 -0
  10. package/dist/config.js.map +1 -1
  11. package/dist/http-server.d.ts +8 -0
  12. package/dist/http-server.d.ts.map +1 -0
  13. package/dist/http-server.js +466 -0
  14. package/dist/http-server.js.map +1 -0
  15. package/dist/index.js +8 -71
  16. package/dist/index.js.map +1 -1
  17. package/dist/server-factory.d.ts +8 -0
  18. package/dist/server-factory.d.ts.map +1 -0
  19. package/dist/server-factory.js +82 -0
  20. package/dist/server-factory.js.map +1 -0
  21. package/dist/tools/admin.d.ts +132 -0
  22. package/dist/tools/admin.d.ts.map +1 -1
  23. package/dist/tools/admin.js +105 -101
  24. package/dist/tools/admin.js.map +1 -1
  25. package/dist/tools/ai-designer.d.ts +148 -0
  26. package/dist/tools/ai-designer.d.ts.map +1 -1
  27. package/dist/tools/ai-designer.js +80 -76
  28. package/dist/tools/ai-designer.js.map +1 -1
  29. package/dist/tools/analytics.d.ts +47 -0
  30. package/dist/tools/analytics.d.ts.map +1 -1
  31. package/dist/tools/analytics.js +38 -34
  32. package/dist/tools/analytics.js.map +1 -1
  33. package/dist/tools/auth.d.ts +30 -0
  34. package/dist/tools/auth.d.ts.map +1 -1
  35. package/dist/tools/auth.js +31 -27
  36. package/dist/tools/auth.js.map +1 -1
  37. package/dist/tools/blocks.d.ts +200 -0
  38. package/dist/tools/blocks.d.ts.map +1 -1
  39. package/dist/tools/blocks.js +154 -150
  40. package/dist/tools/blocks.js.map +1 -1
  41. package/dist/tools/connections.d.ts +86 -0
  42. package/dist/tools/connections.d.ts.map +1 -1
  43. package/dist/tools/connections.js +70 -66
  44. package/dist/tools/connections.js.map +1 -1
  45. package/dist/tools/eduflow.d.ts +223 -0
  46. package/dist/tools/eduflow.d.ts.map +1 -1
  47. package/dist/tools/eduflow.js +114 -93
  48. package/dist/tools/eduflow.js.map +1 -1
  49. package/dist/tools/participants.d.ts +110 -0
  50. package/dist/tools/participants.d.ts.map +1 -1
  51. package/dist/tools/participants.js +62 -58
  52. package/dist/tools/participants.js.map +1 -1
  53. package/dist/tools/presentation.d.ts +116 -0
  54. package/dist/tools/presentation.d.ts.map +1 -1
  55. package/dist/tools/presentation.js +51 -47
  56. package/dist/tools/presentation.js.map +1 -1
  57. package/dist/tools/projects.d.ts +65 -0
  58. package/dist/tools/projects.d.ts.map +1 -1
  59. package/dist/tools/projects.js +48 -44
  60. package/dist/tools/projects.js.map +1 -1
  61. package/dist/tools/resources.d.ts +46 -0
  62. package/dist/tools/resources.d.ts.map +1 -1
  63. package/dist/tools/resources.js +32 -28
  64. package/dist/tools/resources.js.map +1 -1
  65. package/dist/tools/store.d.ts +62 -0
  66. package/dist/tools/store.d.ts.map +1 -1
  67. package/dist/tools/store.js +59 -55
  68. package/dist/tools/store.js.map +1 -1
  69. package/mcp-config.example.json +4 -5
  70. package/package.json +7 -2
  71. package/src/client.ts +12 -5
  72. package/src/config.ts +1 -0
  73. package/src/http-server.ts +573 -0
  74. package/src/index.ts +7 -96
  75. package/src/server-factory.ts +109 -0
  76. package/src/tools/admin.ts +20 -14
  77. package/src/tools/ai-designer.ts +16 -10
  78. package/src/tools/analytics.ts +13 -7
  79. package/src/tools/auth.ts +32 -26
  80. package/src/tools/blocks.ts +18 -12
  81. package/src/tools/connections.ts +14 -8
  82. package/src/tools/eduflow.ts +36 -12
  83. package/src/tools/participants.ts +15 -9
  84. package/src/tools/presentation.ts +12 -6
  85. package/src/tools/projects.ts +14 -8
  86. package/src/tools/resources.ts +12 -6
  87. package/src/tools/store.ts +14 -8
@@ -1,12 +1,15 @@
1
1
  import { z } from 'zod';
2
- import { client } from '../client.js';
2
+ import { LyrraClient } from '../client.js';
3
+ import { client as defaultClient } from '../client.js';
4
+ import { config } from '../config.js';
3
5
 
4
- export const eduflowTools = {
6
+ export function createEduflowTools(c: LyrraClient) {
7
+ return {
5
8
  eduflow_list: {
6
9
  description: 'Lister tous les parcours EduFlow de l\'utilisateur. Retourne id, titre, statut, nombre de blocs, dates.',
7
10
  inputSchema: z.object({}),
8
11
  handler: async () => {
9
- return client.get('/flows', 'eduflow');
12
+ return c.get('/flows', 'eduflow');
10
13
  },
11
14
  },
12
15
 
@@ -16,7 +19,24 @@ export const eduflowTools = {
16
19
  flowId: z.string().uuid().describe('ID du parcours EduFlow'),
17
20
  }),
18
21
  handler: async ({ flowId }: { flowId: string }) => {
19
- return client.get(`/flows/${flowId}`, 'eduflow');
22
+ return c.get(`/flows/${flowId}`, 'eduflow');
23
+ },
24
+ },
25
+
26
+ eduflow_get_urls: {
27
+ description: 'Obtenir tous les liens utiles d\'un parcours EduFlow : prévisualisation, édition, page publique, analytics, lien participant. À utiliser quand l\'utilisateur demande un lien ou une URL.',
28
+ inputSchema: z.object({
29
+ flowId: z.string().uuid().describe('ID du parcours EduFlow'),
30
+ }),
31
+ handler: async ({ flowId }: { flowId: string }) => {
32
+ const base = config.frontendUrl;
33
+ return {
34
+ preview: `${base}/eduflow/flows/${flowId}/play`,
35
+ public: `${base}/eduflow/flows/${flowId}/public`,
36
+ edit: `${base}/eduflow/edit/${flowId}`,
37
+ presentation: `${base}/eduflow/edit/${flowId}/presentation`,
38
+ analytics: `${base}/eduflow/flows/${flowId}/analytics`,
39
+ };
20
40
  },
21
41
  },
22
42
 
@@ -28,7 +48,7 @@ export const eduflowTools = {
28
48
  language: z.enum(['fr', 'en', 'es', 'it', 'de']).optional().describe('Langue du parcours (défaut: fr)'),
29
49
  }),
30
50
  handler: async (args: { title: string; description?: string; language?: string }) => {
31
- return client.post('/flows', args, 'eduflow');
51
+ return c.post('/flows', args, 'eduflow');
32
52
  },
33
53
  },
34
54
 
@@ -55,7 +75,7 @@ export const eduflowTools = {
55
75
  language: z.enum(['fr', 'en', 'es', 'it', 'de']).optional().describe('Langue du parcours'),
56
76
  }),
57
77
  handler: async ({ flowId, ...data }: any) => {
58
- return client.put(`/flows/${flowId}`, data, 'eduflow');
78
+ return c.put(`/flows/${flowId}`, data, 'eduflow');
59
79
  },
60
80
  },
61
81
 
@@ -65,7 +85,7 @@ export const eduflowTools = {
65
85
  flowId: z.string().uuid().describe('ID du parcours à supprimer'),
66
86
  }),
67
87
  handler: async ({ flowId }: { flowId: string }) => {
68
- return client.delete(`/flows/${flowId}`, 'eduflow');
88
+ return c.delete(`/flows/${flowId}`, 'eduflow');
69
89
  },
70
90
  },
71
91
 
@@ -75,7 +95,7 @@ export const eduflowTools = {
75
95
  flowId: z.string().uuid().describe('ID du parcours à dupliquer'),
76
96
  }),
77
97
  handler: async ({ flowId }: { flowId: string }) => {
78
- return client.post(`/flows/${flowId}/duplicate`, {}, 'eduflow');
98
+ return c.post(`/flows/${flowId}/duplicate`, {}, 'eduflow');
79
99
  },
80
100
  },
81
101
 
@@ -86,7 +106,7 @@ export const eduflowTools = {
86
106
  status: z.enum(['draft', 'published', 'archived']).describe('Nouveau statut'),
87
107
  }),
88
108
  handler: async ({ flowId, status }: { flowId: string; status: string }) => {
89
- return client.patch(`/flows/${flowId}/status`, { status }, 'eduflow');
109
+ return c.patch(`/flows/${flowId}/status`, { status }, 'eduflow');
90
110
  },
91
111
  },
92
112
 
@@ -96,7 +116,7 @@ export const eduflowTools = {
96
116
  flowId: z.string().uuid().describe('ID du parcours à exporter'),
97
117
  }),
98
118
  handler: async ({ flowId }: { flowId: string }) => {
99
- return client.get(`/flows/${flowId}/export`, 'eduflow');
119
+ return c.get(`/flows/${flowId}/export`, 'eduflow');
100
120
  },
101
121
  },
102
122
 
@@ -106,7 +126,11 @@ export const eduflowTools = {
106
126
  flowId: z.string().uuid().describe('ID du parcours'),
107
127
  }),
108
128
  handler: async ({ flowId }: { flowId: string }) => {
109
- return client.get(`/flows/${flowId}/public`, 'eduflow');
129
+ return c.get(`/flows/${flowId}/public`, 'eduflow');
110
130
  },
111
131
  },
112
- };
132
+ };
133
+ }
134
+
135
+ // Backward compatibility for stdio mode
136
+ export const eduflowTools = createEduflowTools(defaultClient);
@@ -1,14 +1,16 @@
1
1
  import { z } from 'zod';
2
- import { client } from '../client.js';
2
+ import { LyrraClient } from '../client.js';
3
+ import { client as defaultClient } from '../client.js';
3
4
 
4
- export const participantsTools = {
5
+ export function createParticipantsTools(c: LyrraClient) {
6
+ return {
5
7
  participant_list: {
6
8
  description: 'Lister tous les participants/étudiants inscrits à un parcours EduFlow avec leur progression.',
7
9
  inputSchema: z.object({
8
10
  flowId: z.string().uuid().describe('ID du parcours'),
9
11
  }),
10
12
  handler: async ({ flowId }: { flowId: string }) => {
11
- return client.get(`/flows/${flowId}/students`, 'eduflow');
13
+ return c.get(`/flows/${flowId}/students`, 'eduflow');
12
14
  },
13
15
  },
14
16
 
@@ -23,7 +25,7 @@ export const participantsTools = {
23
25
  })).describe('Liste des participants à ajouter'),
24
26
  }),
25
27
  handler: async ({ flowId, participants }: any) => {
26
- return client.post(`/flows/${flowId}/students`, { students: participants }, 'eduflow');
28
+ return c.post(`/flows/${flowId}/students`, { students: participants }, 'eduflow');
27
29
  },
28
30
  },
29
31
 
@@ -34,7 +36,7 @@ export const participantsTools = {
34
36
  studentId: z.string().uuid().describe('ID de l\'inscription étudiant'),
35
37
  }),
36
38
  handler: async ({ flowId, studentId }: { flowId: string; studentId: string }) => {
37
- return client.delete(`/flows/${flowId}/students/${studentId}`, 'eduflow');
39
+ return c.delete(`/flows/${flowId}/students/${studentId}`, 'eduflow');
38
40
  },
39
41
  },
40
42
 
@@ -45,7 +47,7 @@ export const participantsTools = {
45
47
  studentToken: z.string().describe('Token unique du participant'),
46
48
  }),
47
49
  handler: async ({ flowId, studentToken }: { flowId: string; studentToken: string }) => {
48
- return client.get(`/eduflow/progress/stats/${flowId}/${studentToken}`);
50
+ return c.get(`/eduflow/progress/stats/${flowId}/${studentToken}`);
49
51
  },
50
52
  },
51
53
 
@@ -55,7 +57,7 @@ export const participantsTools = {
55
57
  participantId: z.string().uuid().describe('ID global du participant'),
56
58
  }),
57
59
  handler: async ({ participantId }: { participantId: string }) => {
58
- return client.get(`/participants/${participantId}/overview`, 'eduflow');
60
+ return c.get(`/participants/${participantId}/overview`, 'eduflow');
59
61
  },
60
62
  },
61
63
 
@@ -65,7 +67,11 @@ export const participantsTools = {
65
67
  flowId: z.string().uuid().describe('ID du parcours'),
66
68
  }),
67
69
  handler: async ({ flowId }: { flowId: string }) => {
68
- return client.get(`/eduflow/progress/stats/flow/${flowId}`);
70
+ return c.get(`/eduflow/progress/stats/flow/${flowId}`);
69
71
  },
70
72
  },
71
- };
73
+ };
74
+ }
75
+
76
+ // Backward compatibility for stdio mode
77
+ export const participantsTools = createParticipantsTools(defaultClient);
@@ -1,14 +1,16 @@
1
1
  import { z } from 'zod';
2
- import { client } from '../client.js';
2
+ import { LyrraClient } from '../client.js';
3
+ import { client as defaultClient } from '../client.js';
3
4
 
4
- export const presentationTools = {
5
+ export function createPresentationTools(c: LyrraClient) {
6
+ return {
5
7
  presentation_get: {
6
8
  description: 'Récupérer la page de présentation d\'un parcours EduFlow (description, objectifs, image de couverture, structure affichée).',
7
9
  inputSchema: z.object({
8
10
  flowId: z.string().uuid().describe('ID du parcours'),
9
11
  }),
10
12
  handler: async ({ flowId }: { flowId: string }) => {
11
- const flow = await client.get(`/flows/${flowId}`, 'eduflow');
13
+ const flow = await c.get(`/flows/${flowId}`, 'eduflow');
12
14
  return {
13
15
  presentationEnabled: flow.presentationEnabled,
14
16
  presentationData: flow.presentationData,
@@ -38,7 +40,7 @@ Structure de presentationData : { heroTitle, heroSubtitle, heroImage, sections[{
38
40
  }).describe('Données de la page de présentation'),
39
41
  }),
40
42
  handler: async ({ flowId, presentationData }: any) => {
41
- return client.put(`/flows/${flowId}`, { presentationData }, 'eduflow');
43
+ return c.put(`/flows/${flowId}`, { presentationData }, 'eduflow');
42
44
  },
43
45
  },
44
46
 
@@ -49,7 +51,11 @@ Structure de presentationData : { heroTitle, heroSubtitle, heroImage, sections[{
49
51
  enabled: z.boolean().describe('true pour activer, false pour désactiver'),
50
52
  }),
51
53
  handler: async ({ flowId, enabled }: { flowId: string; enabled: boolean }) => {
52
- return client.put(`/flows/${flowId}`, { presentationEnabled: enabled }, 'eduflow');
54
+ return c.put(`/flows/${flowId}`, { presentationEnabled: enabled }, 'eduflow');
53
55
  },
54
56
  },
55
- };
57
+ };
58
+ }
59
+
60
+ // Backward compatibility for stdio mode
61
+ export const presentationTools = createPresentationTools(defaultClient);
@@ -1,12 +1,14 @@
1
1
  import { z } from 'zod';
2
- import { client } from '../client.js';
2
+ import { LyrraClient } from '../client.js';
3
+ import { client as defaultClient } from '../client.js';
3
4
 
4
- export const projectsTools = {
5
+ export function createProjectsTools(c: LyrraClient) {
6
+ return {
5
7
  project_list: {
6
8
  description: 'Lister tous les projets audio de l\'utilisateur (PDF convertis en audio).',
7
9
  inputSchema: z.object({}),
8
10
  handler: async () => {
9
- return client.get('/projects');
11
+ return c.get('/projects');
10
12
  },
11
13
  },
12
14
 
@@ -16,7 +18,7 @@ export const projectsTools = {
16
18
  projectId: z.string().uuid().describe('ID du projet'),
17
19
  }),
18
20
  handler: async ({ projectId }: { projectId: string }) => {
19
- return client.get(`/projects/${projectId}`);
21
+ return c.get(`/projects/${projectId}`);
20
22
  },
21
23
  },
22
24
 
@@ -27,7 +29,7 @@ export const projectsTools = {
27
29
  description: z.string().optional().describe('Description'),
28
30
  }),
29
31
  handler: async (data: any) => {
30
- return client.post('/projects', data);
32
+ return c.post('/projects', data);
31
33
  },
32
34
  },
33
35
 
@@ -39,7 +41,7 @@ export const projectsTools = {
39
41
  description: z.string().optional().describe('Nouvelle description'),
40
42
  }),
41
43
  handler: async ({ projectId, ...data }: any) => {
42
- return client.put(`/projects/${projectId}`, data);
44
+ return c.put(`/projects/${projectId}`, data);
43
45
  },
44
46
  },
45
47
 
@@ -49,7 +51,11 @@ export const projectsTools = {
49
51
  projectId: z.string().uuid().describe('ID du projet à supprimer'),
50
52
  }),
51
53
  handler: async ({ projectId }: { projectId: string }) => {
52
- return client.delete(`/projects/${projectId}`);
54
+ return c.delete(`/projects/${projectId}`);
53
55
  },
54
56
  },
55
- };
57
+ };
58
+ }
59
+
60
+ // Backward compatibility for stdio mode
61
+ export const projectsTools = createProjectsTools(defaultClient);
@@ -1,14 +1,16 @@
1
1
  import { z } from 'zod';
2
- import { client } from '../client.js';
2
+ import { LyrraClient } from '../client.js';
3
+ import { client as defaultClient } from '../client.js';
3
4
 
4
- export const resourcesTools = {
5
+ export function createResourcesTools(c: LyrraClient) {
6
+ return {
5
7
  resource_list: {
6
8
  description: 'Lister les ressources de l\'utilisateur (images, documents, sons, vidéos) avec pagination.',
7
9
  inputSchema: z.object({
8
10
  type: z.enum(['images', 'documents', 'sounds', 'videos']).describe('Type de ressource'),
9
11
  }),
10
12
  handler: async ({ type }: { type: string }) => {
11
- return client.get(`/user-resources/${type}`);
13
+ return c.get(`/user-resources/${type}`);
12
14
  },
13
15
  },
14
16
 
@@ -19,7 +21,7 @@ export const resourcesTools = {
19
21
  resourceId: z.string().uuid().describe('ID de la ressource'),
20
22
  }),
21
23
  handler: async ({ type, resourceId }: { type: string; resourceId: string }) => {
22
- return client.delete(`/user-resources/${type}/${resourceId}`);
24
+ return c.delete(`/user-resources/${type}/${resourceId}`);
23
25
  },
24
26
  },
25
27
 
@@ -29,7 +31,11 @@ export const resourcesTools = {
29
31
  type: z.enum(['images', 'documents', 'sounds', 'videos']).describe('Type de ressource'),
30
32
  }),
31
33
  handler: async ({ type }: { type: string }) => {
32
- return client.get(`/categories/${type}`);
34
+ return c.get(`/categories/${type}`);
33
35
  },
34
36
  },
35
- };
37
+ };
38
+ }
39
+
40
+ // Backward compatibility for stdio mode
41
+ export const resourcesTools = createResourcesTools(defaultClient);
@@ -1,7 +1,9 @@
1
1
  import { z } from 'zod';
2
- import { client } from '../client.js';
2
+ import { LyrraClient } from '../client.js';
3
+ import { client as defaultClient } from '../client.js';
3
4
 
4
- export const storeTools = {
5
+ export function createStoreTools(c: LyrraClient) {
6
+ return {
5
7
  store_list_audiobooks: {
6
8
  description: 'Lister les audiobooks disponibles dans le store LYRRA. Supporte la pagination, recherche et filtres.',
7
9
  inputSchema: z.object({
@@ -19,7 +21,7 @@ export const storeTools = {
19
21
  if (category) params.set('category', category);
20
22
  if (featured) params.set('featured', 'true');
21
23
  const query = params.toString() ? `?${params}` : '';
22
- return client.post(`/store/public/audiobooks${query}`, {});
24
+ return c.post(`/store/public/audiobooks${query}`, {});
23
25
  },
24
26
  },
25
27
 
@@ -29,7 +31,7 @@ export const storeTools = {
29
31
  audiobookId: z.string().describe('ID de l\'audiobook'),
30
32
  }),
31
33
  handler: async ({ audiobookId }: { audiobookId: string }) => {
32
- return client.get(`/store/public/audiobooks/${audiobookId}`);
34
+ return c.get(`/store/public/audiobooks/${audiobookId}`);
33
35
  },
34
36
  },
35
37
 
@@ -37,7 +39,7 @@ export const storeTools = {
37
39
  description: 'Lister les auteurs mis en avant sur le store.',
38
40
  inputSchema: z.object({}),
39
41
  handler: async () => {
40
- return client.get('/store/public/authors/featured');
42
+ return c.get('/store/public/authors/featured');
41
43
  },
42
44
  },
43
45
 
@@ -45,7 +47,7 @@ export const storeTools = {
45
47
  description: 'Récupérer ma bibliothèque d\'audiobooks achetés.',
46
48
  inputSchema: z.object({}),
47
49
  handler: async () => {
48
- return client.get('/store/my-library');
50
+ return c.get('/store/my-library');
49
51
  },
50
52
  },
51
53
 
@@ -55,7 +57,11 @@ export const storeTools = {
55
57
  query: z.string().describe('Terme de recherche'),
56
58
  }),
57
59
  handler: async ({ query }: { query: string }) => {
58
- return client.post('/store/public/audiobooks', { search: query });
60
+ return c.post('/store/public/audiobooks', { search: query });
59
61
  },
60
62
  },
61
- };
63
+ };
64
+ }
65
+
66
+ // Backward compatibility for stdio mode
67
+ export const storeTools = createStoreTools(defaultClient);