@magnetlab/mcp 0.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.
- package/README.md +119 -0
- package/dist/client.d.ts +465 -0
- package/dist/client.js +456 -0
- package/dist/constants.d.ts +30 -0
- package/dist/constants.js +87 -0
- package/dist/handlers/analytics.d.ts +5 -0
- package/dist/handlers/analytics.js +11 -0
- package/dist/handlers/brand-kit.d.ts +5 -0
- package/dist/handlers/brand-kit.js +32 -0
- package/dist/handlers/content-pipeline.d.ts +5 -0
- package/dist/handlers/content-pipeline.js +127 -0
- package/dist/handlers/email-sequences.d.ts +5 -0
- package/dist/handlers/email-sequences.js +30 -0
- package/dist/handlers/funnels.d.ts +5 -0
- package/dist/handlers/funnels.js +65 -0
- package/dist/handlers/ideation.d.ts +5 -0
- package/dist/handlers/ideation.js +44 -0
- package/dist/handlers/index.d.ts +24 -0
- package/dist/handlers/index.js +104 -0
- package/dist/handlers/lead-magnets.d.ts +5 -0
- package/dist/handlers/lead-magnets.js +31 -0
- package/dist/handlers/leads.d.ts +5 -0
- package/dist/handlers/leads.js +24 -0
- package/dist/handlers/libraries.d.ts +5 -0
- package/dist/handlers/libraries.js +31 -0
- package/dist/handlers/qualification-forms.d.ts +5 -0
- package/dist/handlers/qualification-forms.js +21 -0
- package/dist/handlers/swipe-file.d.ts +5 -0
- package/dist/handlers/swipe-file.js +31 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +58 -0
- package/dist/tools/analytics.d.ts +2 -0
- package/dist/tools/analytics.js +10 -0
- package/dist/tools/brand-kit.d.ts +2 -0
- package/dist/tools/brand-kit.js +89 -0
- package/dist/tools/content-pipeline.d.ts +2 -0
- package/dist/tools/content-pipeline.js +476 -0
- package/dist/tools/email-sequences.d.ts +2 -0
- package/dist/tools/email-sequences.js +70 -0
- package/dist/tools/funnels.d.ts +2 -0
- package/dist/tools/funnels.js +153 -0
- package/dist/tools/ideation.d.ts +2 -0
- package/dist/tools/ideation.js +161 -0
- package/dist/tools/index.d.ts +66 -0
- package/dist/tools/index.js +52 -0
- package/dist/tools/lead-magnets.d.ts +2 -0
- package/dist/tools/lead-magnets.js +101 -0
- package/dist/tools/leads.d.ts +2 -0
- package/dist/tools/leads.js +32 -0
- package/dist/tools/libraries.d.ts +2 -0
- package/dist/tools/libraries.js +83 -0
- package/dist/tools/qualification-forms.d.ts +2 -0
- package/dist/tools/qualification-forms.js +71 -0
- package/dist/tools/swipe-file.d.ts +2 -0
- package/dist/tools/swipe-file.js +46 -0
- package/dist/validation.d.ts +476 -0
- package/dist/validation.js +236 -0
- package/package.json +52 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
// packages/mcp/src/client.ts
|
|
2
|
+
const DEFAULT_BASE_URL = 'https://magnetlab.ai/api';
|
|
3
|
+
export class MagnetLabClient {
|
|
4
|
+
apiKey;
|
|
5
|
+
baseUrl;
|
|
6
|
+
constructor(apiKey, options = {}) {
|
|
7
|
+
this.apiKey = apiKey;
|
|
8
|
+
this.baseUrl = options.baseUrl || DEFAULT_BASE_URL;
|
|
9
|
+
}
|
|
10
|
+
async request(method, path, body) {
|
|
11
|
+
const url = `${this.baseUrl}${path}`;
|
|
12
|
+
const headers = {
|
|
13
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
14
|
+
'Content-Type': 'application/json',
|
|
15
|
+
};
|
|
16
|
+
const response = await fetch(url, {
|
|
17
|
+
method,
|
|
18
|
+
headers,
|
|
19
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
20
|
+
});
|
|
21
|
+
if (!response.ok) {
|
|
22
|
+
const error = await response.json().catch(() => ({ error: 'Unknown error' }));
|
|
23
|
+
throw new Error(error.error || `Request failed: ${response.status}`);
|
|
24
|
+
}
|
|
25
|
+
// Handle CSV responses (exports)
|
|
26
|
+
const contentType = response.headers.get('content-type');
|
|
27
|
+
if (contentType?.includes('text/csv')) {
|
|
28
|
+
return { csv: await response.text() };
|
|
29
|
+
}
|
|
30
|
+
return response.json();
|
|
31
|
+
}
|
|
32
|
+
// ============================================================
|
|
33
|
+
// Lead Magnets
|
|
34
|
+
// ============================================================
|
|
35
|
+
async listLeadMagnets(params) {
|
|
36
|
+
const searchParams = new URLSearchParams();
|
|
37
|
+
if (params?.status)
|
|
38
|
+
searchParams.set('status', params.status);
|
|
39
|
+
if (params?.limit)
|
|
40
|
+
searchParams.set('limit', String(params.limit));
|
|
41
|
+
if (params?.offset)
|
|
42
|
+
searchParams.set('offset', String(params.offset));
|
|
43
|
+
return this.request('GET', `/lead-magnet?${searchParams}`);
|
|
44
|
+
}
|
|
45
|
+
async getLeadMagnet(id) {
|
|
46
|
+
return this.request('GET', `/external/lead-magnets/${id}`);
|
|
47
|
+
}
|
|
48
|
+
async createLeadMagnet(params) {
|
|
49
|
+
return this.request('POST', `/lead-magnet`, params);
|
|
50
|
+
}
|
|
51
|
+
async deleteLeadMagnet(id) {
|
|
52
|
+
return this.request('DELETE', `/lead-magnet/${id}`);
|
|
53
|
+
}
|
|
54
|
+
async ideateLeadMagnets(params) {
|
|
55
|
+
return this.request('POST', `/lead-magnet/ideate`, params);
|
|
56
|
+
}
|
|
57
|
+
async extractContent(leadMagnetId, params) {
|
|
58
|
+
return this.request('POST', `/external/lead-magnets/${leadMagnetId}/extract`, params);
|
|
59
|
+
}
|
|
60
|
+
async generateContent(leadMagnetId, params) {
|
|
61
|
+
return this.request('POST', `/external/lead-magnets/${leadMagnetId}/generate`, params);
|
|
62
|
+
}
|
|
63
|
+
async writeLinkedInPosts(leadMagnetId, params) {
|
|
64
|
+
return this.request('POST', `/external/lead-magnets/${leadMagnetId}/write-posts`, params);
|
|
65
|
+
}
|
|
66
|
+
async polishLeadMagnetContent(leadMagnetId) {
|
|
67
|
+
return this.request('POST', `/lead-magnet/${leadMagnetId}/polish`, {});
|
|
68
|
+
}
|
|
69
|
+
async getLeadMagnetStats(leadMagnetId) {
|
|
70
|
+
return this.request('GET', `/external/lead-magnets/${leadMagnetId}/stats`);
|
|
71
|
+
}
|
|
72
|
+
async importLeadMagnet(data) {
|
|
73
|
+
return this.request('POST', `/lead-magnet/import`, data);
|
|
74
|
+
}
|
|
75
|
+
async analyzeCompetitor(params) {
|
|
76
|
+
return this.request('POST', `/lead-magnet/analyze-competitor`, params);
|
|
77
|
+
}
|
|
78
|
+
async analyzeTranscript(params) {
|
|
79
|
+
return this.request('POST', `/lead-magnet/analyze-transcript`, params);
|
|
80
|
+
}
|
|
81
|
+
// ============================================================
|
|
82
|
+
// Funnels
|
|
83
|
+
// ============================================================
|
|
84
|
+
async listFunnels() {
|
|
85
|
+
return this.request('GET', `/funnel/all`);
|
|
86
|
+
}
|
|
87
|
+
async getFunnel(id) {
|
|
88
|
+
return this.request('GET', `/funnel/${id}`);
|
|
89
|
+
}
|
|
90
|
+
async getFunnelByTarget(params) {
|
|
91
|
+
const searchParams = new URLSearchParams();
|
|
92
|
+
if (params.leadMagnetId)
|
|
93
|
+
searchParams.set('leadMagnetId', params.leadMagnetId);
|
|
94
|
+
if (params.libraryId)
|
|
95
|
+
searchParams.set('libraryId', params.libraryId);
|
|
96
|
+
if (params.externalResourceId)
|
|
97
|
+
searchParams.set('externalResourceId', params.externalResourceId);
|
|
98
|
+
return this.request('GET', `/funnel?${searchParams}`);
|
|
99
|
+
}
|
|
100
|
+
async createFunnel(params) {
|
|
101
|
+
return this.request('POST', `/funnel`, params);
|
|
102
|
+
}
|
|
103
|
+
async updateFunnel(id, params) {
|
|
104
|
+
return this.request('PUT', `/funnel/${id}`, params);
|
|
105
|
+
}
|
|
106
|
+
async deleteFunnel(id) {
|
|
107
|
+
return this.request('DELETE', `/funnel/${id}`);
|
|
108
|
+
}
|
|
109
|
+
async publishFunnel(id) {
|
|
110
|
+
return this.request('POST', `/funnel/${id}/publish`, { publish: true });
|
|
111
|
+
}
|
|
112
|
+
async unpublishFunnel(id) {
|
|
113
|
+
return this.request('POST', `/funnel/${id}/publish`, { publish: false });
|
|
114
|
+
}
|
|
115
|
+
async getFunnelStats() {
|
|
116
|
+
return this.request('GET', `/funnel/stats`);
|
|
117
|
+
}
|
|
118
|
+
async generateFunnelContent(params) {
|
|
119
|
+
return this.request('POST', `/funnel/generate-content`, params);
|
|
120
|
+
}
|
|
121
|
+
// ============================================================
|
|
122
|
+
// Leads
|
|
123
|
+
// ============================================================
|
|
124
|
+
async listLeads(params) {
|
|
125
|
+
const searchParams = new URLSearchParams();
|
|
126
|
+
if (params?.funnelId)
|
|
127
|
+
searchParams.set('funnelId', params.funnelId);
|
|
128
|
+
if (params?.leadMagnetId)
|
|
129
|
+
searchParams.set('leadMagnetId', params.leadMagnetId);
|
|
130
|
+
if (params?.qualified !== undefined)
|
|
131
|
+
searchParams.set('qualified', String(params.qualified));
|
|
132
|
+
if (params?.search)
|
|
133
|
+
searchParams.set('search', params.search);
|
|
134
|
+
if (params?.limit)
|
|
135
|
+
searchParams.set('limit', String(params.limit));
|
|
136
|
+
if (params?.offset)
|
|
137
|
+
searchParams.set('offset', String(params.offset));
|
|
138
|
+
return this.request('GET', `/leads?${searchParams}`);
|
|
139
|
+
}
|
|
140
|
+
async exportLeads(params) {
|
|
141
|
+
const searchParams = new URLSearchParams();
|
|
142
|
+
if (params?.funnelId)
|
|
143
|
+
searchParams.set('funnelId', params.funnelId);
|
|
144
|
+
if (params?.leadMagnetId)
|
|
145
|
+
searchParams.set('leadMagnetId', params.leadMagnetId);
|
|
146
|
+
if (params?.qualified !== undefined)
|
|
147
|
+
searchParams.set('qualified', String(params.qualified));
|
|
148
|
+
return this.request('GET', `/leads/export?${searchParams}`);
|
|
149
|
+
}
|
|
150
|
+
// ============================================================
|
|
151
|
+
// Brand Kit
|
|
152
|
+
// ============================================================
|
|
153
|
+
async getBrandKit() {
|
|
154
|
+
return this.request('GET', `/brand-kit`);
|
|
155
|
+
}
|
|
156
|
+
async updateBrandKit(params) {
|
|
157
|
+
return this.request('POST', `/brand-kit`, params);
|
|
158
|
+
}
|
|
159
|
+
async extractBusinessContext(params) {
|
|
160
|
+
return this.request('POST', `/brand-kit/extract`, params);
|
|
161
|
+
}
|
|
162
|
+
// ============================================================
|
|
163
|
+
// Email Sequences
|
|
164
|
+
// ============================================================
|
|
165
|
+
async getEmailSequence(leadMagnetId) {
|
|
166
|
+
return this.request('GET', `/email-sequence/${leadMagnetId}`);
|
|
167
|
+
}
|
|
168
|
+
async generateEmailSequence(params) {
|
|
169
|
+
return this.request('POST', `/email-sequence/generate`, params);
|
|
170
|
+
}
|
|
171
|
+
async updateEmailSequence(leadMagnetId, params) {
|
|
172
|
+
return this.request('PUT', `/email-sequence/${leadMagnetId}`, params);
|
|
173
|
+
}
|
|
174
|
+
async activateEmailSequence(leadMagnetId) {
|
|
175
|
+
return this.request('POST', `/email-sequence/${leadMagnetId}/activate`, {});
|
|
176
|
+
}
|
|
177
|
+
// ============================================================
|
|
178
|
+
// Content Pipeline - Transcripts
|
|
179
|
+
// ============================================================
|
|
180
|
+
async listTranscripts() {
|
|
181
|
+
return this.request('GET', `/content-pipeline/transcripts`);
|
|
182
|
+
}
|
|
183
|
+
async submitTranscript(params) {
|
|
184
|
+
return this.request('POST', `/content-pipeline/transcripts`, params);
|
|
185
|
+
}
|
|
186
|
+
async deleteTranscript(id) {
|
|
187
|
+
return this.request('DELETE', `/content-pipeline/transcripts?id=${id}`);
|
|
188
|
+
}
|
|
189
|
+
// ============================================================
|
|
190
|
+
// Content Pipeline - Knowledge Base
|
|
191
|
+
// ============================================================
|
|
192
|
+
async searchKnowledge(params) {
|
|
193
|
+
const searchParams = new URLSearchParams();
|
|
194
|
+
if (params.query)
|
|
195
|
+
searchParams.set('q', params.query);
|
|
196
|
+
if (params.category)
|
|
197
|
+
searchParams.set('category', params.category);
|
|
198
|
+
if (params.view)
|
|
199
|
+
searchParams.set('view', params.view);
|
|
200
|
+
return this.request('GET', `/content-pipeline/knowledge?${searchParams}`);
|
|
201
|
+
}
|
|
202
|
+
async getKnowledgeClusters() {
|
|
203
|
+
return this.request('GET', `/content-pipeline/knowledge/clusters`);
|
|
204
|
+
}
|
|
205
|
+
// ============================================================
|
|
206
|
+
// Content Pipeline - Ideas
|
|
207
|
+
// ============================================================
|
|
208
|
+
async listIdeas(params) {
|
|
209
|
+
const searchParams = new URLSearchParams();
|
|
210
|
+
if (params?.status)
|
|
211
|
+
searchParams.set('status', params.status);
|
|
212
|
+
if (params?.pillar)
|
|
213
|
+
searchParams.set('pillar', params.pillar);
|
|
214
|
+
if (params?.contentType)
|
|
215
|
+
searchParams.set('content_type', params.contentType);
|
|
216
|
+
if (params?.limit)
|
|
217
|
+
searchParams.set('limit', String(params.limit));
|
|
218
|
+
return this.request('GET', `/content-pipeline/ideas?${searchParams}`);
|
|
219
|
+
}
|
|
220
|
+
async updateIdeaStatus(ideaId, status) {
|
|
221
|
+
return this.request('PATCH', `/content-pipeline/ideas`, { ideaId, status });
|
|
222
|
+
}
|
|
223
|
+
async getIdea(id) {
|
|
224
|
+
return this.request('GET', `/content-pipeline/ideas/${id}`);
|
|
225
|
+
}
|
|
226
|
+
async deleteIdea(id) {
|
|
227
|
+
return this.request('DELETE', `/content-pipeline/ideas/${id}`);
|
|
228
|
+
}
|
|
229
|
+
async writePostFromIdea(ideaId) {
|
|
230
|
+
return this.request('POST', `/content-pipeline/ideas/${ideaId}/write`, {});
|
|
231
|
+
}
|
|
232
|
+
// ============================================================
|
|
233
|
+
// Content Pipeline - Posts
|
|
234
|
+
// ============================================================
|
|
235
|
+
async listPosts(params) {
|
|
236
|
+
const searchParams = new URLSearchParams();
|
|
237
|
+
if (params?.status)
|
|
238
|
+
searchParams.set('status', params.status);
|
|
239
|
+
if (params?.isBuffer !== undefined)
|
|
240
|
+
searchParams.set('is_buffer', String(params.isBuffer));
|
|
241
|
+
if (params?.limit)
|
|
242
|
+
searchParams.set('limit', String(params.limit));
|
|
243
|
+
return this.request('GET', `/content-pipeline/posts?${searchParams}`);
|
|
244
|
+
}
|
|
245
|
+
async getPost(id) {
|
|
246
|
+
return this.request('GET', `/content-pipeline/posts/${id}`);
|
|
247
|
+
}
|
|
248
|
+
async updatePost(id, params) {
|
|
249
|
+
return this.request('PATCH', `/content-pipeline/posts/${id}`, params);
|
|
250
|
+
}
|
|
251
|
+
async deletePost(id) {
|
|
252
|
+
return this.request('DELETE', `/content-pipeline/posts/${id}`);
|
|
253
|
+
}
|
|
254
|
+
async polishPost(id) {
|
|
255
|
+
return this.request('POST', `/content-pipeline/posts/${id}/polish`, {});
|
|
256
|
+
}
|
|
257
|
+
async publishPost(id) {
|
|
258
|
+
return this.request('POST', `/content-pipeline/posts/${id}/publish`, {});
|
|
259
|
+
}
|
|
260
|
+
async schedulePost(params) {
|
|
261
|
+
return this.request('POST', `/content-pipeline/posts/schedule`, params);
|
|
262
|
+
}
|
|
263
|
+
async getPostsByDateRange(params) {
|
|
264
|
+
const searchParams = new URLSearchParams();
|
|
265
|
+
searchParams.set('start_date', params.startDate);
|
|
266
|
+
searchParams.set('end_date', params.endDate);
|
|
267
|
+
return this.request('GET', `/content-pipeline/posts/by-date-range?${searchParams}`);
|
|
268
|
+
}
|
|
269
|
+
async quickWritePost(params) {
|
|
270
|
+
return this.request('POST', `/content-pipeline/quick-write`, params);
|
|
271
|
+
}
|
|
272
|
+
// ============================================================
|
|
273
|
+
// Content Pipeline - Schedule & Autopilot
|
|
274
|
+
// ============================================================
|
|
275
|
+
async listPostingSlots() {
|
|
276
|
+
return this.request('GET', `/content-pipeline/schedule/slots`);
|
|
277
|
+
}
|
|
278
|
+
async createPostingSlot(params) {
|
|
279
|
+
return this.request('POST', `/content-pipeline/schedule/slots`, params);
|
|
280
|
+
}
|
|
281
|
+
async updatePostingSlot(id, params) {
|
|
282
|
+
return this.request('PUT', `/content-pipeline/schedule/slots/${id}`, params);
|
|
283
|
+
}
|
|
284
|
+
async deletePostingSlot(id) {
|
|
285
|
+
return this.request('DELETE', `/content-pipeline/schedule/slots/${id}`);
|
|
286
|
+
}
|
|
287
|
+
async getAutopilotStatus() {
|
|
288
|
+
return this.request('GET', `/content-pipeline/schedule/autopilot`);
|
|
289
|
+
}
|
|
290
|
+
async triggerAutopilot(params) {
|
|
291
|
+
return this.request('POST', `/content-pipeline/schedule/autopilot`, params || {});
|
|
292
|
+
}
|
|
293
|
+
async getBuffer() {
|
|
294
|
+
return this.request('GET', `/content-pipeline/schedule/buffer`);
|
|
295
|
+
}
|
|
296
|
+
// ============================================================
|
|
297
|
+
// Content Pipeline - Styles & Templates
|
|
298
|
+
// ============================================================
|
|
299
|
+
async listWritingStyles() {
|
|
300
|
+
return this.request('GET', `/content-pipeline/styles`);
|
|
301
|
+
}
|
|
302
|
+
async extractWritingStyle(params) {
|
|
303
|
+
return this.request('POST', `/content-pipeline/styles/extract`, params);
|
|
304
|
+
}
|
|
305
|
+
async getWritingStyle(id) {
|
|
306
|
+
return this.request('GET', `/content-pipeline/styles/${id}`);
|
|
307
|
+
}
|
|
308
|
+
async listTemplates(params) {
|
|
309
|
+
const searchParams = new URLSearchParams();
|
|
310
|
+
if (params?.limit)
|
|
311
|
+
searchParams.set('limit', String(params.limit));
|
|
312
|
+
return this.request('GET', `/content-pipeline/templates?${searchParams}`);
|
|
313
|
+
}
|
|
314
|
+
async getTemplate(id) {
|
|
315
|
+
return this.request('GET', `/content-pipeline/templates/${id}`);
|
|
316
|
+
}
|
|
317
|
+
async matchTemplate(params) {
|
|
318
|
+
return this.request('POST', `/content-pipeline/templates/match`, params);
|
|
319
|
+
}
|
|
320
|
+
// ============================================================
|
|
321
|
+
// Content Pipeline - Planner
|
|
322
|
+
// ============================================================
|
|
323
|
+
async getPlan() {
|
|
324
|
+
return this.request('GET', `/content-pipeline/planner`);
|
|
325
|
+
}
|
|
326
|
+
async generatePlan(params) {
|
|
327
|
+
return this.request('POST', `/content-pipeline/planner/generate`, params || {});
|
|
328
|
+
}
|
|
329
|
+
async approvePlan(params) {
|
|
330
|
+
return this.request('POST', `/content-pipeline/planner/approve`, params);
|
|
331
|
+
}
|
|
332
|
+
async updatePlanItem(id, params) {
|
|
333
|
+
return this.request('PATCH', `/content-pipeline/planner/${id}`, params);
|
|
334
|
+
}
|
|
335
|
+
// ============================================================
|
|
336
|
+
// Content Pipeline - Business Context
|
|
337
|
+
// ============================================================
|
|
338
|
+
async getBusinessContext() {
|
|
339
|
+
return this.request('GET', `/content-pipeline/business-context`);
|
|
340
|
+
}
|
|
341
|
+
async updateBusinessContext(params) {
|
|
342
|
+
return this.request('POST', `/content-pipeline/business-context`, params);
|
|
343
|
+
}
|
|
344
|
+
// ============================================================
|
|
345
|
+
// Swipe File
|
|
346
|
+
// ============================================================
|
|
347
|
+
async browseSwipeFilePosts(params) {
|
|
348
|
+
const searchParams = new URLSearchParams();
|
|
349
|
+
if (params?.niche)
|
|
350
|
+
searchParams.set('niche', params.niche);
|
|
351
|
+
if (params?.type)
|
|
352
|
+
searchParams.set('type', params.type);
|
|
353
|
+
if (params?.featured)
|
|
354
|
+
searchParams.set('featured', 'true');
|
|
355
|
+
if (params?.limit)
|
|
356
|
+
searchParams.set('limit', String(params.limit));
|
|
357
|
+
if (params?.offset)
|
|
358
|
+
searchParams.set('offset', String(params.offset));
|
|
359
|
+
return this.request('GET', `/swipe-file/posts?${searchParams}`);
|
|
360
|
+
}
|
|
361
|
+
async browseSwipeFileLeadMagnets(params) {
|
|
362
|
+
const searchParams = new URLSearchParams();
|
|
363
|
+
if (params?.niche)
|
|
364
|
+
searchParams.set('niche', params.niche);
|
|
365
|
+
if (params?.format)
|
|
366
|
+
searchParams.set('format', params.format);
|
|
367
|
+
if (params?.featured)
|
|
368
|
+
searchParams.set('featured', 'true');
|
|
369
|
+
if (params?.limit)
|
|
370
|
+
searchParams.set('limit', String(params.limit));
|
|
371
|
+
if (params?.offset)
|
|
372
|
+
searchParams.set('offset', String(params.offset));
|
|
373
|
+
return this.request('GET', `/swipe-file/lead-magnets?${searchParams}`);
|
|
374
|
+
}
|
|
375
|
+
async submitToSwipeFile(params) {
|
|
376
|
+
return this.request('POST', `/swipe-file/submit`, params);
|
|
377
|
+
}
|
|
378
|
+
// ============================================================
|
|
379
|
+
// Analytics
|
|
380
|
+
// ============================================================
|
|
381
|
+
async getFunnelAnalytics() {
|
|
382
|
+
return this.request('GET', `/funnel/stats`);
|
|
383
|
+
}
|
|
384
|
+
async getLeadMagnetAnalytics(leadMagnetId) {
|
|
385
|
+
return this.request('GET', `/external/lead-magnets/${leadMagnetId}/stats`);
|
|
386
|
+
}
|
|
387
|
+
// ============================================================
|
|
388
|
+
// Libraries
|
|
389
|
+
// ============================================================
|
|
390
|
+
async listLibraries() {
|
|
391
|
+
return this.request('GET', `/libraries`);
|
|
392
|
+
}
|
|
393
|
+
async getLibrary(id) {
|
|
394
|
+
return this.request('GET', `/libraries/${id}`);
|
|
395
|
+
}
|
|
396
|
+
async createLibrary(params) {
|
|
397
|
+
return this.request('POST', `/libraries`, params);
|
|
398
|
+
}
|
|
399
|
+
async updateLibrary(id, params) {
|
|
400
|
+
return this.request('PUT', `/libraries/${id}`, params);
|
|
401
|
+
}
|
|
402
|
+
async deleteLibrary(id) {
|
|
403
|
+
return this.request('DELETE', `/libraries/${id}`);
|
|
404
|
+
}
|
|
405
|
+
async listLibraryItems(libraryId) {
|
|
406
|
+
return this.request('GET', `/libraries/${libraryId}/items`);
|
|
407
|
+
}
|
|
408
|
+
async createLibraryItem(libraryId, params) {
|
|
409
|
+
return this.request('POST', `/libraries/${libraryId}/items`, params);
|
|
410
|
+
}
|
|
411
|
+
// ============================================================
|
|
412
|
+
// External Resources
|
|
413
|
+
// ============================================================
|
|
414
|
+
async listExternalResources() {
|
|
415
|
+
return this.request('GET', `/external-resources`);
|
|
416
|
+
}
|
|
417
|
+
async getExternalResource(id) {
|
|
418
|
+
return this.request('GET', `/external-resources/${id}`);
|
|
419
|
+
}
|
|
420
|
+
async createExternalResource(params) {
|
|
421
|
+
return this.request('POST', `/external-resources`, params);
|
|
422
|
+
}
|
|
423
|
+
// ============================================================
|
|
424
|
+
// Qualification Forms
|
|
425
|
+
// ============================================================
|
|
426
|
+
async listQualificationForms() {
|
|
427
|
+
return this.request('GET', `/qualification-forms`);
|
|
428
|
+
}
|
|
429
|
+
async getQualificationForm(id) {
|
|
430
|
+
return this.request('GET', `/qualification-forms/${id}`);
|
|
431
|
+
}
|
|
432
|
+
async createQualificationForm(params) {
|
|
433
|
+
return this.request('POST', `/qualification-forms`, params);
|
|
434
|
+
}
|
|
435
|
+
async listQuestions(formId) {
|
|
436
|
+
return this.request('GET', `/qualification-forms/${formId}/questions`);
|
|
437
|
+
}
|
|
438
|
+
async createQuestion(formId, params) {
|
|
439
|
+
return this.request('POST', `/qualification-forms/${formId}/questions`, params);
|
|
440
|
+
}
|
|
441
|
+
// ============================================================
|
|
442
|
+
// Integrations
|
|
443
|
+
// ============================================================
|
|
444
|
+
async listIntegrations() {
|
|
445
|
+
return this.request('GET', `/integrations`);
|
|
446
|
+
}
|
|
447
|
+
async verifyIntegration(params) {
|
|
448
|
+
return this.request('POST', `/integrations/verify`, params);
|
|
449
|
+
}
|
|
450
|
+
// ============================================================
|
|
451
|
+
// Jobs
|
|
452
|
+
// ============================================================
|
|
453
|
+
async getJobStatus(id) {
|
|
454
|
+
return this.request('GET', `/jobs/${id}`);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const ARCHETYPES: readonly ["single-breakdown", "single-system", "focused-toolkit", "single-calculator", "focused-directory", "mini-training", "one-story", "prompt", "assessment", "workflow"];
|
|
2
|
+
export type Archetype = (typeof ARCHETYPES)[number];
|
|
3
|
+
export declare const LEAD_MAGNET_STATUS: readonly ["draft", "extracting", "generating", "content_ready", "complete", "published"];
|
|
4
|
+
export type LeadMagnetStatus = (typeof LEAD_MAGNET_STATUS)[number];
|
|
5
|
+
export declare const FUNNEL_THEMES: readonly ["light", "dark"];
|
|
6
|
+
export type FunnelTheme = (typeof FUNNEL_THEMES)[number];
|
|
7
|
+
export declare const BACKGROUND_STYLES: readonly ["solid", "gradient", "pattern"];
|
|
8
|
+
export type BackgroundStyle = (typeof BACKGROUND_STYLES)[number];
|
|
9
|
+
export declare const FUNNEL_TARGET_TYPES: readonly ["lead_magnet", "library", "external_resource"];
|
|
10
|
+
export type FunnelTargetType = (typeof FUNNEL_TARGET_TYPES)[number];
|
|
11
|
+
export declare const EMAIL_SEQUENCE_STATUS: readonly ["draft", "synced", "active"];
|
|
12
|
+
export type EmailSequenceStatus = (typeof EMAIL_SEQUENCE_STATUS)[number];
|
|
13
|
+
export declare const PIPELINE_POST_STATUS: readonly ["draft", "review", "approved", "scheduled", "published", "archived"];
|
|
14
|
+
export type PipelinePostStatus = (typeof PIPELINE_POST_STATUS)[number];
|
|
15
|
+
export declare const IDEA_STATUS: readonly ["extracted", "selected", "writing", "written", "scheduled", "published", "archived"];
|
|
16
|
+
export type IdeaStatus = (typeof IDEA_STATUS)[number];
|
|
17
|
+
export declare const CONTENT_PILLARS: readonly ["moments_that_matter", "teaching_promotion", "human_personal", "collaboration_social_proof"];
|
|
18
|
+
export type ContentPillar = (typeof CONTENT_PILLARS)[number];
|
|
19
|
+
export declare const CONTENT_TYPES: readonly ["story", "insight", "tip", "framework", "case_study", "question", "listicle", "contrarian"];
|
|
20
|
+
export type ContentType = (typeof CONTENT_TYPES)[number];
|
|
21
|
+
export declare const KNOWLEDGE_CATEGORIES: readonly ["insight", "question", "pain_point", "success_story", "objection", "framework", "quote", "market_intel"];
|
|
22
|
+
export type KnowledgeCategory = (typeof KNOWLEDGE_CATEGORIES)[number];
|
|
23
|
+
export declare const TRANSCRIPT_SOURCES: readonly ["paste", "grain", "fireflies", "upload"];
|
|
24
|
+
export type TranscriptSource = (typeof TRANSCRIPT_SOURCES)[number];
|
|
25
|
+
export declare const ANALYTICS_PERIODS: readonly ["7d", "30d", "90d", "all"];
|
|
26
|
+
export type AnalyticsPeriod = (typeof ANALYTICS_PERIODS)[number];
|
|
27
|
+
export declare const EXTRACT_CONTENT_TYPES: readonly ["offer-doc", "linkedin", "sales-page", "other"];
|
|
28
|
+
export type ExtractContentType = (typeof EXTRACT_CONTENT_TYPES)[number];
|
|
29
|
+
export declare const SWIPE_FILE_POST_TYPES: readonly ["hook", "story", "educational", "promotional", "engagement"];
|
|
30
|
+
export type SwipeFilePostType = (typeof SWIPE_FILE_POST_TYPES)[number];
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// packages/mcp/src/constants.ts
|
|
2
|
+
// Lead magnet archetypes
|
|
3
|
+
export const ARCHETYPES = [
|
|
4
|
+
'single-breakdown',
|
|
5
|
+
'single-system',
|
|
6
|
+
'focused-toolkit',
|
|
7
|
+
'single-calculator',
|
|
8
|
+
'focused-directory',
|
|
9
|
+
'mini-training',
|
|
10
|
+
'one-story',
|
|
11
|
+
'prompt',
|
|
12
|
+
'assessment',
|
|
13
|
+
'workflow',
|
|
14
|
+
];
|
|
15
|
+
// Lead magnet status
|
|
16
|
+
export const LEAD_MAGNET_STATUS = [
|
|
17
|
+
'draft',
|
|
18
|
+
'extracting',
|
|
19
|
+
'generating',
|
|
20
|
+
'content_ready',
|
|
21
|
+
'complete',
|
|
22
|
+
'published',
|
|
23
|
+
];
|
|
24
|
+
// Funnel theme
|
|
25
|
+
export const FUNNEL_THEMES = ['light', 'dark'];
|
|
26
|
+
// Funnel background style
|
|
27
|
+
export const BACKGROUND_STYLES = ['solid', 'gradient', 'pattern'];
|
|
28
|
+
// Funnel target type
|
|
29
|
+
export const FUNNEL_TARGET_TYPES = ['lead_magnet', 'library', 'external_resource'];
|
|
30
|
+
// Email sequence status
|
|
31
|
+
export const EMAIL_SEQUENCE_STATUS = ['draft', 'synced', 'active'];
|
|
32
|
+
// Content pipeline post status
|
|
33
|
+
export const PIPELINE_POST_STATUS = [
|
|
34
|
+
'draft',
|
|
35
|
+
'review',
|
|
36
|
+
'approved',
|
|
37
|
+
'scheduled',
|
|
38
|
+
'published',
|
|
39
|
+
'archived',
|
|
40
|
+
];
|
|
41
|
+
// Content pipeline idea status
|
|
42
|
+
export const IDEA_STATUS = [
|
|
43
|
+
'extracted',
|
|
44
|
+
'selected',
|
|
45
|
+
'writing',
|
|
46
|
+
'written',
|
|
47
|
+
'scheduled',
|
|
48
|
+
'published',
|
|
49
|
+
'archived',
|
|
50
|
+
];
|
|
51
|
+
// Content pillars
|
|
52
|
+
export const CONTENT_PILLARS = [
|
|
53
|
+
'moments_that_matter',
|
|
54
|
+
'teaching_promotion',
|
|
55
|
+
'human_personal',
|
|
56
|
+
'collaboration_social_proof',
|
|
57
|
+
];
|
|
58
|
+
// Content types for ideas
|
|
59
|
+
export const CONTENT_TYPES = [
|
|
60
|
+
'story',
|
|
61
|
+
'insight',
|
|
62
|
+
'tip',
|
|
63
|
+
'framework',
|
|
64
|
+
'case_study',
|
|
65
|
+
'question',
|
|
66
|
+
'listicle',
|
|
67
|
+
'contrarian',
|
|
68
|
+
];
|
|
69
|
+
// Knowledge entry categories
|
|
70
|
+
export const KNOWLEDGE_CATEGORIES = [
|
|
71
|
+
'insight',
|
|
72
|
+
'question',
|
|
73
|
+
'pain_point',
|
|
74
|
+
'success_story',
|
|
75
|
+
'objection',
|
|
76
|
+
'framework',
|
|
77
|
+
'quote',
|
|
78
|
+
'market_intel',
|
|
79
|
+
];
|
|
80
|
+
// Transcript sources
|
|
81
|
+
export const TRANSCRIPT_SOURCES = ['paste', 'grain', 'fireflies', 'upload'];
|
|
82
|
+
// Analytics periods
|
|
83
|
+
export const ANALYTICS_PERIODS = ['7d', '30d', '90d', 'all'];
|
|
84
|
+
// Brand kit extract content types
|
|
85
|
+
export const EXTRACT_CONTENT_TYPES = ['offer-doc', 'linkedin', 'sales-page', 'other'];
|
|
86
|
+
// Swipe file niches (common values)
|
|
87
|
+
export const SWIPE_FILE_POST_TYPES = ['hook', 'story', 'educational', 'promotional', 'engagement'];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handle analytics tool calls.
|
|
3
|
+
*/
|
|
4
|
+
export async function handleAnalyticsTools(name, _args, client) {
|
|
5
|
+
switch (name) {
|
|
6
|
+
case 'magnetlab_get_funnel_stats':
|
|
7
|
+
return client.getFunnelStats();
|
|
8
|
+
default:
|
|
9
|
+
throw new Error(`Unknown analytics tool: ${name}`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handle brand kit tool calls.
|
|
3
|
+
*/
|
|
4
|
+
export async function handleBrandKitTools(name, args, client) {
|
|
5
|
+
switch (name) {
|
|
6
|
+
case 'magnetlab_get_brand_kit':
|
|
7
|
+
return client.getBrandKit();
|
|
8
|
+
case 'magnetlab_update_brand_kit':
|
|
9
|
+
return client.updateBrandKit({
|
|
10
|
+
businessDescription: args.business_description,
|
|
11
|
+
businessType: args.business_type,
|
|
12
|
+
credibilityMarkers: args.credibility_markers,
|
|
13
|
+
urgentPains: args.urgent_pains,
|
|
14
|
+
templates: args.templates,
|
|
15
|
+
processes: args.processes,
|
|
16
|
+
tools: args.tools,
|
|
17
|
+
frequentQuestions: args.frequent_questions,
|
|
18
|
+
results: args.results,
|
|
19
|
+
successExample: args.success_example,
|
|
20
|
+
audienceTools: args.audience_tools,
|
|
21
|
+
preferredTone: args.preferred_tone,
|
|
22
|
+
styleProfile: args.style_profile,
|
|
23
|
+
});
|
|
24
|
+
case 'magnetlab_extract_business_context':
|
|
25
|
+
return client.extractBusinessContext({
|
|
26
|
+
content: args.content,
|
|
27
|
+
contentType: args.content_type,
|
|
28
|
+
});
|
|
29
|
+
default:
|
|
30
|
+
throw new Error(`Unknown brand kit tool: ${name}`);
|
|
31
|
+
}
|
|
32
|
+
}
|