@dynamoi/mcp 0.2.1 → 0.4.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,49 @@ and [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.4.1] - 2026-02-13
11
+
12
+ ### Added
13
+
14
+ - New `dynamoi_get_artist_analytics` tool to get artist-level rollup analytics across all campaigns, with optional daily breakdowns by platform.
15
+ - Media asset outputs now include dimensions (width/height when available) and a computed aspect ratio to make creative selection easier.
16
+
17
+ ### Changed
18
+
19
+ - `dynamoi_get_campaign` targeting is smaller by default in JSON mode: country targeting returns `countryCount` unless you pass `includeCountries=true`.
20
+ - `dynamoi_list_media_assets` summary mode no longer prints long asset URLs by default (use JSON mode when you need full URLs).
21
+
22
+ ## [0.4.0] - 2026-02-12
23
+
24
+ ### Added
25
+
26
+ - `dynamoi_list_artists` now includes `organizationName` when available.
27
+
28
+ ### Changed
29
+
30
+ - `dynamoi_get_current_user` now returns lightweight counts (organizationCount and artistCount) instead of full roster lists.
31
+ - Summary-mode outputs are standardized under a `summary` key across tools.
32
+ - Read tools may include `warnings` and `actionRequired` for onboarding blockers (when applicable).
33
+
34
+ ### Removed
35
+
36
+ - Removed wording in public docs that could be misinterpreted as describing internal spend calculations.
37
+
38
+
39
+ ## [0.3.0] - 2026-02-12
40
+
41
+ ### Added
42
+
43
+ - New `dynamoi_get_current_user` tool so assistants can quickly understand who is connected and which artists/organizations they can access.
44
+ - New `summary` response format across read tools for cleaner assistant-ready outputs.
45
+ - Daily analytics granularity option for campaign analytics, including daily breakdowns across Meta and Google.
46
+
47
+ ### Changed
48
+
49
+ - Search now supports optional `artistId` scoping so assistants can stay focused on one artist when needed.
50
+ - Campaign listing now supports optional `campaignType` filtering (`SMART_CAMPAIGN` or `YOUTUBE`).
51
+ - Read tool responses are more consistent across assistants, with improved summary-mode output and pagination behavior.
52
+
10
53
  ## [0.2.1] - 2026-02-12
11
54
 
12
55
  ### Fixed
package/README.md CHANGED
@@ -47,8 +47,9 @@ White-glove onboarding and ongoing support included — need help setting up you
47
47
  | `dynamoi_search` | Search across artists, ad campaigns, and smart links by name or URL |
48
48
  | `dynamoi_get_artist` | Artist or YouTube channel profile — connected platforms, subscription tier, billing status |
49
49
  | `dynamoi_list_campaigns` | List campaigns with content title, type, budget, status, and platforms |
50
- | `dynamoi_get_campaign` | Full campaign details — budget, targeting, per-platform status, blocked reasons |
50
+ | `dynamoi_get_campaign` | Full campaign details — budget, targeting, per-platform status, blocked reasons (by default includes countryCount; pass includeCountries=true for full list) |
51
51
  | `dynamoi_get_campaign_analytics` | Performance metrics — impressions, clicks, spend, CPC, CPM, CTR by platform |
52
+ | `dynamoi_get_artist_analytics` | Artist-level rollup analytics across all campaigns — totals + optional daily rows by platform |
52
53
  | `dynamoi_get_billing` | Credit balance, subscription tier, billing status, and recent spend |
53
54
  | `dynamoi_get_platform_status` | Connection health for Spotify, Meta, and YouTube — status, expiry, next steps |
54
55
 
@@ -129,7 +130,6 @@ Campaign minimums: $10/day (daily) · $100 total (Smart Campaign for Spotify) ·
129
130
 
130
131
  - **OAuth 2.1** — authorization code flow with PKCE, no shared secrets
131
132
  - **Role-based access** — viewers get read-only, editors get full control
132
- - **No raw data exposure** — all spend values are client-facing, no internal cost data
133
133
  - **Token revocation** — manage connected apps from your Dynamoi settings
134
134
 
135
135
  ---
package/dist/index.d.ts CHANGED
@@ -56,6 +56,7 @@ type ListArtistsData = {
56
56
  artists: Array<{
57
57
  id: string;
58
58
  name: string;
59
+ organizationName?: string;
59
60
  tier: ArtistTier;
60
61
  billingStatus: BillingStatus;
61
62
  activeCampaignCount: number;
@@ -63,6 +64,11 @@ type ListArtistsData = {
63
64
  }>;
64
65
  nextCursor?: string;
65
66
  };
67
+ type ListArtistsSummaryData = {
68
+ summary: string;
69
+ totalCount: number;
70
+ nextCursor?: string;
71
+ };
66
72
  type SearchResultType = "artist" | "campaign" | "smartlink";
67
73
  type SearchData = {
68
74
  results: Array<{
@@ -74,6 +80,27 @@ type SearchData = {
74
80
  }>;
75
81
  nextCursor?: string;
76
82
  };
83
+ type SearchSummaryData = {
84
+ summary: string;
85
+ totalCount: number;
86
+ nextCursor?: string;
87
+ };
88
+ type GetCurrentUserData = {
89
+ user: {
90
+ id: string;
91
+ email?: string;
92
+ name?: string;
93
+ isSuperAdmin: boolean;
94
+ };
95
+ organizationCount: number;
96
+ artistCount: number;
97
+ hints: string[];
98
+ };
99
+ type GetCurrentUserSummaryData = {
100
+ summary: string;
101
+ organizationCount: number;
102
+ artistCount: number;
103
+ };
77
104
  type GetArtistData = {
78
105
  id: string;
79
106
  name: string;
@@ -110,6 +137,13 @@ type GetArtistData = {
110
137
  id: string;
111
138
  name: string;
112
139
  };
140
+ warnings?: string[];
141
+ actionRequired?: string[];
142
+ };
143
+ type GetArtistSummaryData = {
144
+ summary: string;
145
+ warnings?: string[];
146
+ actionRequired?: string[];
113
147
  };
114
148
  type ListCampaignsJsonData = {
115
149
  campaigns: Array<{
@@ -128,6 +162,7 @@ type ListCampaignsJsonData = {
128
162
  type ListCampaignsSummaryData = {
129
163
  summary: string;
130
164
  totalCount: number;
165
+ nextCursor?: string;
131
166
  };
132
167
  type GetCampaignData = {
133
168
  id: string;
@@ -141,7 +176,8 @@ type GetCampaignData = {
141
176
  mode: "GLOBAL";
142
177
  } | {
143
178
  mode: "COUNTRIES";
144
- countries: Array<{
179
+ countryCount: number;
180
+ countries?: Array<{
145
181
  code: string;
146
182
  name: string;
147
183
  }>;
@@ -159,6 +195,13 @@ type GetCampaignData = {
159
195
  smartLinkUrl?: string;
160
196
  blockedReason?: string;
161
197
  nextAction?: string;
198
+ warnings?: string[];
199
+ actionRequired?: string[];
200
+ };
201
+ type GetCampaignSummaryData = {
202
+ summary: string;
203
+ warnings?: string[];
204
+ actionRequired?: string[];
162
205
  };
163
206
  type GetCampaignAnalyticsJsonData = {
164
207
  campaignId: string;
@@ -181,11 +224,62 @@ type GetCampaignAnalyticsJsonData = {
181
224
  impressions: number;
182
225
  clicks: number;
183
226
  spend: MoneyDisplay;
227
+ daily?: Array<{
228
+ date: string;
229
+ impressions: number;
230
+ clicks: number;
231
+ spend: MoneyDisplay;
232
+ }>;
233
+ }>;
234
+ daily?: Array<{
235
+ date: string;
236
+ impressions: number;
237
+ clicks: number;
238
+ spend: MoneyDisplay;
184
239
  }>;
185
240
  warnings?: string[];
186
241
  };
187
242
  type GetCampaignAnalyticsSummaryData = {
188
- report: string;
243
+ summary: string;
244
+ warnings?: string[];
245
+ };
246
+ type GetArtistAnalyticsJsonData = {
247
+ artistId: string;
248
+ campaignCount: number;
249
+ dateRange: {
250
+ start: string;
251
+ end: string;
252
+ };
253
+ totals: {
254
+ impressions: number;
255
+ clicks: number;
256
+ spend: MoneyDisplay;
257
+ cpc: MoneyDisplay | null;
258
+ cpm: MoneyDisplay | null;
259
+ ctr: number | null;
260
+ };
261
+ byPlatform?: Array<{
262
+ platform: "META" | "GOOGLE";
263
+ impressions: number;
264
+ clicks: number;
265
+ spend: MoneyDisplay;
266
+ daily?: Array<{
267
+ date: string;
268
+ impressions: number;
269
+ clicks: number;
270
+ spend: MoneyDisplay;
271
+ }>;
272
+ }>;
273
+ daily?: Array<{
274
+ date: string;
275
+ impressions: number;
276
+ clicks: number;
277
+ spend: MoneyDisplay;
278
+ }>;
279
+ warnings?: string[];
280
+ };
281
+ type GetArtistAnalyticsSummaryData = {
282
+ summary: string;
189
283
  warnings?: string[];
190
284
  };
191
285
  type GetBillingData = {
@@ -203,6 +297,13 @@ type GetBillingData = {
203
297
  campaignsAllowed: number;
204
298
  remainingBudget: MoneyDisplay;
205
299
  };
300
+ warnings?: string[];
301
+ actionRequired?: string[];
302
+ };
303
+ type GetBillingSummaryData = {
304
+ summary: string;
305
+ warnings?: string[];
306
+ actionRequired?: string[];
206
307
  };
207
308
  type GetPlatformStatusData = {
208
309
  platforms: {
@@ -227,6 +328,13 @@ type GetPlatformStatusData = {
227
328
  onboardingComplete: boolean;
228
329
  missingForSmartCampaign: string[];
229
330
  missingForYouTube: string[];
331
+ warnings?: string[];
332
+ actionRequired?: string[];
333
+ };
334
+ type GetPlatformStatusSummaryData = {
335
+ summary: string;
336
+ warnings?: string[];
337
+ actionRequired?: string[];
230
338
  };
231
339
  type PauseResumePlatformResult = {
232
340
  platform: "META" | "GOOGLE";
@@ -254,12 +362,18 @@ type MediaAssetSummary = {
254
362
  fileName?: string;
255
363
  width?: number;
256
364
  height?: number;
365
+ aspectRatio?: string;
257
366
  createdAt: string;
258
367
  };
259
368
  type ListMediaAssetsData = {
260
369
  assets: MediaAssetSummary[];
261
370
  nextCursor?: string;
262
371
  };
372
+ type ListMediaAssetsSummaryData = {
373
+ summary: string;
374
+ totalCount: number;
375
+ nextCursor?: string;
376
+ };
263
377
  type LaunchCampaignData = {
264
378
  id: string;
265
379
  contentTitle: string;
@@ -272,18 +386,20 @@ type LaunchCampaignData = {
272
386
  };
273
387
 
274
388
  type Phase3Adapter = {
275
- listArtists(input: unknown): Promise<ResultEnvelope<ListArtistsData>>;
276
- search(input: unknown): Promise<ResultEnvelope<SearchData>>;
277
- getArtist(input: unknown): Promise<ResultEnvelope<GetArtistData>>;
389
+ getCurrentUser(input: unknown): Promise<ResultEnvelope<GetCurrentUserData | GetCurrentUserSummaryData>>;
390
+ listArtists(input: unknown): Promise<ResultEnvelope<ListArtistsData | ListArtistsSummaryData>>;
391
+ search(input: unknown): Promise<ResultEnvelope<SearchData | SearchSummaryData>>;
392
+ getArtist(input: unknown): Promise<ResultEnvelope<GetArtistData | GetArtistSummaryData>>;
393
+ getArtistAnalytics(input: unknown): Promise<ResultEnvelope<GetArtistAnalyticsJsonData | GetArtistAnalyticsSummaryData>>;
278
394
  listCampaigns(input: unknown): Promise<ResultEnvelope<ListCampaignsJsonData | ListCampaignsSummaryData>>;
279
- getCampaign(input: unknown): Promise<ResultEnvelope<GetCampaignData>>;
395
+ getCampaign(input: unknown): Promise<ResultEnvelope<GetCampaignData | GetCampaignSummaryData>>;
280
396
  getCampaignAnalytics(input: unknown): Promise<ResultEnvelope<GetCampaignAnalyticsJsonData | GetCampaignAnalyticsSummaryData>>;
281
- getBilling(input: unknown): Promise<ResultEnvelope<GetBillingData>>;
282
- getPlatformStatus(input: unknown): Promise<ResultEnvelope<GetPlatformStatusData>>;
397
+ getBilling(input: unknown): Promise<ResultEnvelope<GetBillingData | GetBillingSummaryData>>;
398
+ getPlatformStatus(input: unknown): Promise<ResultEnvelope<GetPlatformStatusData | GetPlatformStatusSummaryData>>;
283
399
  pauseCampaign(input: unknown): Promise<ResultEnvelope<PauseResumeCampaignData>>;
284
400
  resumeCampaign(input: unknown): Promise<ResultEnvelope<PauseResumeCampaignData>>;
285
401
  updateBudget(input: unknown): Promise<ResultEnvelope<UpdateBudgetData>>;
286
- listMediaAssets(input: unknown): Promise<ResultEnvelope<ListMediaAssetsData>>;
402
+ listMediaAssets(input: unknown): Promise<ResultEnvelope<ListMediaAssetsData | ListMediaAssetsSummaryData>>;
287
403
  launchCampaign(input: unknown): Promise<ResultEnvelope<LaunchCampaignData>>;
288
404
  };
289
405
  declare function createDynamoiMcpServer(options: {
@@ -296,10 +412,19 @@ declare const ToolFormatSchema: z.ZodEnum<{
296
412
  }>;
297
413
  declare const DynamoiListArtistsInputSchema: z.ZodObject<{
298
414
  cursor: z.ZodOptional<z.ZodString>;
415
+ format: z.ZodOptional<z.ZodEnum<{
416
+ json: "json";
417
+ summary: "summary";
418
+ }>>;
299
419
  limit: z.ZodOptional<z.ZodNumber>;
300
420
  }, z.core.$strip>;
301
421
  declare const DynamoiSearchInputSchema: z.ZodObject<{
422
+ artistId: z.ZodOptional<z.ZodString>;
302
423
  cursor: z.ZodOptional<z.ZodString>;
424
+ format: z.ZodOptional<z.ZodEnum<{
425
+ json: "json";
426
+ summary: "summary";
427
+ }>>;
303
428
  limit: z.ZodOptional<z.ZodNumber>;
304
429
  query: z.ZodOptional<z.ZodString>;
305
430
  type: z.ZodOptional<z.ZodEnum<{
@@ -308,11 +433,25 @@ declare const DynamoiSearchInputSchema: z.ZodObject<{
308
433
  smartlink: "smartlink";
309
434
  }>>;
310
435
  }, z.core.$strip>;
436
+ declare const DynamoiGetCurrentUserInputSchema: z.ZodObject<{
437
+ format: z.ZodOptional<z.ZodEnum<{
438
+ json: "json";
439
+ summary: "summary";
440
+ }>>;
441
+ }, z.core.$strip>;
311
442
  declare const DynamoiGetArtistInputSchema: z.ZodObject<{
312
443
  artistId: z.ZodString;
444
+ format: z.ZodOptional<z.ZodEnum<{
445
+ json: "json";
446
+ summary: "summary";
447
+ }>>;
313
448
  }, z.core.$strip>;
314
449
  declare const DynamoiListCampaignsInputSchema: z.ZodObject<{
315
450
  artistId: z.ZodString;
451
+ campaignType: z.ZodOptional<z.ZodEnum<{
452
+ SMART_CAMPAIGN: "SMART_CAMPAIGN";
453
+ YOUTUBE: "YOUTUBE";
454
+ }>>;
316
455
  cursor: z.ZodOptional<z.ZodString>;
317
456
  format: z.ZodOptional<z.ZodEnum<{
318
457
  json: "json";
@@ -323,6 +462,11 @@ declare const DynamoiListCampaignsInputSchema: z.ZodObject<{
323
462
  }, z.core.$strip>;
324
463
  declare const DynamoiGetCampaignInputSchema: z.ZodObject<{
325
464
  campaignId: z.ZodString;
465
+ format: z.ZodOptional<z.ZodEnum<{
466
+ json: "json";
467
+ summary: "summary";
468
+ }>>;
469
+ includeCountries: z.ZodOptional<z.ZodBoolean>;
326
470
  }, z.core.$strip>;
327
471
  declare const DateRangeSchema: z.ZodObject<{
328
472
  end: z.ZodString;
@@ -338,12 +482,39 @@ declare const DynamoiGetCampaignAnalyticsInputSchema: z.ZodObject<{
338
482
  json: "json";
339
483
  summary: "summary";
340
484
  }>>;
485
+ granularity: z.ZodOptional<z.ZodEnum<{
486
+ DAILY: "DAILY";
487
+ TOTAL: "TOTAL";
488
+ }>>;
489
+ }, z.core.$strip>;
490
+ declare const DynamoiGetArtistAnalyticsInputSchema: z.ZodObject<{
491
+ artistId: z.ZodString;
492
+ dateRange: z.ZodOptional<z.ZodObject<{
493
+ end: z.ZodString;
494
+ start: z.ZodString;
495
+ }, z.core.$strip>>;
496
+ format: z.ZodOptional<z.ZodEnum<{
497
+ json: "json";
498
+ summary: "summary";
499
+ }>>;
500
+ granularity: z.ZodOptional<z.ZodEnum<{
501
+ DAILY: "DAILY";
502
+ TOTAL: "TOTAL";
503
+ }>>;
341
504
  }, z.core.$strip>;
342
505
  declare const DynamoiGetBillingInputSchema: z.ZodObject<{
343
506
  artistId: z.ZodString;
507
+ format: z.ZodOptional<z.ZodEnum<{
508
+ json: "json";
509
+ summary: "summary";
510
+ }>>;
344
511
  }, z.core.$strip>;
345
512
  declare const DynamoiGetPlatformStatusInputSchema: z.ZodObject<{
346
513
  artistId: z.ZodString;
514
+ format: z.ZodOptional<z.ZodEnum<{
515
+ json: "json";
516
+ summary: "summary";
517
+ }>>;
347
518
  }, z.core.$strip>;
348
519
  declare const DynamoiPauseCampaignInputSchema: z.ZodObject<{
349
520
  campaignId: z.ZodString;
@@ -359,6 +530,10 @@ declare const DynamoiUpdateBudgetInputSchema: z.ZodObject<{
359
530
  declare const DynamoiListMediaAssetsInputSchema: z.ZodObject<{
360
531
  artistId: z.ZodString;
361
532
  cursor: z.ZodOptional<z.ZodString>;
533
+ format: z.ZodOptional<z.ZodEnum<{
534
+ json: "json";
535
+ summary: "summary";
536
+ }>>;
362
537
  limit: z.ZodOptional<z.ZodNumber>;
363
538
  }, z.core.$strip>;
364
539
  declare const DynamoiLaunchCampaignInputSchema: z.ZodObject<{
@@ -397,6 +572,18 @@ declare const DynamoiLaunchCampaignInputSchema: z.ZodObject<{
397
572
  youtubeVideoId: z.ZodOptional<z.ZodString>;
398
573
  }, z.core.$strip>;
399
574
  declare const PHASE_1_TOOL_DEFINITIONS: readonly [{
575
+ readonly description: "Get the currently authenticated Dynamoi account context — user ID, email, and accessible organizations/artists with resolved roles.";
576
+ readonly destructiveHint: false;
577
+ readonly name: "dynamoi_get_current_user";
578
+ readonly openWorldHint: false;
579
+ readonly readOnlyHint: true;
580
+ readonly schema: z.ZodObject<{
581
+ format: z.ZodOptional<z.ZodEnum<{
582
+ json: "json";
583
+ summary: "summary";
584
+ }>>;
585
+ }, z.core.$strip>;
586
+ }, {
400
587
  readonly description: "List all music artists and YouTube channels the user manages. Returns each artist's subscription tier, billing status, active campaign count, and the user's role.";
401
588
  readonly destructiveHint: false;
402
589
  readonly name: "dynamoi_list_artists";
@@ -404,6 +591,10 @@ declare const PHASE_1_TOOL_DEFINITIONS: readonly [{
404
591
  readonly readOnlyHint: true;
405
592
  readonly schema: z.ZodObject<{
406
593
  cursor: z.ZodOptional<z.ZodString>;
594
+ format: z.ZodOptional<z.ZodEnum<{
595
+ json: "json";
596
+ summary: "summary";
597
+ }>>;
407
598
  limit: z.ZodOptional<z.ZodNumber>;
408
599
  }, z.core.$strip>;
409
600
  }, {
@@ -413,7 +604,12 @@ declare const PHASE_1_TOOL_DEFINITIONS: readonly [{
413
604
  readonly openWorldHint: false;
414
605
  readonly readOnlyHint: true;
415
606
  readonly schema: z.ZodObject<{
607
+ artistId: z.ZodOptional<z.ZodString>;
416
608
  cursor: z.ZodOptional<z.ZodString>;
609
+ format: z.ZodOptional<z.ZodEnum<{
610
+ json: "json";
611
+ summary: "summary";
612
+ }>>;
417
613
  limit: z.ZodOptional<z.ZodNumber>;
418
614
  query: z.ZodOptional<z.ZodString>;
419
615
  type: z.ZodOptional<z.ZodEnum<{
@@ -430,6 +626,10 @@ declare const PHASE_1_TOOL_DEFINITIONS: readonly [{
430
626
  readonly readOnlyHint: true;
431
627
  readonly schema: z.ZodObject<{
432
628
  artistId: z.ZodString;
629
+ format: z.ZodOptional<z.ZodEnum<{
630
+ json: "json";
631
+ summary: "summary";
632
+ }>>;
433
633
  }, z.core.$strip>;
434
634
  }, {
435
635
  readonly description: "List ad campaigns for an artist — each campaign's content title, type (Smart Campaign for Spotify or YouTube for channel growth), budget, status, and platforms. Supports status filtering and pagination.";
@@ -439,6 +639,10 @@ declare const PHASE_1_TOOL_DEFINITIONS: readonly [{
439
639
  readonly readOnlyHint: true;
440
640
  readonly schema: z.ZodObject<{
441
641
  artistId: z.ZodString;
642
+ campaignType: z.ZodOptional<z.ZodEnum<{
643
+ SMART_CAMPAIGN: "SMART_CAMPAIGN";
644
+ YOUTUBE: "YOUTUBE";
645
+ }>>;
442
646
  cursor: z.ZodOptional<z.ZodString>;
443
647
  format: z.ZodOptional<z.ZodEnum<{
444
648
  json: "json";
@@ -448,13 +652,18 @@ declare const PHASE_1_TOOL_DEFINITIONS: readonly [{
448
652
  status: z.ZodOptional<z.ZodString>;
449
653
  }, z.core.$strip>;
450
654
  }, {
451
- readonly description: "Get full details for a campaign — budget, targeting countries, per-platform status for Meta and Google, smart link URL, and any blocked reasons with suggested next actions.";
655
+ readonly description: "Get full details for a campaign — budget, targeting, per-platform status for Meta and Google, smart link URL, and any blocked reasons with suggested next actions. By default, targeting returns a countryCount; pass includeCountries=true to include the full country list.";
452
656
  readonly destructiveHint: false;
453
657
  readonly name: "dynamoi_get_campaign";
454
658
  readonly openWorldHint: false;
455
659
  readonly readOnlyHint: true;
456
660
  readonly schema: z.ZodObject<{
457
661
  campaignId: z.ZodString;
662
+ format: z.ZodOptional<z.ZodEnum<{
663
+ json: "json";
664
+ summary: "summary";
665
+ }>>;
666
+ includeCountries: z.ZodOptional<z.ZodBoolean>;
458
667
  }, z.core.$strip>;
459
668
  }, {
460
669
  readonly description: "Get performance analytics for a campaign — impressions, clicks, ad spend, CPC, CPM, and CTR. Optionally filter by date range. Returns per-platform breakdowns for Meta Ads and Google Ads.";
@@ -472,6 +681,31 @@ declare const PHASE_1_TOOL_DEFINITIONS: readonly [{
472
681
  json: "json";
473
682
  summary: "summary";
474
683
  }>>;
684
+ granularity: z.ZodOptional<z.ZodEnum<{
685
+ DAILY: "DAILY";
686
+ TOTAL: "TOTAL";
687
+ }>>;
688
+ }, z.core.$strip>;
689
+ }, {
690
+ readonly description: "Get performance analytics for an artist across all their campaigns — impressions, clicks, and billable ad spend with optional daily breakdowns per platform.";
691
+ readonly destructiveHint: false;
692
+ readonly name: "dynamoi_get_artist_analytics";
693
+ readonly openWorldHint: false;
694
+ readonly readOnlyHint: true;
695
+ readonly schema: z.ZodObject<{
696
+ artistId: z.ZodString;
697
+ dateRange: z.ZodOptional<z.ZodObject<{
698
+ end: z.ZodString;
699
+ start: z.ZodString;
700
+ }, z.core.$strip>>;
701
+ format: z.ZodOptional<z.ZodEnum<{
702
+ json: "json";
703
+ summary: "summary";
704
+ }>>;
705
+ granularity: z.ZodOptional<z.ZodEnum<{
706
+ DAILY: "DAILY";
707
+ TOTAL: "TOTAL";
708
+ }>>;
475
709
  }, z.core.$strip>;
476
710
  }, {
477
711
  readonly description: "Get an artist's billing summary — subscription tier, ad credit balance, billing status, and recent spend. Shows remaining credits and campaign usage for the current period.";
@@ -481,6 +715,10 @@ declare const PHASE_1_TOOL_DEFINITIONS: readonly [{
481
715
  readonly readOnlyHint: true;
482
716
  readonly schema: z.ZodObject<{
483
717
  artistId: z.ZodString;
718
+ format: z.ZodOptional<z.ZodEnum<{
719
+ json: "json";
720
+ summary: "summary";
721
+ }>>;
484
722
  }, z.core.$strip>;
485
723
  }, {
486
724
  readonly description: "Check connection health for Spotify, Meta (Facebook/Instagram), and YouTube. Shows connection status, token expiry, and what steps remain before campaigns can launch on each platform.";
@@ -490,6 +728,10 @@ declare const PHASE_1_TOOL_DEFINITIONS: readonly [{
490
728
  readonly readOnlyHint: true;
491
729
  readonly schema: z.ZodObject<{
492
730
  artistId: z.ZodString;
731
+ format: z.ZodOptional<z.ZodEnum<{
732
+ json: "json";
733
+ summary: "summary";
734
+ }>>;
493
735
  }, z.core.$strip>;
494
736
  }];
495
737
  declare const PHASE_2_TOOL_DEFINITIONS: readonly [{
@@ -523,7 +765,7 @@ declare const PHASE_2_TOOL_DEFINITIONS: readonly [{
523
765
  }, z.core.$strip>;
524
766
  }];
525
767
  declare const PHASE_3_TOOL_DEFINITIONS: readonly [{
526
- readonly description: "List an artist's uploaded creative assets (images and videos) available for campaign launches. Use this to select media before launching a Smart Campaign.";
768
+ readonly description: "List an artist's uploaded creative assets (images and videos) available for campaign launches. Includes width/height (when available) and a computed aspect ratio to help pick the right creative.";
527
769
  readonly destructiveHint: false;
528
770
  readonly name: "dynamoi_list_media_assets";
529
771
  readonly openWorldHint: false;
@@ -531,6 +773,10 @@ declare const PHASE_3_TOOL_DEFINITIONS: readonly [{
531
773
  readonly schema: z.ZodObject<{
532
774
  artistId: z.ZodString;
533
775
  cursor: z.ZodOptional<z.ZodString>;
776
+ format: z.ZodOptional<z.ZodEnum<{
777
+ json: "json";
778
+ summary: "summary";
779
+ }>>;
534
780
  limit: z.ZodOptional<z.ZodNumber>;
535
781
  }, z.core.$strip>;
536
782
  }, {
@@ -591,4 +837,4 @@ type HandleOptions = {
591
837
  };
592
838
  declare function handleMcpHttpRequest(options: HandleOptions): Promise<Response>;
593
839
 
594
- export { type AccessRole, type ArtistTier, type BillingStatus, type CampaignDisplayStatus, type CampaignType, DateRangeSchema, DynamoiGetArtistInputSchema, DynamoiGetBillingInputSchema, DynamoiGetCampaignAnalyticsInputSchema, DynamoiGetCampaignInputSchema, DynamoiGetPlatformStatusInputSchema, DynamoiLaunchCampaignInputSchema, DynamoiListArtistsInputSchema, DynamoiListCampaignsInputSchema, DynamoiListMediaAssetsInputSchema, DynamoiPauseCampaignInputSchema, DynamoiResumeCampaignInputSchema, DynamoiSearchInputSchema, DynamoiUpdateBudgetInputSchema, type GetArtistData, type GetBillingData, type GetCampaignAnalyticsJsonData, type GetCampaignAnalyticsSummaryData, type GetCampaignData, type GetPlatformStatusData, type LaunchCampaignData, type ListArtistsData, type ListCampaignsJsonData, type ListCampaignsSummaryData, type ListMediaAssetsData, type MediaAssetSummary, type MoneyDisplay, PHASE_1_TOOL_DEFINITIONS, PHASE_2_TOOL_DEFINITIONS, PHASE_3_TOOL_DEFINITIONS, type PauseResumeCampaignData, type PauseResumePlatformResult, type Phase3Adapter, type ResultEnvelope, type SearchData, type SearchResultType, ToolFormatSchema, type UpdateBudgetData, buildProtectedResourceMetadata, buildWwwAuthenticateHeader, createDynamoiMcpServer, handleMcpHttpRequest, verifyAccessToken };
840
+ export { type AccessRole, type ArtistTier, type BillingStatus, type CampaignDisplayStatus, type CampaignType, DateRangeSchema, DynamoiGetArtistAnalyticsInputSchema, DynamoiGetArtistInputSchema, DynamoiGetBillingInputSchema, DynamoiGetCampaignAnalyticsInputSchema, DynamoiGetCampaignInputSchema, DynamoiGetCurrentUserInputSchema, DynamoiGetPlatformStatusInputSchema, DynamoiLaunchCampaignInputSchema, DynamoiListArtistsInputSchema, DynamoiListCampaignsInputSchema, DynamoiListMediaAssetsInputSchema, DynamoiPauseCampaignInputSchema, DynamoiResumeCampaignInputSchema, DynamoiSearchInputSchema, DynamoiUpdateBudgetInputSchema, type GetArtistAnalyticsJsonData, type GetArtistAnalyticsSummaryData, type GetArtistData, type GetArtistSummaryData, type GetBillingData, type GetBillingSummaryData, type GetCampaignAnalyticsJsonData, type GetCampaignAnalyticsSummaryData, type GetCampaignData, type GetCampaignSummaryData, type GetCurrentUserData, type GetCurrentUserSummaryData, type GetPlatformStatusData, type GetPlatformStatusSummaryData, type LaunchCampaignData, type ListArtistsData, type ListArtistsSummaryData, type ListCampaignsJsonData, type ListCampaignsSummaryData, type ListMediaAssetsData, type ListMediaAssetsSummaryData, type MediaAssetSummary, type MoneyDisplay, PHASE_1_TOOL_DEFINITIONS, PHASE_2_TOOL_DEFINITIONS, PHASE_3_TOOL_DEFINITIONS, type PauseResumeCampaignData, type PauseResumePlatformResult, type Phase3Adapter, type ResultEnvelope, type SearchData, type SearchResultType, type SearchSummaryData, ToolFormatSchema, type UpdateBudgetData, buildProtectedResourceMetadata, buildWwwAuthenticateHeader, createDynamoiMcpServer, handleMcpHttpRequest, verifyAccessToken };
package/dist/index.js CHANGED
@@ -132,7 +132,7 @@ Principles:
132
132
  "partial_success".
133
133
  - Prefer read tools first before write tools. For writes, confirm intent and restate
134
134
  what will change.
135
- - All money values returned are display values. Do not attempt to infer internal costs.
135
+ - Money values are shown in USD as presented in Dynamoi.
136
136
  - Budget minimums: $10/day (daily), $100 total (Smart Campaign), $50 total (YouTube).
137
137
 
138
138
  Common workflows:
@@ -236,26 +236,36 @@ import * as z2 from "zod/v4";
236
236
  var ToolFormatSchema = z2.enum(["json", "summary"]);
237
237
  var DynamoiListArtistsInputSchema = z2.object({
238
238
  cursor: z2.string().optional(),
239
+ format: ToolFormatSchema.optional(),
239
240
  limit: z2.number().int().min(1).max(50).optional()
240
241
  });
241
242
  var DynamoiSearchInputSchema = z2.object({
243
+ artistId: z2.string().uuid().optional(),
242
244
  cursor: z2.string().optional(),
245
+ format: ToolFormatSchema.optional(),
243
246
  limit: z2.number().int().min(1).max(50).optional(),
244
247
  query: z2.string().trim().optional(),
245
248
  type: z2.enum(["artist", "campaign", "smartlink"]).optional()
246
249
  });
250
+ var DynamoiGetCurrentUserInputSchema = z2.object({
251
+ format: ToolFormatSchema.optional()
252
+ });
247
253
  var DynamoiGetArtistInputSchema = z2.object({
248
- artistId: z2.string().uuid()
254
+ artistId: z2.string().uuid(),
255
+ format: ToolFormatSchema.optional()
249
256
  });
250
257
  var DynamoiListCampaignsInputSchema = z2.object({
251
258
  artistId: z2.string().uuid(),
259
+ campaignType: z2.enum(["SMART_CAMPAIGN", "YOUTUBE"]).optional(),
252
260
  cursor: z2.string().optional(),
253
261
  format: ToolFormatSchema.optional(),
254
262
  limit: z2.number().int().min(1).max(50).optional(),
255
263
  status: z2.string().trim().optional()
256
264
  });
257
265
  var DynamoiGetCampaignInputSchema = z2.object({
258
- campaignId: z2.string().uuid()
266
+ campaignId: z2.string().uuid(),
267
+ format: ToolFormatSchema.optional(),
268
+ includeCountries: z2.boolean().optional()
259
269
  });
260
270
  var DateRangeSchema = z2.object({
261
271
  end: z2.string().regex(/^\d{4}-\d{2}-\d{2}$/),
@@ -264,13 +274,22 @@ var DateRangeSchema = z2.object({
264
274
  var DynamoiGetCampaignAnalyticsInputSchema = z2.object({
265
275
  campaignId: z2.string().uuid(),
266
276
  dateRange: DateRangeSchema.optional(),
267
- format: ToolFormatSchema.optional()
277
+ format: ToolFormatSchema.optional(),
278
+ granularity: z2.enum(["TOTAL", "DAILY"]).optional()
279
+ });
280
+ var DynamoiGetArtistAnalyticsInputSchema = z2.object({
281
+ artistId: z2.string().uuid(),
282
+ dateRange: DateRangeSchema.optional(),
283
+ format: ToolFormatSchema.optional(),
284
+ granularity: z2.enum(["TOTAL", "DAILY"]).optional()
268
285
  });
269
286
  var DynamoiGetBillingInputSchema = z2.object({
270
- artistId: z2.string().uuid()
287
+ artistId: z2.string().uuid(),
288
+ format: ToolFormatSchema.optional()
271
289
  });
272
290
  var DynamoiGetPlatformStatusInputSchema = z2.object({
273
- artistId: z2.string().uuid()
291
+ artistId: z2.string().uuid(),
292
+ format: ToolFormatSchema.optional()
274
293
  });
275
294
  var DynamoiPauseCampaignInputSchema = z2.object({
276
295
  campaignId: z2.string().uuid()
@@ -290,6 +309,7 @@ var LocationTargetSchema = z2.object({
290
309
  var DynamoiListMediaAssetsInputSchema = z2.object({
291
310
  artistId: z2.string().uuid(),
292
311
  cursor: z2.string().optional(),
312
+ format: ToolFormatSchema.optional(),
293
313
  limit: z2.number().int().min(1).max(50).optional()
294
314
  });
295
315
  var DynamoiLaunchCampaignInputSchema = z2.object({
@@ -406,6 +426,14 @@ var DynamoiLaunchCampaignInputSchema = z2.object({
406
426
  }
407
427
  });
408
428
  var PHASE_1_TOOL_DEFINITIONS = [
429
+ {
430
+ description: "Get the currently authenticated Dynamoi account context \u2014 user ID, email, and accessible organizations/artists with resolved roles.",
431
+ destructiveHint: false,
432
+ name: "dynamoi_get_current_user",
433
+ openWorldHint: false,
434
+ readOnlyHint: true,
435
+ schema: DynamoiGetCurrentUserInputSchema
436
+ },
409
437
  {
410
438
  description: "List all music artists and YouTube channels the user manages. Returns each artist's subscription tier, billing status, active campaign count, and the user's role.",
411
439
  destructiveHint: false,
@@ -439,7 +467,7 @@ var PHASE_1_TOOL_DEFINITIONS = [
439
467
  schema: DynamoiListCampaignsInputSchema
440
468
  },
441
469
  {
442
- description: "Get full details for a campaign \u2014 budget, targeting countries, per-platform status for Meta and Google, smart link URL, and any blocked reasons with suggested next actions.",
470
+ description: "Get full details for a campaign \u2014 budget, targeting, per-platform status for Meta and Google, smart link URL, and any blocked reasons with suggested next actions. By default, targeting returns a countryCount; pass includeCountries=true to include the full country list.",
443
471
  destructiveHint: false,
444
472
  name: "dynamoi_get_campaign",
445
473
  openWorldHint: false,
@@ -454,6 +482,14 @@ var PHASE_1_TOOL_DEFINITIONS = [
454
482
  readOnlyHint: true,
455
483
  schema: DynamoiGetCampaignAnalyticsInputSchema
456
484
  },
485
+ {
486
+ description: "Get performance analytics for an artist across all their campaigns \u2014 impressions, clicks, and billable ad spend with optional daily breakdowns per platform.",
487
+ destructiveHint: false,
488
+ name: "dynamoi_get_artist_analytics",
489
+ openWorldHint: false,
490
+ readOnlyHint: true,
491
+ schema: DynamoiGetArtistAnalyticsInputSchema
492
+ },
457
493
  {
458
494
  description: "Get an artist's billing summary \u2014 subscription tier, ad credit balance, billing status, and recent spend. Shows remaining credits and campaign usage for the current period.",
459
495
  destructiveHint: false,
@@ -499,7 +535,7 @@ var PHASE_2_TOOL_DEFINITIONS = [
499
535
  ];
500
536
  var PHASE_3_TOOL_DEFINITIONS = [
501
537
  {
502
- description: "List an artist's uploaded creative assets (images and videos) available for campaign launches. Use this to select media before launching a Smart Campaign.",
538
+ description: "List an artist's uploaded creative assets (images and videos) available for campaign launches. Includes width/height (when available) and a computed aspect ratio to help pick the right creative.",
503
539
  destructiveHint: false,
504
540
  name: "dynamoi_list_media_assets",
505
541
  openWorldHint: false,
@@ -551,12 +587,18 @@ function createDynamoiMcpServer(options) {
551
587
  },
552
588
  async (input) => {
553
589
  switch (def.name) {
590
+ case "dynamoi_get_current_user":
591
+ return asTextResult(await options.adapter.getCurrentUser(input));
554
592
  case "dynamoi_list_artists":
555
593
  return asTextResult(await options.adapter.listArtists(input));
556
594
  case "dynamoi_search":
557
595
  return asTextResult(await options.adapter.search(input));
558
596
  case "dynamoi_get_artist":
559
597
  return asTextResult(await options.adapter.getArtist(input));
598
+ case "dynamoi_get_artist_analytics":
599
+ return asTextResult(
600
+ await options.adapter.getArtistAnalytics(input)
601
+ );
560
602
  case "dynamoi_list_campaigns":
561
603
  return asTextResult(await options.adapter.listCampaigns(input));
562
604
  case "dynamoi_get_campaign":
@@ -853,10 +895,12 @@ async function handleMcpHttpRequest(options) {
853
895
  }
854
896
  export {
855
897
  DateRangeSchema,
898
+ DynamoiGetArtistAnalyticsInputSchema,
856
899
  DynamoiGetArtistInputSchema,
857
900
  DynamoiGetBillingInputSchema,
858
901
  DynamoiGetCampaignAnalyticsInputSchema,
859
902
  DynamoiGetCampaignInputSchema,
903
+ DynamoiGetCurrentUserInputSchema,
860
904
  DynamoiGetPlatformStatusInputSchema,
861
905
  DynamoiLaunchCampaignInputSchema,
862
906
  DynamoiListArtistsInputSchema,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/auth/protected-resource.ts","../src/auth/verify-token.ts","../src/server/create-server.ts","../src/version.ts","../src/server/instructions.ts","../src/server/prompts.ts","../src/server/tools.ts","../src/transport/http.ts"],"sourcesContent":["type ProtectedResourceMetadata = {\n\tresource: string;\n\tauthorization_servers: string[];\n\tscopes_supported: string[];\n};\n\nexport function buildProtectedResourceMetadata(options: {\n\tresource: string;\n\tauthorizationServers: string[];\n\tscopesSupported?: string[];\n}): ProtectedResourceMetadata {\n\treturn {\n\t\tauthorization_servers: options.authorizationServers,\n\t\tresource: options.resource,\n\t\t// Supabase OAuth Server (beta) can fail token exchange when `openid` is requested\n\t\t// (it attempts to mint an ID token). Our MCP only needs an access token.\n\t\tscopes_supported: options.scopesSupported ?? [\"email\", \"profile\"],\n\t};\n}\n\nexport function buildWwwAuthenticateHeader(options: {\n\tresourceMetadataUrl: string;\n\tscope?: string;\n}): string {\n\tconst scope = options.scope ?? \"email profile\";\n\t// RFC 6750 style with resource metadata extension.\n\treturn `Bearer resource_metadata=\"${options.resourceMetadataUrl}\", scope=\"${scope}\"`;\n}\n","import { createRemoteJWKSet, type JWTVerifyOptions, jwtVerify } from \"jose\";\n\nexport type VerifiedAccessToken = {\n\tsub: string;\n\tiss: string;\n\taud: string | string[] | undefined;\n\texp: number;\n\tclientId: string | null;\n};\n\ntype VerifyAccessTokenOptions = {\n\ttoken: string;\n\tjwksUrl: string;\n\tissuer: string;\n\taudienceAllowlist: string[];\n};\n\nconst jwksByUrl = new Map<string, ReturnType<typeof createRemoteJWKSet>>();\n\nfunction getRemoteJwks(jwksUrl: string) {\n\tconst existing = jwksByUrl.get(jwksUrl);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst created = createRemoteJWKSet(new URL(jwksUrl));\n\tjwksByUrl.set(jwksUrl, created);\n\treturn created;\n}\n\nfunction extractClientId(payload: Record<string, unknown>): string | null {\n\tconst direct = payload[\"client_id\"];\n\tif (typeof direct === \"string\" && direct.trim().length > 0) {\n\t\treturn direct;\n\t}\n\tconst azp = payload[\"azp\"];\n\tif (typeof azp === \"string\" && azp.trim().length > 0) {\n\t\treturn azp;\n\t}\n\treturn null;\n}\n\nexport async function verifyAccessToken(\n\toptions: VerifyAccessTokenOptions,\n): Promise<VerifiedAccessToken> {\n\tconst jwks = getRemoteJwks(options.jwksUrl);\n\tconst verifyOptions: JWTVerifyOptions = {\n\t\talgorithms: [\"ES256\", \"RS256\"],\n\t\taudience: options.audienceAllowlist,\n\t\tissuer: options.issuer,\n\t};\n\n\tconst { payload } = await jwtVerify(options.token, jwks, verifyOptions);\n\n\tconst sub = typeof payload.sub === \"string\" ? payload.sub : null;\n\tif (!sub) {\n\t\tthrow new Error(\"JWT missing sub\");\n\t}\n\tconst iss = typeof payload.iss === \"string\" ? payload.iss : null;\n\tif (!iss) {\n\t\tthrow new Error(\"JWT missing iss\");\n\t}\n\tconst exp = typeof payload.exp === \"number\" ? payload.exp : null;\n\tif (!exp) {\n\t\tthrow new Error(\"JWT missing exp\");\n\t}\n\tconst aud = payload.aud as string | string[] | undefined;\n\n\treturn {\n\t\taud,\n\t\tclientId: extractClientId(payload as Record<string, unknown>),\n\t\texp,\n\t\tiss,\n\t\tsub,\n\t};\n}\n","import {\n\tMcpServer,\n\tResourceTemplate,\n} from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport * as z from \"zod/v4\";\nimport type {\n\tGetArtistData,\n\tGetBillingData,\n\tGetCampaignAnalyticsJsonData,\n\tGetCampaignAnalyticsSummaryData,\n\tGetCampaignData,\n\tGetPlatformStatusData,\n\tLaunchCampaignData,\n\tListArtistsData,\n\tListCampaignsJsonData,\n\tListCampaignsSummaryData,\n\tListMediaAssetsData,\n\tPauseResumeCampaignData,\n\tResultEnvelope,\n\tSearchData,\n\tUpdateBudgetData,\n} from \"../types\";\nimport { DYNAMOI_MCP_VERSION } from \"../version\";\nimport { DYNAMOI_MCP_INSTRUCTIONS } from \"./instructions\";\nimport { registerDynamoiPrompts } from \"./prompts\";\nimport {\n\tPHASE_1_TOOL_DEFINITIONS,\n\tPHASE_2_TOOL_DEFINITIONS,\n\tPHASE_3_TOOL_DEFINITIONS,\n} from \"./tools\";\n\nexport type Phase3Adapter = {\n\tlistArtists(input: unknown): Promise<ResultEnvelope<ListArtistsData>>;\n\tsearch(input: unknown): Promise<ResultEnvelope<SearchData>>;\n\tgetArtist(input: unknown): Promise<ResultEnvelope<GetArtistData>>;\n\tlistCampaigns(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ListCampaignsJsonData | ListCampaignsSummaryData>>;\n\tgetCampaign(input: unknown): Promise<ResultEnvelope<GetCampaignData>>;\n\tgetCampaignAnalytics(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<\n\t\t\tGetCampaignAnalyticsJsonData | GetCampaignAnalyticsSummaryData\n\t\t>\n\t>;\n\tgetBilling(input: unknown): Promise<ResultEnvelope<GetBillingData>>;\n\tgetPlatformStatus(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetPlatformStatusData>>;\n\n\tpauseCampaign(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<PauseResumeCampaignData>>;\n\tresumeCampaign(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<PauseResumeCampaignData>>;\n\tupdateBudget(input: unknown): Promise<ResultEnvelope<UpdateBudgetData>>;\n\n\tlistMediaAssets(input: unknown): Promise<ResultEnvelope<ListMediaAssetsData>>;\n\tlaunchCampaign(input: unknown): Promise<ResultEnvelope<LaunchCampaignData>>;\n};\n\nfunction asTextResult(envelope: unknown) {\n\treturn {\n\t\tcontent: [{ text: JSON.stringify(envelope), type: \"text\" as const }],\n\t\tstructuredContent: envelope as Record<string, unknown>,\n\t};\n}\n\nexport function createDynamoiMcpServer(options: {\n\tadapter: Phase3Adapter;\n}): McpServer {\n\tconst server = new McpServer(\n\t\t{\n\t\t\tname: \"dynamoi\",\n\t\t\tversion: DYNAMOI_MCP_VERSION,\n\t\t\twebsiteUrl: \"https://dynamoi.com\",\n\t\t},\n\t\t{ instructions: DYNAMOI_MCP_INSTRUCTIONS },\n\t);\n\n\t// Tools (Phase 1 + Phase 2)\n\tfor (const def of [\n\t\t...PHASE_1_TOOL_DEFINITIONS,\n\t\t...PHASE_2_TOOL_DEFINITIONS,\n\t\t...PHASE_3_TOOL_DEFINITIONS,\n\t]) {\n\t\tserver.registerTool(\n\t\t\tdef.name,\n\t\t\t{\n\t\t\t\tannotations: {\n\t\t\t\t\tdestructiveHint: def.destructiveHint,\n\t\t\t\t\topenWorldHint: def.openWorldHint,\n\t\t\t\t\treadOnlyHint: def.readOnlyHint,\n\t\t\t\t},\n\t\t\t\tdescription: def.description,\n\t\t\t\tinputSchema: def.schema,\n\t\t\t\ttitle: def.name,\n\t\t\t},\n\t\t\tasync (input: unknown) => {\n\t\t\t\tswitch (def.name) {\n\t\t\t\t\tcase \"dynamoi_list_artists\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.listArtists(input));\n\t\t\t\t\tcase \"dynamoi_search\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.search(input));\n\t\t\t\t\tcase \"dynamoi_get_artist\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.getArtist(input));\n\t\t\t\t\tcase \"dynamoi_list_campaigns\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.listCampaigns(input));\n\t\t\t\t\tcase \"dynamoi_get_campaign\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.getCampaign(input));\n\t\t\t\t\tcase \"dynamoi_get_campaign_analytics\":\n\t\t\t\t\t\treturn asTextResult(\n\t\t\t\t\t\t\tawait options.adapter.getCampaignAnalytics(input),\n\t\t\t\t\t\t);\n\t\t\t\t\tcase \"dynamoi_get_billing\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.getBilling(input));\n\t\t\t\t\tcase \"dynamoi_get_platform_status\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.getPlatformStatus(input));\n\t\t\t\t\tcase \"dynamoi_pause_campaign\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.pauseCampaign(input));\n\t\t\t\t\tcase \"dynamoi_resume_campaign\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.resumeCampaign(input));\n\t\t\t\t\tcase \"dynamoi_update_budget\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.updateBudget(input));\n\t\t\t\t\tcase \"dynamoi_list_media_assets\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.listMediaAssets(input));\n\t\t\t\t\tcase \"dynamoi_launch_campaign\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.launchCampaign(input));\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn asTextResult({\n\t\t\t\t\t\t\tmessage: \"Unknown tool\",\n\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t} satisfies ResultEnvelope<never>);\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\t}\n\n\t// Prompts: curated workflow starters for assistants.\n\tregisterDynamoiPrompts(server);\n\n\t// Static resources (small, cache-friendly reference data)\n\tserver.registerResource(\n\t\t\"platform-pricing\",\n\t\t\"dynamoi://platform/pricing\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Dynamoi pricing, activation bonus, ad credit structure, and campaign budget minimums.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Pricing\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tactivationBonus: {\n\t\t\t\t\t\t\tamountUsd: 600,\n\t\t\t\t\t\t\tnote: \"100% match on first month — pay $300, get $600 ad credit\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbudgetMinimums: {\n\t\t\t\t\t\t\tsmartCampaign: {\n\t\t\t\t\t\t\t\tdailyUsd: 10,\n\t\t\t\t\t\t\t\tnote: \"Meta Ads for Spotify promotion\",\n\t\t\t\t\t\t\t\ttotalUsd: 100,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyoutube: {\n\t\t\t\t\t\t\t\tdailyUsd: 10,\n\t\t\t\t\t\t\t\tnote: \"Google Ads for YouTube channel growth\",\n\t\t\t\t\t\t\t\ttotalUsd: 50,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcreditRollover: \"Credits roll over for 12 months\",\n\t\t\t\t\t\tincludes:\n\t\t\t\t\t\t\t\"Unlimited team seats, unlimited artists, white-glove support, free smart link landing pages\",\n\t\t\t\t\t\tnoContracts: true,\n\t\t\t\t\t\ttiers: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"Plus\",\n\t\t\t\t\t\t\t\tnote: \"100% Ad Credit. No agency fees.\",\n\t\t\t\t\t\t\t\tpriceUsdMonthly: 300,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"platform-content-types\",\n\t\t\"dynamoi://platform/content-types\",\n\t\t{ mimeType: \"application/json\", title: \"Content Types\" },\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tcampaignTypes: {\n\t\t\t\t\t\t\tSMART_CAMPAIGN: [\"TRACK\", \"ALBUM\", \"PLAYLIST\"],\n\t\t\t\t\t\t\tYOUTUBE: [\"VIDEO\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcontentTypes: [\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"platform-campaign-statuses\",\n\t\t\"dynamoi://platform/campaign-statuses\",\n\t\t{ mimeType: \"application/json\", title: \"Campaign Statuses\" },\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tstatuses: [\n\t\t\t\t\t\t\t\"AWAITING_SMART_LINK\",\n\t\t\t\t\t\t\t\"CONTENT_VALIDATION\",\n\t\t\t\t\t\t\t\"DEPLOYING\",\n\t\t\t\t\t\t\t\"READY_FOR_REVIEW\",\n\t\t\t\t\t\t\t\"ACTIVE\",\n\t\t\t\t\t\t\t\"PAUSED\",\n\t\t\t\t\t\t\t\"SUBSCRIPTION_PAUSED\",\n\t\t\t\t\t\t\t\"FAILED\",\n\t\t\t\t\t\t\t\"ARCHIVED\",\n\t\t\t\t\t\t\t\"ENDED\",\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\t// Dynamic resources: lightweight equivalents to get_* tools\n\tserver.registerResource(\n\t\t\"artist-resource\",\n\t\tnew ResourceTemplate(\"artist://{artistId}\", {\n\t\t\tlist: async () => ({ resources: [] }),\n\t\t}),\n\t\t{ mimeType: \"application/json\", title: \"Artist\" },\n\t\tasync (uri, variables) => {\n\t\t\tconst artistId = variables[\"artistId\"];\n\t\t\tconst parsed = z.string().uuid().safeParse(artistId);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn {\n\t\t\t\t\tcontents: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\t\t\tmessage: \"Invalid artistId\",\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst envelope = await options.adapter.getArtist({\n\t\t\t\tartistId: parsed.data,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\ttext: JSON.stringify(envelope),\n\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tserver.registerResource(\n\t\t\"campaign-resource\",\n\t\tnew ResourceTemplate(\"campaign://{campaignId}\", {\n\t\t\tlist: async () => ({ resources: [] }),\n\t\t}),\n\t\t{ mimeType: \"application/json\", title: \"Campaign\" },\n\t\tasync (uri, variables) => {\n\t\t\tconst campaignId = variables[\"campaignId\"];\n\t\t\tconst parsed = z.string().uuid().safeParse(campaignId);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn {\n\t\t\t\t\tcontents: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\t\t\tmessage: \"Invalid campaignId\",\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst envelope = await options.adapter.getCampaign({\n\t\t\t\tcampaignId: parsed.data,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\ttext: JSON.stringify(envelope),\n\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\treturn server;\n}\n","// This constant is replaced at build time by tsup (see tsup.config.ts).\n// It must stay a string literal so the define replacement is reliable.\nexport const DYNAMOI_MCP_VERSION = \"__DYNAMOI_MCP_VERSION__\";\n","export const DYNAMOI_MCP_INSTRUCTIONS = `\nYou are operating Dynamoi's tools on behalf of the authenticated user. Dynamoi helps\nmusic artists get more Spotify streams and YouTube creators grow their channels and\nAdSense revenue — through automated ad campaigns on Meta (Facebook/Instagram) and\nGoogle (YouTube).\n\nWho uses Dynamoi:\n- Independent artists promoting singles, albums, and playlists on Spotify\n- Record labels managing campaigns across entire artist rosters with team roles and\n consolidated billing\n- YouTube creators of all kinds — music, education, gaming, vlogs, podcasts, tutorials\n — growing channels and ad revenue\n\nPricing: $300/month converts 100% to ad credit. First month includes a 100% match —\npay $300, get $600 in ad credit. Credits roll over for 12 months. No contracts, cancel\nanytime. No agency fees, no retainers. Unlimited team seats and unlimited artists\nincluded.\n\nEvery client gets white-glove onboarding and ongoing support — from connecting\nplatforms to optimizing channels for campaign performance, step by step.\n\nCampaigns run from Dynamoi-managed ad accounts. Users complete a one-time platform\nconnection, then the AI-powered engine handles deployment and daily optimization.\n\nCampaign types:\n\nSmart Campaign (Meta Ads → Spotify):\n Targeted Facebook and Instagram ads that drive real Spotify streams — no bots, no\n pay-for-play. Includes free unlimited smart link landing pages for every release\n (Spotify, Apple Music, YouTube Music, and more). Ad copy is AI-generated and localized\n to each target market. Supports tracks, albums, and playlists.\n\nYouTube Campaign (Google Ads → YouTube Growth):\n The only ad platform that optimizes for total channel revenue, not just views. Google\n Ads tracks views but can't see which views make money. Dynamoi merges Google Ads cost\n data with YouTube AdSense revenue data to calculate the true revenue per view in each\n country, then adjusts bids daily — exploring new markets with small bids, scaling\n countries where viewer revenue is strong, and auto-pausing countries where the data\n shows they can't cover their costs. The more data the system gathers, the more\n precisely it optimizes. Campaigns require a YouTube playlist so one paid ad view can\n lead to 2, 3, 4+ organic views as the viewer waterfalls down the playlist — optimizing\n for depth of views means one ad click drives sustained organic growth. Ad copy is fully\n internationalized in each target market's local language for better performance and\n lower costs. Works for any type of YouTube channel.\n\nUnlike smart-link-only services (Feature.fm, Linkfire, Hypeddit, ToneDen), Dynamoi is\nan end-to-end promotion system: smart links + ad campaigns + AI optimization +\nanalytics + team management. All with transparent data and no contracts.\n\nPrinciples:\n- Be accurate. If uncertain, ask a clarifying question before acting.\n- Never claim you changed something unless the tool returned status \"success\" or\n \"partial_success\".\n- Prefer read tools first before write tools. For writes, confirm intent and restate\n what will change.\n- All money values returned are display values. Do not attempt to infer internal costs.\n- Budget minimums: $10/day (daily), $100 total (Smart Campaign), $50 total (YouTube).\n\nCommon workflows:\n- Discovery: dynamoi_list_artists → dynamoi_list_campaigns → dynamoi_get_campaign →\n dynamoi_get_campaign_analytics\n- Diagnose stuck campaign: dynamoi_get_campaign → dynamoi_get_platform_status →\n propose next steps\n- Pause/resume: dynamoi_get_campaign (confirm) → dynamoi_pause_campaign or resume\n- Budget update: dynamoi_get_campaign (confirm) → dynamoi_update_budget\n- Launch: dynamoi_list_media_assets → dynamoi_launch_campaign\n`.trim();\n","import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport * as z from \"zod/v4\";\n\nfunction asTextPrompt(text: string) {\n\treturn {\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tcontent: { text, type: \"text\" as const },\n\t\t\t\trole: \"user\" as const,\n\t\t\t},\n\t\t],\n\t};\n}\n\nexport function registerDynamoiPrompts(server: McpServer) {\n\tserver.registerPrompt(\n\t\t\"dynamoi_audit_campaigns\",\n\t\t{\n\t\t\targsSchema: {\n\t\t\t\tartistId: z.string().uuid().optional(),\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t\"Audit an artist's campaigns and summarize what is working and what to fix next.\",\n\t\t\ttitle: \"Audit Campaigns\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Audit my campaigns in Dynamoi.\",\n\t\t\t\t\targs.artistId\n\t\t\t\t\t\t? `Artist ID: ${args.artistId}`\n\t\t\t\t\t\t: \"If no artistId is provided, start by listing artists and ask me which one to audit.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Steps:\",\n\t\t\t\t\t\"1. Use dynamoi_list_campaigns (and dynamoi_get_campaign_analytics for the last 7-14 days) to assess performance.\",\n\t\t\t\t\t\"2. Identify any campaigns that are paused, failed, or stuck in a pre-active state and explain why using dynamoi_get_campaign and dynamoi_get_platform_status.\",\n\t\t\t\t\t\"3. Recommend 3-5 next actions with clear priorities.\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_release_launch_plan\",\n\t\t{\n\t\t\targsSchema: {\n\t\t\t\tartistId: z.string().uuid().optional(),\n\t\t\t\tcontentTitle: z.string().trim().optional(),\n\t\t\t\tcontentType: z.enum([\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"]).optional(),\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t\"Create a pragmatic release launch plan and propose a Dynamoi campaign setup.\",\n\t\t\ttitle: \"Release Launch Plan\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Help me plan a release launch using Dynamoi.\",\n\t\t\t\t\targs.artistId\n\t\t\t\t\t\t? `Artist ID: ${args.artistId}`\n\t\t\t\t\t\t: \"If no artistId is provided, list artists first.\",\n\t\t\t\t\targs.contentType ? `Content type: ${args.contentType}` : \"\",\n\t\t\t\t\targs.contentTitle ? `Title: ${args.contentTitle}` : \"\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Ask any missing questions first (links, creative, budget, countries, dates).\",\n\t\t\t\t\t\"Then propose the simplest campaign plan that fits today’s supported platforms:\",\n\t\t\t\t\t\"- Smart Campaign (Meta) for Spotify/Apple Music releases\",\n\t\t\t\t\t\"- YouTube campaign for videos\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"If we proceed to launch:\",\n\t\t\t\t\t\"- For Smart Campaign: use dynamoi_list_media_assets and then dynamoi_launch_campaign.\",\n\t\t\t\t\t\"- For YouTube: use dynamoi_launch_campaign with youtubeVideoId.\",\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_why_campaign_blocked\",\n\t\t{\n\t\t\targsSchema: {\n\t\t\t\tcampaignId: z.string().uuid(),\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t\"Diagnose why a campaign is blocked/stuck and recommend the next fix.\",\n\t\t\ttitle: \"Why Is My Campaign Blocked?\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"My campaign seems blocked or stuck. Diagnose it and tell me what to do next.\",\n\t\t\t\t\t`Campaign ID: ${args.campaignId}`,\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Steps:\",\n\t\t\t\t\t\"1. Use dynamoi_get_campaign to inspect current status and blockers.\",\n\t\t\t\t\t\"2. Use dynamoi_get_platform_status for the artist to check Meta/Google connection state.\",\n\t\t\t\t\t\"3. If appropriate, suggest safe next actions (pause/resume or budget update) and confirm before executing.\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t),\n\t);\n}\n","import * as z from \"zod/v4\";\n\nexport const ToolFormatSchema = z.enum([\"json\", \"summary\"]);\n\nexport const DynamoiListArtistsInputSchema = z.object({\n\tcursor: z.string().optional(),\n\tlimit: z.number().int().min(1).max(50).optional(),\n});\n\nexport const DynamoiSearchInputSchema = z.object({\n\tcursor: z.string().optional(),\n\tlimit: z.number().int().min(1).max(50).optional(),\n\tquery: z.string().trim().optional(),\n\ttype: z.enum([\"artist\", \"campaign\", \"smartlink\"]).optional(),\n});\n\nexport const DynamoiGetArtistInputSchema = z.object({\n\tartistId: z.string().uuid(),\n});\n\nexport const DynamoiListCampaignsInputSchema = z.object({\n\tartistId: z.string().uuid(),\n\tcursor: z.string().optional(),\n\tformat: ToolFormatSchema.optional(),\n\tlimit: z.number().int().min(1).max(50).optional(),\n\tstatus: z.string().trim().optional(),\n});\n\nexport const DynamoiGetCampaignInputSchema = z.object({\n\tcampaignId: z.string().uuid(),\n});\n\nexport const DateRangeSchema = z.object({\n\tend: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/),\n\tstart: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/),\n});\n\nexport const DynamoiGetCampaignAnalyticsInputSchema = z.object({\n\tcampaignId: z.string().uuid(),\n\tdateRange: DateRangeSchema.optional(),\n\tformat: ToolFormatSchema.optional(),\n});\n\nexport const DynamoiGetBillingInputSchema = z.object({\n\tartistId: z.string().uuid(),\n});\n\nexport const DynamoiGetPlatformStatusInputSchema = z.object({\n\tartistId: z.string().uuid(),\n});\n\nexport const DynamoiPauseCampaignInputSchema = z.object({\n\tcampaignId: z.string().uuid(),\n});\n\nexport const DynamoiResumeCampaignInputSchema = z.object({\n\tcampaignId: z.string().uuid(),\n});\n\nexport const DynamoiUpdateBudgetInputSchema = z.object({\n\tbudgetAmount: z.number().finite().positive(),\n\tcampaignId: z.string().uuid(),\n\tendDate: z\n\t\t.string()\n\t\t.regex(/^\\d{4}-\\d{2}-\\d{2}$/)\n\t\t.optional(),\n});\n\nconst LocationTargetSchema = z.object({\n\tcode: z.string().min(1),\n\tname: z.string().min(1),\n});\n\nexport const DynamoiListMediaAssetsInputSchema = z.object({\n\tartistId: z.string().uuid(),\n\tcursor: z.string().optional(),\n\tlimit: z.number().int().min(1).max(50).optional(),\n});\n\nexport const DynamoiLaunchCampaignInputSchema = z\n\t.object({\n\t\t// Creative\n\t\tadCopy: z.string().trim().optional(),\n\t\tappleMusicUrl: z.string().trim().min(1).optional(),\n\t\tartistId: z.string().uuid(),\n\n\t\t// Budget\n\t\tbudgetAmount: z.number().finite().positive(),\n\t\tbudgetSplits: z.record(\n\t\t\tz.enum([\"META\", \"GOOGLE\"]),\n\t\t\tz.number().int().min(0).max(100),\n\t\t),\n\t\tbudgetType: z.enum([\"DAILY\", \"TOTAL\"]),\n\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\t// Idempotency (client-generated UUID)\n\t\tclientRequestId: z.string().uuid(),\n\n\t\t// Content\n\t\tcontentTitle: z.string().trim().min(1),\n\t\tcontentType: z.enum([\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"]),\n\t\tendDate: z\n\t\t\t.string()\n\t\t\t.regex(/^\\d{4}-\\d{2}-\\d{2}$/)\n\t\t\t.optional(),\n\n\t\t// Targeting\n\t\tlocationTargets: z.array(LocationTargetSchema).optional(),\n\n\t\t// Smart Campaign creative selection (existing assets only in Phase 3)\n\t\tmediaAssetIds: z.array(z.string().uuid()).optional(),\n\t\tspotifyUrl: z.string().trim().min(1).optional(),\n\t\tuseAiGeneratedCopy: z.boolean().optional(),\n\t\tyoutubeVideoId: z.string().trim().min(1).optional(),\n\t})\n\t.superRefine((data, ctx) => {\n\t\tif (data.budgetType === \"TOTAL\" && !data.endDate) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"endDate is required when budgetType is TOTAL\",\n\t\t\t\tpath: [\"endDate\"],\n\t\t\t});\n\t\t}\n\n\t\tconst sum = Object.values(data.budgetSplits ?? {}).reduce(\n\t\t\t(acc, v) => acc + (Number.isFinite(v) ? v : 0),\n\t\t\t0,\n\t\t);\n\t\tif (!(sum > 0)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"budgetSplits must allocate at least one platform\",\n\t\t\t\tpath: [\"budgetSplits\"],\n\t\t\t});\n\t\t}\n\n\t\t// Require splits to sum to ~100 for predictable intent.\n\t\tif (sum > 0 && Math.abs(sum - 100) > 0.01) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"budgetSplits must sum to 100\",\n\t\t\t\tpath: [\"budgetSplits\"],\n\t\t\t});\n\t\t}\n\n\t\tif (data.campaignType === \"SMART_CAMPAIGN\") {\n\t\t\tif (!data.spotifyUrl) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"spotifyUrl is required for SMART_CAMPAIGN\",\n\t\t\t\t\tpath: [\"spotifyUrl\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!data.mediaAssetIds || data.mediaAssetIds.length === 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"mediaAssetIds is required for SMART_CAMPAIGN\",\n\t\t\t\t\tpath: [\"mediaAssetIds\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!(\"META\" in data.budgetSplits) || data.budgetSplits.META <= 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"SMART_CAMPAIGN requires a META budget split > 0\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"META\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\t// Smart Campaigns are Meta-only today. Keep the public contract accurate.\n\t\t\tif (data.budgetSplits.GOOGLE && data.budgetSplits.GOOGLE > 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"SMART_CAMPAIGN does not support GOOGLE budget splits\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"GOOGLE\"],\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tif (data.campaignType === \"YOUTUBE\") {\n\t\t\tif (!data.youtubeVideoId) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"youtubeVideoId is required for YOUTUBE\",\n\t\t\t\t\tpath: [\"youtubeVideoId\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (data.contentType !== \"VIDEO\") {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"contentType must be VIDEO for YOUTUBE\",\n\t\t\t\t\tpath: [\"contentType\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!(\"GOOGLE\" in data.budgetSplits) || data.budgetSplits.GOOGLE <= 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"YOUTUBE requires a GOOGLE budget split > 0\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"GOOGLE\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\t// YouTube campaigns are Google-only today.\n\t\t\tif (data.budgetSplits.META && data.budgetSplits.META > 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"YOUTUBE does not support META budget splits\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"META\"],\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\nexport const PHASE_1_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"List all music artists and YouTube channels the user manages. Returns each artist's subscription tier, billing status, active campaign count, and the user's role.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_artists\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListArtistsInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Search across artists, ad campaigns, and smart links by name or URL. Find a specific Spotify release, YouTube campaign, or artist profile.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_search\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiSearchInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Get a music artist or YouTube channel profile — connected platforms (Spotify, Meta, YouTube), subscription tier, billing status, and whether they're ready to launch campaigns.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_artist\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetArtistInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"List ad campaigns for an artist — each campaign's content title, type (Smart Campaign for Spotify or YouTube for channel growth), budget, status, and platforms. Supports status filtering and pagination.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_campaigns\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListCampaignsInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Get full details for a campaign — budget, targeting countries, per-platform status for Meta and Google, smart link URL, and any blocked reasons with suggested next actions.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_campaign\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetCampaignInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Get performance analytics for a campaign — impressions, clicks, ad spend, CPC, CPM, and CTR. Optionally filter by date range. Returns per-platform breakdowns for Meta Ads and Google Ads.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_campaign_analytics\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetCampaignAnalyticsInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Get an artist's billing summary — subscription tier, ad credit balance, billing status, and recent spend. Shows remaining credits and campaign usage for the current period.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_billing\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetBillingInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Check connection health for Spotify, Meta (Facebook/Instagram), and YouTube. Shows connection status, token expiry, and what steps remain before campaigns can launch on each platform.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_platform_status\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetPlatformStatusInputSchema,\n\t},\n] as const;\n\nexport const PHASE_2_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"Pause a running campaign, stopping ad delivery on Meta (Facebook/Instagram) and/or Google (YouTube). Returns per-platform results.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_pause_campaign\",\n\t\topenWorldHint: true,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiPauseCampaignInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Resume a paused campaign, restarting ad delivery on Meta and/or Google. Returns per-platform results.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_resume_campaign\",\n\t\topenWorldHint: true,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiResumeCampaignInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Change a campaign's daily or total budget amount in USD. For total-budget campaigns, the end date can also be updated. Cannot switch between daily and total budget types.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_update_budget\",\n\t\topenWorldHint: true,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiUpdateBudgetInputSchema,\n\t},\n] as const;\n\nexport const PHASE_3_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"List an artist's uploaded creative assets (images and videos) available for campaign launches. Use this to select media before launching a Smart Campaign.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_media_assets\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListMediaAssetsInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Launch a new campaign to promote a Spotify release (track, album, or playlist via Meta Ads) or grow a YouTube channel (via Google Ads with AdSense revenue optimization). Provide a client-generated request ID for safe retries.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_launch_campaign\",\n\t\topenWorldHint: true,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiLaunchCampaignInputSchema,\n\t},\n] as const;\n","import { randomUUID } from \"node:crypto\";\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { WebStandardStreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js\";\nimport { isInitializeRequest } from \"@modelcontextprotocol/sdk/types.js\";\n\ntype HandleOptions = {\n\tcreateServer: () => McpServer;\n\trequest: Request;\n\tparsedBody: unknown;\n\t/**\n\t * Context key used to bind an in-memory session to the authenticated principal.\n\t * This prevents cross-user/session confusion if an MCP client accidentally reuses\n\t * a `mcp-session-id` across different end users.\n\t *\n\t * Recommended: `${sub}:${clientId ?? \"unknown\"}`.\n\t */\n\tsessionContextKey: string;\n};\n\ntype TransportEntry = {\n\tcreatedAtMs: number;\n\tlastUsedAtMs: number;\n\ttransport: WebStandardStreamableHTTPServerTransport;\n\tcontextKey: string;\n};\n\n// Best-effort in-memory session reuse.\n// On serverless this may not persist, but it still helps in dev and long-lived nodes.\nconst transports = new Map<string, TransportEntry>();\n\nconst SESSION_TTL_MS = 30 * 60 * 1000; // 30 minutes\nconst MAX_SESSIONS = 250;\n\nfunction closeTransportBestEffort(entry: TransportEntry) {\n\tvoid entry.transport.close().catch(() => {\n\t\t// ignore\n\t});\n}\n\nfunction cleanupTransports(nowMs: number) {\n\t// TTL eviction\n\tfor (const [sid, entry] of transports.entries()) {\n\t\tconst expired = nowMs - entry.lastUsedAtMs > SESSION_TTL_MS;\n\t\tif (expired) {\n\t\t\tcloseTransportBestEffort(entry);\n\t\t\ttransports.delete(sid);\n\t\t}\n\t}\n\n\t// Size eviction (oldest by last-used, best-effort)\n\tif (transports.size > MAX_SESSIONS) {\n\t\tconst entries = Array.from(transports.entries()).sort(\n\t\t\t(a, b) => a[1].lastUsedAtMs - b[1].lastUsedAtMs,\n\t\t);\n\t\tconst over = transports.size - MAX_SESSIONS;\n\t\tfor (let i = 0; i < over; i += 1) {\n\t\t\tconst sid = entries[i]?.[0];\n\t\t\tif (sid) {\n\t\t\t\tconst entry = entries[i]?.[1];\n\t\t\t\tif (entry) {\n\t\t\t\t\tcloseTransportBestEffort(entry);\n\t\t\t\t}\n\t\t\t\ttransports.delete(sid);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction getHeader(request: Request, name: string): string | null {\n\tconst value = request.headers.get(name);\n\treturn value && value.trim().length > 0 ? value : null;\n}\n\nfunction jsonRpcSessionNotFound(): Response {\n\t// Match the SDK's invalid-session behavior:\n\t// - HTTP 404\n\t// - JSON-RPC error code -32001 \"Session not found\"\n\treturn new Response(\n\t\tJSON.stringify({\n\t\t\terror: { code: -32_001, message: \"Session not found\" },\n\t\t\tid: null,\n\t\t\tjsonrpc: \"2.0\",\n\t\t}),\n\t\t{\n\t\t\theaders: { \"content-type\": \"application/json\" },\n\t\t\tstatus: 404,\n\t\t},\n\t);\n}\n\nexport async function handleMcpHttpRequest(\n\toptions: HandleOptions,\n): Promise<Response> {\n\tconst nowMs = Date.now();\n\tcleanupTransports(nowMs);\n\n\tconst sessionId = getHeader(options.request, \"mcp-session-id\");\n\tconst existing = sessionId ? transports.get(sessionId) : undefined;\n\n\tif (existing) {\n\t\t// Prevent cross-user/session confusion: sessions are bound to a principal+client.\n\t\tif (existing.contextKey !== options.sessionContextKey) {\n\t\t\tcloseTransportBestEffort(existing);\n\t\t\ttransports.delete(sessionId as string);\n\t\t\treturn jsonRpcSessionNotFound();\n\t\t}\n\n\t\texisting.lastUsedAtMs = nowMs;\n\t\tconst response = await existing.transport.handleRequest(options.request, {\n\t\t\tparsedBody: options.parsedBody,\n\t\t});\n\t\t// Streamable HTTP uses DELETE to close a session.\n\t\tif (options.request.method.toUpperCase() === \"DELETE\" && sessionId) {\n\t\t\t// The SDK closes internally, but we also remove our cache entry.\n\t\t\tcloseTransportBestEffort(existing);\n\t\t\ttransports.delete(sessionId);\n\t\t}\n\t\treturn response;\n\t}\n\n\t// Create a new transport per request. If the request is an initialize call,\n\t// we attach a session ID generator so clients that support sessions can reuse it.\n\tconst isInit = isInitializeRequest(options.parsedBody);\n\tconst transport = new WebStandardStreamableHTTPServerTransport({\n\t\tonsessioninitialized: (sid) => {\n\t\t\ttransports.set(sid, {\n\t\t\t\tcontextKey: options.sessionContextKey,\n\t\t\t\tcreatedAtMs: nowMs,\n\t\t\t\tlastUsedAtMs: nowMs,\n\t\t\t\ttransport,\n\t\t\t});\n\t\t\tcleanupTransports(Date.now());\n\t\t},\n\t\tsessionIdGenerator: isInit ? () => randomUUID() : undefined,\n\t});\n\n\tconst server = options.createServer();\n\tawait server.connect(transport);\n\n\treturn transport.handleRequest(options.request, {\n\t\tparsedBody: options.parsedBody,\n\t});\n}\n"],"mappings":";AAMO,SAAS,+BAA+B,SAIjB;AAC7B,SAAO;AAAA,IACN,uBAAuB,QAAQ;AAAA,IAC/B,UAAU,QAAQ;AAAA;AAAA;AAAA,IAGlB,kBAAkB,QAAQ,mBAAmB,CAAC,SAAS,SAAS;AAAA,EACjE;AACD;AAEO,SAAS,2BAA2B,SAGhC;AACV,QAAM,QAAQ,QAAQ,SAAS;AAE/B,SAAO,6BAA6B,QAAQ,mBAAmB,aAAa,KAAK;AAClF;;;AC3BA,SAAS,oBAA2C,iBAAiB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A,IACA,oBAAoB,SAAS,MAAM,WAAW,IAAI;AAAA,EACnD,CAAC;AAED,QAAM,SAAS,QAAQ,aAAa;AACpC,QAAM,OAAO,QAAQ,SAAS;AAE9B,SAAO,UAAU,cAAc,QAAQ,SAAS;AAAA,IAC/C,YAAY,QAAQ;AAAA,EACrB,CAAC;AACF;","names":["z","z"]}
1
+ {"version":3,"sources":["../src/auth/protected-resource.ts","../src/auth/verify-token.ts","../src/server/create-server.ts","../src/version.ts","../src/server/instructions.ts","../src/server/prompts.ts","../src/server/tools.ts","../src/transport/http.ts"],"sourcesContent":["type ProtectedResourceMetadata = {\n\tresource: string;\n\tauthorization_servers: string[];\n\tscopes_supported: string[];\n};\n\nexport function buildProtectedResourceMetadata(options: {\n\tresource: string;\n\tauthorizationServers: string[];\n\tscopesSupported?: string[];\n}): ProtectedResourceMetadata {\n\treturn {\n\t\tauthorization_servers: options.authorizationServers,\n\t\tresource: options.resource,\n\t\t// Supabase OAuth Server (beta) can fail token exchange when `openid` is requested\n\t\t// (it attempts to mint an ID token). Our MCP only needs an access token.\n\t\tscopes_supported: options.scopesSupported ?? [\"email\", \"profile\"],\n\t};\n}\n\nexport function buildWwwAuthenticateHeader(options: {\n\tresourceMetadataUrl: string;\n\tscope?: string;\n}): string {\n\tconst scope = options.scope ?? \"email profile\";\n\t// RFC 6750 style with resource metadata extension.\n\treturn `Bearer resource_metadata=\"${options.resourceMetadataUrl}\", scope=\"${scope}\"`;\n}\n","import { createRemoteJWKSet, type JWTVerifyOptions, jwtVerify } from \"jose\";\n\nexport type VerifiedAccessToken = {\n\tsub: string;\n\tiss: string;\n\taud: string | string[] | undefined;\n\texp: number;\n\tclientId: string | null;\n};\n\ntype VerifyAccessTokenOptions = {\n\ttoken: string;\n\tjwksUrl: string;\n\tissuer: string;\n\taudienceAllowlist: string[];\n};\n\nconst jwksByUrl = new Map<string, ReturnType<typeof createRemoteJWKSet>>();\n\nfunction getRemoteJwks(jwksUrl: string) {\n\tconst existing = jwksByUrl.get(jwksUrl);\n\tif (existing) {\n\t\treturn existing;\n\t}\n\tconst created = createRemoteJWKSet(new URL(jwksUrl));\n\tjwksByUrl.set(jwksUrl, created);\n\treturn created;\n}\n\nfunction extractClientId(payload: Record<string, unknown>): string | null {\n\tconst direct = payload[\"client_id\"];\n\tif (typeof direct === \"string\" && direct.trim().length > 0) {\n\t\treturn direct;\n\t}\n\tconst azp = payload[\"azp\"];\n\tif (typeof azp === \"string\" && azp.trim().length > 0) {\n\t\treturn azp;\n\t}\n\treturn null;\n}\n\nexport async function verifyAccessToken(\n\toptions: VerifyAccessTokenOptions,\n): Promise<VerifiedAccessToken> {\n\tconst jwks = getRemoteJwks(options.jwksUrl);\n\tconst verifyOptions: JWTVerifyOptions = {\n\t\talgorithms: [\"ES256\", \"RS256\"],\n\t\taudience: options.audienceAllowlist,\n\t\tissuer: options.issuer,\n\t};\n\n\tconst { payload } = await jwtVerify(options.token, jwks, verifyOptions);\n\n\tconst sub = typeof payload.sub === \"string\" ? payload.sub : null;\n\tif (!sub) {\n\t\tthrow new Error(\"JWT missing sub\");\n\t}\n\tconst iss = typeof payload.iss === \"string\" ? payload.iss : null;\n\tif (!iss) {\n\t\tthrow new Error(\"JWT missing iss\");\n\t}\n\tconst exp = typeof payload.exp === \"number\" ? payload.exp : null;\n\tif (!exp) {\n\t\tthrow new Error(\"JWT missing exp\");\n\t}\n\tconst aud = payload.aud as string | string[] | undefined;\n\n\treturn {\n\t\taud,\n\t\tclientId: extractClientId(payload as Record<string, unknown>),\n\t\texp,\n\t\tiss,\n\t\tsub,\n\t};\n}\n","import {\n\tMcpServer,\n\tResourceTemplate,\n} from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport * as z from \"zod/v4\";\nimport type {\n\tGetArtistAnalyticsJsonData,\n\tGetArtistAnalyticsSummaryData,\n\tGetArtistData,\n\tGetArtistSummaryData,\n\tGetBillingData,\n\tGetBillingSummaryData,\n\tGetCampaignAnalyticsJsonData,\n\tGetCampaignAnalyticsSummaryData,\n\tGetCampaignData,\n\tGetCampaignSummaryData,\n\tGetCurrentUserData,\n\tGetCurrentUserSummaryData,\n\tGetPlatformStatusData,\n\tGetPlatformStatusSummaryData,\n\tLaunchCampaignData,\n\tListArtistsData,\n\tListArtistsSummaryData,\n\tListCampaignsJsonData,\n\tListCampaignsSummaryData,\n\tListMediaAssetsData,\n\tListMediaAssetsSummaryData,\n\tPauseResumeCampaignData,\n\tResultEnvelope,\n\tSearchData,\n\tSearchSummaryData,\n\tUpdateBudgetData,\n} from \"../types\";\nimport { DYNAMOI_MCP_VERSION } from \"../version\";\nimport { DYNAMOI_MCP_INSTRUCTIONS } from \"./instructions\";\nimport { registerDynamoiPrompts } from \"./prompts\";\nimport {\n\tPHASE_1_TOOL_DEFINITIONS,\n\tPHASE_2_TOOL_DEFINITIONS,\n\tPHASE_3_TOOL_DEFINITIONS,\n} from \"./tools\";\n\nexport type Phase3Adapter = {\n\tgetCurrentUser(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetCurrentUserData | GetCurrentUserSummaryData>>;\n\tlistArtists(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ListArtistsData | ListArtistsSummaryData>>;\n\tsearch(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<SearchData | SearchSummaryData>>;\n\tgetArtist(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetArtistData | GetArtistSummaryData>>;\n\tgetArtistAnalytics(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<GetArtistAnalyticsJsonData | GetArtistAnalyticsSummaryData>\n\t>;\n\tlistCampaigns(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ListCampaignsJsonData | ListCampaignsSummaryData>>;\n\tgetCampaign(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetCampaignData | GetCampaignSummaryData>>;\n\tgetCampaignAnalytics(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<\n\t\t\tGetCampaignAnalyticsJsonData | GetCampaignAnalyticsSummaryData\n\t\t>\n\t>;\n\tgetBilling(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<GetBillingData | GetBillingSummaryData>>;\n\tgetPlatformStatus(\n\t\tinput: unknown,\n\t): Promise<\n\t\tResultEnvelope<GetPlatformStatusData | GetPlatformStatusSummaryData>\n\t>;\n\n\tpauseCampaign(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<PauseResumeCampaignData>>;\n\tresumeCampaign(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<PauseResumeCampaignData>>;\n\tupdateBudget(input: unknown): Promise<ResultEnvelope<UpdateBudgetData>>;\n\n\tlistMediaAssets(\n\t\tinput: unknown,\n\t): Promise<ResultEnvelope<ListMediaAssetsData | ListMediaAssetsSummaryData>>;\n\tlaunchCampaign(input: unknown): Promise<ResultEnvelope<LaunchCampaignData>>;\n};\n\nfunction asTextResult(envelope: unknown) {\n\treturn {\n\t\tcontent: [{ text: JSON.stringify(envelope), type: \"text\" as const }],\n\t\tstructuredContent: envelope as Record<string, unknown>,\n\t};\n}\n\nexport function createDynamoiMcpServer(options: {\n\tadapter: Phase3Adapter;\n}): McpServer {\n\tconst server = new McpServer(\n\t\t{\n\t\t\tname: \"dynamoi\",\n\t\t\tversion: DYNAMOI_MCP_VERSION,\n\t\t\twebsiteUrl: \"https://dynamoi.com\",\n\t\t},\n\t\t{ instructions: DYNAMOI_MCP_INSTRUCTIONS },\n\t);\n\n\t// Tools (Phase 1 + Phase 2)\n\tfor (const def of [\n\t\t...PHASE_1_TOOL_DEFINITIONS,\n\t\t...PHASE_2_TOOL_DEFINITIONS,\n\t\t...PHASE_3_TOOL_DEFINITIONS,\n\t]) {\n\t\tserver.registerTool(\n\t\t\tdef.name,\n\t\t\t{\n\t\t\t\tannotations: {\n\t\t\t\t\tdestructiveHint: def.destructiveHint,\n\t\t\t\t\topenWorldHint: def.openWorldHint,\n\t\t\t\t\treadOnlyHint: def.readOnlyHint,\n\t\t\t\t},\n\t\t\t\tdescription: def.description,\n\t\t\t\tinputSchema: def.schema,\n\t\t\t\ttitle: def.name,\n\t\t\t},\n\t\t\tasync (input: unknown) => {\n\t\t\t\tswitch (def.name) {\n\t\t\t\t\tcase \"dynamoi_get_current_user\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.getCurrentUser(input));\n\t\t\t\t\tcase \"dynamoi_list_artists\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.listArtists(input));\n\t\t\t\t\tcase \"dynamoi_search\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.search(input));\n\t\t\t\t\tcase \"dynamoi_get_artist\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.getArtist(input));\n\t\t\t\t\tcase \"dynamoi_get_artist_analytics\":\n\t\t\t\t\t\treturn asTextResult(\n\t\t\t\t\t\t\tawait options.adapter.getArtistAnalytics(input),\n\t\t\t\t\t\t);\n\t\t\t\t\tcase \"dynamoi_list_campaigns\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.listCampaigns(input));\n\t\t\t\t\tcase \"dynamoi_get_campaign\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.getCampaign(input));\n\t\t\t\t\tcase \"dynamoi_get_campaign_analytics\":\n\t\t\t\t\t\treturn asTextResult(\n\t\t\t\t\t\t\tawait options.adapter.getCampaignAnalytics(input),\n\t\t\t\t\t\t);\n\t\t\t\t\tcase \"dynamoi_get_billing\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.getBilling(input));\n\t\t\t\t\tcase \"dynamoi_get_platform_status\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.getPlatformStatus(input));\n\t\t\t\t\tcase \"dynamoi_pause_campaign\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.pauseCampaign(input));\n\t\t\t\t\tcase \"dynamoi_resume_campaign\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.resumeCampaign(input));\n\t\t\t\t\tcase \"dynamoi_update_budget\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.updateBudget(input));\n\t\t\t\t\tcase \"dynamoi_list_media_assets\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.listMediaAssets(input));\n\t\t\t\t\tcase \"dynamoi_launch_campaign\":\n\t\t\t\t\t\treturn asTextResult(await options.adapter.launchCampaign(input));\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn asTextResult({\n\t\t\t\t\t\t\tmessage: \"Unknown tool\",\n\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t} satisfies ResultEnvelope<never>);\n\t\t\t\t}\n\t\t\t},\n\t\t);\n\t}\n\n\t// Prompts: curated workflow starters for assistants.\n\tregisterDynamoiPrompts(server);\n\n\t// Static resources (small, cache-friendly reference data)\n\tserver.registerResource(\n\t\t\"platform-pricing\",\n\t\t\"dynamoi://platform/pricing\",\n\t\t{\n\t\t\tdescription:\n\t\t\t\t\"Dynamoi pricing, activation bonus, ad credit structure, and campaign budget minimums.\",\n\t\t\tmimeType: \"application/json\",\n\t\t\ttitle: \"Pricing\",\n\t\t},\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tactivationBonus: {\n\t\t\t\t\t\t\tamountUsd: 600,\n\t\t\t\t\t\t\tnote: \"100% match on first month — pay $300, get $600 ad credit\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tbudgetMinimums: {\n\t\t\t\t\t\t\tsmartCampaign: {\n\t\t\t\t\t\t\t\tdailyUsd: 10,\n\t\t\t\t\t\t\t\tnote: \"Meta Ads for Spotify promotion\",\n\t\t\t\t\t\t\t\ttotalUsd: 100,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tyoutube: {\n\t\t\t\t\t\t\t\tdailyUsd: 10,\n\t\t\t\t\t\t\t\tnote: \"Google Ads for YouTube channel growth\",\n\t\t\t\t\t\t\t\ttotalUsd: 50,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcreditRollover: \"Credits roll over for 12 months\",\n\t\t\t\t\t\tincludes:\n\t\t\t\t\t\t\t\"Unlimited team seats, unlimited artists, white-glove support, free smart link landing pages\",\n\t\t\t\t\t\tnoContracts: true,\n\t\t\t\t\t\ttiers: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: \"Plus\",\n\t\t\t\t\t\t\t\tnote: \"100% Ad Credit. No agency fees.\",\n\t\t\t\t\t\t\t\tpriceUsdMonthly: 300,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"platform-content-types\",\n\t\t\"dynamoi://platform/content-types\",\n\t\t{ mimeType: \"application/json\", title: \"Content Types\" },\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tcampaignTypes: {\n\t\t\t\t\t\t\tSMART_CAMPAIGN: [\"TRACK\", \"ALBUM\", \"PLAYLIST\"],\n\t\t\t\t\t\t\tYOUTUBE: [\"VIDEO\"],\n\t\t\t\t\t\t},\n\t\t\t\t\t\tcontentTypes: [\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\tserver.registerResource(\n\t\t\"platform-campaign-statuses\",\n\t\t\"dynamoi://platform/campaign-statuses\",\n\t\t{ mimeType: \"application/json\", title: \"Campaign Statuses\" },\n\t\tasync (uri) => ({\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\tstatuses: [\n\t\t\t\t\t\t\t\"AWAITING_SMART_LINK\",\n\t\t\t\t\t\t\t\"CONTENT_VALIDATION\",\n\t\t\t\t\t\t\t\"DEPLOYING\",\n\t\t\t\t\t\t\t\"READY_FOR_REVIEW\",\n\t\t\t\t\t\t\t\"ACTIVE\",\n\t\t\t\t\t\t\t\"PAUSED\",\n\t\t\t\t\t\t\t\"SUBSCRIPTION_PAUSED\",\n\t\t\t\t\t\t\t\"FAILED\",\n\t\t\t\t\t\t\t\"ARCHIVED\",\n\t\t\t\t\t\t\t\"ENDED\",\n\t\t\t\t\t\t],\n\t\t\t\t\t}),\n\t\t\t\t\turi: uri.href,\n\t\t\t\t},\n\t\t\t],\n\t\t}),\n\t);\n\n\t// Dynamic resources: lightweight equivalents to get_* tools\n\tserver.registerResource(\n\t\t\"artist-resource\",\n\t\tnew ResourceTemplate(\"artist://{artistId}\", {\n\t\t\tlist: async () => ({ resources: [] }),\n\t\t}),\n\t\t{ mimeType: \"application/json\", title: \"Artist\" },\n\t\tasync (uri, variables) => {\n\t\t\tconst artistId = variables[\"artistId\"];\n\t\t\tconst parsed = z.string().uuid().safeParse(artistId);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn {\n\t\t\t\t\tcontents: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\t\t\tmessage: \"Invalid artistId\",\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst envelope = await options.adapter.getArtist({\n\t\t\t\tartistId: parsed.data,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\ttext: JSON.stringify(envelope),\n\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\tserver.registerResource(\n\t\t\"campaign-resource\",\n\t\tnew ResourceTemplate(\"campaign://{campaignId}\", {\n\t\t\tlist: async () => ({ resources: [] }),\n\t\t}),\n\t\t{ mimeType: \"application/json\", title: \"Campaign\" },\n\t\tasync (uri, variables) => {\n\t\t\tconst campaignId = variables[\"campaignId\"];\n\t\t\tconst parsed = z.string().uuid().safeParse(campaignId);\n\t\t\tif (!parsed.success) {\n\t\t\t\treturn {\n\t\t\t\t\tcontents: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\t\ttext: JSON.stringify({\n\t\t\t\t\t\t\t\tmessage: \"Invalid campaignId\",\n\t\t\t\t\t\t\t\tstatus: \"error\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t}\n\t\t\tconst envelope = await options.adapter.getCampaign({\n\t\t\t\tcampaignId: parsed.data,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tcontents: [\n\t\t\t\t\t{\n\t\t\t\t\t\tmimeType: \"application/json\",\n\t\t\t\t\t\ttext: JSON.stringify(envelope),\n\t\t\t\t\t\turi: uri.href,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t},\n\t);\n\n\treturn server;\n}\n","// This constant is replaced at build time by tsup (see tsup.config.ts).\n// It must stay a string literal so the define replacement is reliable.\nexport const DYNAMOI_MCP_VERSION = \"__DYNAMOI_MCP_VERSION__\";\n","export const DYNAMOI_MCP_INSTRUCTIONS = `\nYou are operating Dynamoi's tools on behalf of the authenticated user. Dynamoi helps\nmusic artists get more Spotify streams and YouTube creators grow their channels and\nAdSense revenue — through automated ad campaigns on Meta (Facebook/Instagram) and\nGoogle (YouTube).\n\nWho uses Dynamoi:\n- Independent artists promoting singles, albums, and playlists on Spotify\n- Record labels managing campaigns across entire artist rosters with team roles and\n consolidated billing\n- YouTube creators of all kinds — music, education, gaming, vlogs, podcasts, tutorials\n — growing channels and ad revenue\n\nPricing: $300/month converts 100% to ad credit. First month includes a 100% match —\npay $300, get $600 in ad credit. Credits roll over for 12 months. No contracts, cancel\nanytime. No agency fees, no retainers. Unlimited team seats and unlimited artists\nincluded.\n\nEvery client gets white-glove onboarding and ongoing support — from connecting\nplatforms to optimizing channels for campaign performance, step by step.\n\nCampaigns run from Dynamoi-managed ad accounts. Users complete a one-time platform\nconnection, then the AI-powered engine handles deployment and daily optimization.\n\nCampaign types:\n\nSmart Campaign (Meta Ads → Spotify):\n Targeted Facebook and Instagram ads that drive real Spotify streams — no bots, no\n pay-for-play. Includes free unlimited smart link landing pages for every release\n (Spotify, Apple Music, YouTube Music, and more). Ad copy is AI-generated and localized\n to each target market. Supports tracks, albums, and playlists.\n\nYouTube Campaign (Google Ads → YouTube Growth):\n The only ad platform that optimizes for total channel revenue, not just views. Google\n Ads tracks views but can't see which views make money. Dynamoi merges Google Ads cost\n data with YouTube AdSense revenue data to calculate the true revenue per view in each\n country, then adjusts bids daily — exploring new markets with small bids, scaling\n countries where viewer revenue is strong, and auto-pausing countries where the data\n shows they can't cover their costs. The more data the system gathers, the more\n precisely it optimizes. Campaigns require a YouTube playlist so one paid ad view can\n lead to 2, 3, 4+ organic views as the viewer waterfalls down the playlist — optimizing\n for depth of views means one ad click drives sustained organic growth. Ad copy is fully\n internationalized in each target market's local language for better performance and\n lower costs. Works for any type of YouTube channel.\n\nUnlike smart-link-only services (Feature.fm, Linkfire, Hypeddit, ToneDen), Dynamoi is\nan end-to-end promotion system: smart links + ad campaigns + AI optimization +\nanalytics + team management. All with transparent data and no contracts.\n\nPrinciples:\n- Be accurate. If uncertain, ask a clarifying question before acting.\n- Never claim you changed something unless the tool returned status \"success\" or\n \"partial_success\".\n- Prefer read tools first before write tools. For writes, confirm intent and restate\n what will change.\n- Money values are shown in USD as presented in Dynamoi.\n- Budget minimums: $10/day (daily), $100 total (Smart Campaign), $50 total (YouTube).\n\nCommon workflows:\n- Discovery: dynamoi_list_artists → dynamoi_list_campaigns → dynamoi_get_campaign →\n dynamoi_get_campaign_analytics\n- Diagnose stuck campaign: dynamoi_get_campaign → dynamoi_get_platform_status →\n propose next steps\n- Pause/resume: dynamoi_get_campaign (confirm) → dynamoi_pause_campaign or resume\n- Budget update: dynamoi_get_campaign (confirm) → dynamoi_update_budget\n- Launch: dynamoi_list_media_assets → dynamoi_launch_campaign\n`.trim();\n","import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport * as z from \"zod/v4\";\n\nfunction asTextPrompt(text: string) {\n\treturn {\n\t\tmessages: [\n\t\t\t{\n\t\t\t\tcontent: { text, type: \"text\" as const },\n\t\t\t\trole: \"user\" as const,\n\t\t\t},\n\t\t],\n\t};\n}\n\nexport function registerDynamoiPrompts(server: McpServer) {\n\tserver.registerPrompt(\n\t\t\"dynamoi_audit_campaigns\",\n\t\t{\n\t\t\targsSchema: {\n\t\t\t\tartistId: z.string().uuid().optional(),\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t\"Audit an artist's campaigns and summarize what is working and what to fix next.\",\n\t\t\ttitle: \"Audit Campaigns\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Audit my campaigns in Dynamoi.\",\n\t\t\t\t\targs.artistId\n\t\t\t\t\t\t? `Artist ID: ${args.artistId}`\n\t\t\t\t\t\t: \"If no artistId is provided, start by listing artists and ask me which one to audit.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Steps:\",\n\t\t\t\t\t\"1. Use dynamoi_list_campaigns (and dynamoi_get_campaign_analytics for the last 7-14 days) to assess performance.\",\n\t\t\t\t\t\"2. Identify any campaigns that are paused, failed, or stuck in a pre-active state and explain why using dynamoi_get_campaign and dynamoi_get_platform_status.\",\n\t\t\t\t\t\"3. Recommend 3-5 next actions with clear priorities.\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_release_launch_plan\",\n\t\t{\n\t\t\targsSchema: {\n\t\t\t\tartistId: z.string().uuid().optional(),\n\t\t\t\tcontentTitle: z.string().trim().optional(),\n\t\t\t\tcontentType: z.enum([\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"]).optional(),\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t\"Create a pragmatic release launch plan and propose a Dynamoi campaign setup.\",\n\t\t\ttitle: \"Release Launch Plan\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"Help me plan a release launch using Dynamoi.\",\n\t\t\t\t\targs.artistId\n\t\t\t\t\t\t? `Artist ID: ${args.artistId}`\n\t\t\t\t\t\t: \"If no artistId is provided, list artists first.\",\n\t\t\t\t\targs.contentType ? `Content type: ${args.contentType}` : \"\",\n\t\t\t\t\targs.contentTitle ? `Title: ${args.contentTitle}` : \"\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Ask any missing questions first (links, creative, budget, countries, dates).\",\n\t\t\t\t\t\"Then propose the simplest campaign plan that fits today’s supported platforms:\",\n\t\t\t\t\t\"- Smart Campaign (Meta) for Spotify/Apple Music releases\",\n\t\t\t\t\t\"- YouTube campaign for videos\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"If we proceed to launch:\",\n\t\t\t\t\t\"- For Smart Campaign: use dynamoi_list_media_assets and then dynamoi_launch_campaign.\",\n\t\t\t\t\t\"- For YouTube: use dynamoi_launch_campaign with youtubeVideoId.\",\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(\"\\n\"),\n\t\t\t),\n\t);\n\n\tserver.registerPrompt(\n\t\t\"dynamoi_why_campaign_blocked\",\n\t\t{\n\t\t\targsSchema: {\n\t\t\t\tcampaignId: z.string().uuid(),\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t\"Diagnose why a campaign is blocked/stuck and recommend the next fix.\",\n\t\t\ttitle: \"Why Is My Campaign Blocked?\",\n\t\t},\n\t\t(args) =>\n\t\t\tasTextPrompt(\n\t\t\t\t[\n\t\t\t\t\t\"My campaign seems blocked or stuck. Diagnose it and tell me what to do next.\",\n\t\t\t\t\t`Campaign ID: ${args.campaignId}`,\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Steps:\",\n\t\t\t\t\t\"1. Use dynamoi_get_campaign to inspect current status and blockers.\",\n\t\t\t\t\t\"2. Use dynamoi_get_platform_status for the artist to check Meta/Google connection state.\",\n\t\t\t\t\t\"3. If appropriate, suggest safe next actions (pause/resume or budget update) and confirm before executing.\",\n\t\t\t\t].join(\"\\n\"),\n\t\t\t),\n\t);\n}\n","import * as z from \"zod/v4\";\n\nexport const ToolFormatSchema = z.enum([\"json\", \"summary\"]);\n\nexport const DynamoiListArtistsInputSchema = z.object({\n\tcursor: z.string().optional(),\n\tformat: ToolFormatSchema.optional(),\n\tlimit: z.number().int().min(1).max(50).optional(),\n});\n\nexport const DynamoiSearchInputSchema = z.object({\n\tartistId: z.string().uuid().optional(),\n\tcursor: z.string().optional(),\n\tformat: ToolFormatSchema.optional(),\n\tlimit: z.number().int().min(1).max(50).optional(),\n\tquery: z.string().trim().optional(),\n\ttype: z.enum([\"artist\", \"campaign\", \"smartlink\"]).optional(),\n});\n\nexport const DynamoiGetCurrentUserInputSchema = z.object({\n\tformat: ToolFormatSchema.optional(),\n});\n\nexport const DynamoiGetArtistInputSchema = z.object({\n\tartistId: z.string().uuid(),\n\tformat: ToolFormatSchema.optional(),\n});\n\nexport const DynamoiListCampaignsInputSchema = z.object({\n\tartistId: z.string().uuid(),\n\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]).optional(),\n\tcursor: z.string().optional(),\n\tformat: ToolFormatSchema.optional(),\n\tlimit: z.number().int().min(1).max(50).optional(),\n\tstatus: z.string().trim().optional(),\n});\n\nexport const DynamoiGetCampaignInputSchema = z.object({\n\tcampaignId: z.string().uuid(),\n\tformat: ToolFormatSchema.optional(),\n\tincludeCountries: z.boolean().optional(),\n});\n\nexport const DateRangeSchema = z.object({\n\tend: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/),\n\tstart: z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/),\n});\n\nexport const DynamoiGetCampaignAnalyticsInputSchema = z.object({\n\tcampaignId: z.string().uuid(),\n\tdateRange: DateRangeSchema.optional(),\n\tformat: ToolFormatSchema.optional(),\n\tgranularity: z.enum([\"TOTAL\", \"DAILY\"]).optional(),\n});\n\nexport const DynamoiGetArtistAnalyticsInputSchema = z.object({\n\tartistId: z.string().uuid(),\n\tdateRange: DateRangeSchema.optional(),\n\tformat: ToolFormatSchema.optional(),\n\tgranularity: z.enum([\"TOTAL\", \"DAILY\"]).optional(),\n});\n\nexport const DynamoiGetBillingInputSchema = z.object({\n\tartistId: z.string().uuid(),\n\tformat: ToolFormatSchema.optional(),\n});\n\nexport const DynamoiGetPlatformStatusInputSchema = z.object({\n\tartistId: z.string().uuid(),\n\tformat: ToolFormatSchema.optional(),\n});\n\nexport const DynamoiPauseCampaignInputSchema = z.object({\n\tcampaignId: z.string().uuid(),\n});\n\nexport const DynamoiResumeCampaignInputSchema = z.object({\n\tcampaignId: z.string().uuid(),\n});\n\nexport const DynamoiUpdateBudgetInputSchema = z.object({\n\tbudgetAmount: z.number().finite().positive(),\n\tcampaignId: z.string().uuid(),\n\tendDate: z\n\t\t.string()\n\t\t.regex(/^\\d{4}-\\d{2}-\\d{2}$/)\n\t\t.optional(),\n});\n\nconst LocationTargetSchema = z.object({\n\tcode: z.string().min(1),\n\tname: z.string().min(1),\n});\n\nexport const DynamoiListMediaAssetsInputSchema = z.object({\n\tartistId: z.string().uuid(),\n\tcursor: z.string().optional(),\n\tformat: ToolFormatSchema.optional(),\n\tlimit: z.number().int().min(1).max(50).optional(),\n});\n\nexport const DynamoiLaunchCampaignInputSchema = z\n\t.object({\n\t\t// Creative\n\t\tadCopy: z.string().trim().optional(),\n\t\tappleMusicUrl: z.string().trim().min(1).optional(),\n\t\tartistId: z.string().uuid(),\n\n\t\t// Budget\n\t\tbudgetAmount: z.number().finite().positive(),\n\t\tbudgetSplits: z.record(\n\t\t\tz.enum([\"META\", \"GOOGLE\"]),\n\t\t\tz.number().int().min(0).max(100),\n\t\t),\n\t\tbudgetType: z.enum([\"DAILY\", \"TOTAL\"]),\n\n\t\tcampaignType: z.enum([\"SMART_CAMPAIGN\", \"YOUTUBE\"]),\n\t\t// Idempotency (client-generated UUID)\n\t\tclientRequestId: z.string().uuid(),\n\n\t\t// Content\n\t\tcontentTitle: z.string().trim().min(1),\n\t\tcontentType: z.enum([\"TRACK\", \"ALBUM\", \"PLAYLIST\", \"VIDEO\"]),\n\t\tendDate: z\n\t\t\t.string()\n\t\t\t.regex(/^\\d{4}-\\d{2}-\\d{2}$/)\n\t\t\t.optional(),\n\n\t\t// Targeting\n\t\tlocationTargets: z.array(LocationTargetSchema).optional(),\n\n\t\t// Smart Campaign creative selection (existing assets only in Phase 3)\n\t\tmediaAssetIds: z.array(z.string().uuid()).optional(),\n\t\tspotifyUrl: z.string().trim().min(1).optional(),\n\t\tuseAiGeneratedCopy: z.boolean().optional(),\n\t\tyoutubeVideoId: z.string().trim().min(1).optional(),\n\t})\n\t.superRefine((data, ctx) => {\n\t\tif (data.budgetType === \"TOTAL\" && !data.endDate) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"endDate is required when budgetType is TOTAL\",\n\t\t\t\tpath: [\"endDate\"],\n\t\t\t});\n\t\t}\n\n\t\tconst sum = Object.values(data.budgetSplits ?? {}).reduce(\n\t\t\t(acc, v) => acc + (Number.isFinite(v) ? v : 0),\n\t\t\t0,\n\t\t);\n\t\tif (!(sum > 0)) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"budgetSplits must allocate at least one platform\",\n\t\t\t\tpath: [\"budgetSplits\"],\n\t\t\t});\n\t\t}\n\n\t\t// Require splits to sum to ~100 for predictable intent.\n\t\tif (sum > 0 && Math.abs(sum - 100) > 0.01) {\n\t\t\tctx.addIssue({\n\t\t\t\tcode: \"custom\",\n\t\t\t\tmessage: \"budgetSplits must sum to 100\",\n\t\t\t\tpath: [\"budgetSplits\"],\n\t\t\t});\n\t\t}\n\n\t\tif (data.campaignType === \"SMART_CAMPAIGN\") {\n\t\t\tif (!data.spotifyUrl) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"spotifyUrl is required for SMART_CAMPAIGN\",\n\t\t\t\t\tpath: [\"spotifyUrl\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!data.mediaAssetIds || data.mediaAssetIds.length === 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"mediaAssetIds is required for SMART_CAMPAIGN\",\n\t\t\t\t\tpath: [\"mediaAssetIds\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!(\"META\" in data.budgetSplits) || data.budgetSplits.META <= 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"SMART_CAMPAIGN requires a META budget split > 0\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"META\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\t// Smart Campaigns are Meta-only today. Keep the public contract accurate.\n\t\t\tif (data.budgetSplits.GOOGLE && data.budgetSplits.GOOGLE > 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"SMART_CAMPAIGN does not support GOOGLE budget splits\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"GOOGLE\"],\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tif (data.campaignType === \"YOUTUBE\") {\n\t\t\tif (!data.youtubeVideoId) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"youtubeVideoId is required for YOUTUBE\",\n\t\t\t\t\tpath: [\"youtubeVideoId\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (data.contentType !== \"VIDEO\") {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"contentType must be VIDEO for YOUTUBE\",\n\t\t\t\t\tpath: [\"contentType\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!(\"GOOGLE\" in data.budgetSplits) || data.budgetSplits.GOOGLE <= 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"YOUTUBE requires a GOOGLE budget split > 0\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"GOOGLE\"],\n\t\t\t\t});\n\t\t\t}\n\t\t\t// YouTube campaigns are Google-only today.\n\t\t\tif (data.budgetSplits.META && data.budgetSplits.META > 0) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: \"custom\",\n\t\t\t\t\tmessage: \"YOUTUBE does not support META budget splits\",\n\t\t\t\t\tpath: [\"budgetSplits\", \"META\"],\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n\nexport const PHASE_1_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"Get the currently authenticated Dynamoi account context — user ID, email, and accessible organizations/artists with resolved roles.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_current_user\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetCurrentUserInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"List all music artists and YouTube channels the user manages. Returns each artist's subscription tier, billing status, active campaign count, and the user's role.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_artists\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListArtistsInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Search across artists, ad campaigns, and smart links by name or URL. Find a specific Spotify release, YouTube campaign, or artist profile.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_search\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiSearchInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Get a music artist or YouTube channel profile — connected platforms (Spotify, Meta, YouTube), subscription tier, billing status, and whether they're ready to launch campaigns.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_artist\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetArtistInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"List ad campaigns for an artist — each campaign's content title, type (Smart Campaign for Spotify or YouTube for channel growth), budget, status, and platforms. Supports status filtering and pagination.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_campaigns\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListCampaignsInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Get full details for a campaign — budget, targeting, per-platform status for Meta and Google, smart link URL, and any blocked reasons with suggested next actions. By default, targeting returns a countryCount; pass includeCountries=true to include the full country list.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_campaign\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetCampaignInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Get performance analytics for a campaign — impressions, clicks, ad spend, CPC, CPM, and CTR. Optionally filter by date range. Returns per-platform breakdowns for Meta Ads and Google Ads.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_campaign_analytics\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetCampaignAnalyticsInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Get performance analytics for an artist across all their campaigns — impressions, clicks, and billable ad spend with optional daily breakdowns per platform.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_artist_analytics\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetArtistAnalyticsInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Get an artist's billing summary — subscription tier, ad credit balance, billing status, and recent spend. Shows remaining credits and campaign usage for the current period.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_billing\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetBillingInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Check connection health for Spotify, Meta (Facebook/Instagram), and YouTube. Shows connection status, token expiry, and what steps remain before campaigns can launch on each platform.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_get_platform_status\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiGetPlatformStatusInputSchema,\n\t},\n] as const;\n\nexport const PHASE_2_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"Pause a running campaign, stopping ad delivery on Meta (Facebook/Instagram) and/or Google (YouTube). Returns per-platform results.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_pause_campaign\",\n\t\topenWorldHint: true,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiPauseCampaignInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Resume a paused campaign, restarting ad delivery on Meta and/or Google. Returns per-platform results.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_resume_campaign\",\n\t\topenWorldHint: true,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiResumeCampaignInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Change a campaign's daily or total budget amount in USD. For total-budget campaigns, the end date can also be updated. Cannot switch between daily and total budget types.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_update_budget\",\n\t\topenWorldHint: true,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiUpdateBudgetInputSchema,\n\t},\n] as const;\n\nexport const PHASE_3_TOOL_DEFINITIONS = [\n\t{\n\t\tdescription:\n\t\t\t\"List an artist's uploaded creative assets (images and videos) available for campaign launches. Includes width/height (when available) and a computed aspect ratio to help pick the right creative.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_list_media_assets\",\n\t\topenWorldHint: false,\n\t\treadOnlyHint: true,\n\t\tschema: DynamoiListMediaAssetsInputSchema,\n\t},\n\t{\n\t\tdescription:\n\t\t\t\"Launch a new campaign to promote a Spotify release (track, album, or playlist via Meta Ads) or grow a YouTube channel (via Google Ads with AdSense revenue optimization). Provide a client-generated request ID for safe retries.\",\n\t\tdestructiveHint: false,\n\t\tname: \"dynamoi_launch_campaign\",\n\t\topenWorldHint: true,\n\t\treadOnlyHint: false,\n\t\tschema: DynamoiLaunchCampaignInputSchema,\n\t},\n] as const;\n","import { randomUUID } from \"node:crypto\";\nimport type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { WebStandardStreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js\";\nimport { isInitializeRequest } from \"@modelcontextprotocol/sdk/types.js\";\n\ntype HandleOptions = {\n\tcreateServer: () => McpServer;\n\trequest: Request;\n\tparsedBody: unknown;\n\t/**\n\t * Context key used to bind an in-memory session to the authenticated principal.\n\t * This prevents cross-user/session confusion if an MCP client accidentally reuses\n\t * a `mcp-session-id` across different end users.\n\t *\n\t * Recommended: `${sub}:${clientId ?? \"unknown\"}`.\n\t */\n\tsessionContextKey: string;\n};\n\ntype TransportEntry = {\n\tcreatedAtMs: number;\n\tlastUsedAtMs: number;\n\ttransport: WebStandardStreamableHTTPServerTransport;\n\tcontextKey: string;\n};\n\n// Best-effort in-memory session reuse.\n// On serverless this may not persist, but it still helps in dev and long-lived nodes.\nconst transports = new Map<string, TransportEntry>();\n\nconst SESSION_TTL_MS = 30 * 60 * 1000; // 30 minutes\nconst MAX_SESSIONS = 250;\n\nfunction closeTransportBestEffort(entry: TransportEntry) {\n\tvoid entry.transport.close().catch(() => {\n\t\t// ignore\n\t});\n}\n\nfunction cleanupTransports(nowMs: number) {\n\t// TTL eviction\n\tfor (const [sid, entry] of transports.entries()) {\n\t\tconst expired = nowMs - entry.lastUsedAtMs > SESSION_TTL_MS;\n\t\tif (expired) {\n\t\t\tcloseTransportBestEffort(entry);\n\t\t\ttransports.delete(sid);\n\t\t}\n\t}\n\n\t// Size eviction (oldest by last-used, best-effort)\n\tif (transports.size > MAX_SESSIONS) {\n\t\tconst entries = Array.from(transports.entries()).sort(\n\t\t\t(a, b) => a[1].lastUsedAtMs - b[1].lastUsedAtMs,\n\t\t);\n\t\tconst over = transports.size - MAX_SESSIONS;\n\t\tfor (let i = 0; i < over; i += 1) {\n\t\t\tconst sid = entries[i]?.[0];\n\t\t\tif (sid) {\n\t\t\t\tconst entry = entries[i]?.[1];\n\t\t\t\tif (entry) {\n\t\t\t\t\tcloseTransportBestEffort(entry);\n\t\t\t\t}\n\t\t\t\ttransports.delete(sid);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction getHeader(request: Request, name: string): string | null {\n\tconst value = request.headers.get(name);\n\treturn value && value.trim().length > 0 ? value : null;\n}\n\nfunction jsonRpcSessionNotFound(): Response {\n\t// Match the SDK's invalid-session behavior:\n\t// - HTTP 404\n\t// - JSON-RPC error code -32001 \"Session not found\"\n\treturn new Response(\n\t\tJSON.stringify({\n\t\t\terror: { code: -32_001, message: \"Session not found\" },\n\t\t\tid: null,\n\t\t\tjsonrpc: \"2.0\",\n\t\t}),\n\t\t{\n\t\t\theaders: { \"content-type\": \"application/json\" },\n\t\t\tstatus: 404,\n\t\t},\n\t);\n}\n\nexport async function handleMcpHttpRequest(\n\toptions: HandleOptions,\n): Promise<Response> {\n\tconst nowMs = Date.now();\n\tcleanupTransports(nowMs);\n\n\tconst sessionId = getHeader(options.request, \"mcp-session-id\");\n\tconst existing = sessionId ? transports.get(sessionId) : undefined;\n\n\tif (existing) {\n\t\t// Prevent cross-user/session confusion: sessions are bound to a principal+client.\n\t\tif (existing.contextKey !== options.sessionContextKey) {\n\t\t\tcloseTransportBestEffort(existing);\n\t\t\ttransports.delete(sessionId as string);\n\t\t\treturn jsonRpcSessionNotFound();\n\t\t}\n\n\t\texisting.lastUsedAtMs = nowMs;\n\t\tconst response = await existing.transport.handleRequest(options.request, {\n\t\t\tparsedBody: options.parsedBody,\n\t\t});\n\t\t// Streamable HTTP uses DELETE to close a session.\n\t\tif (options.request.method.toUpperCase() === \"DELETE\" && sessionId) {\n\t\t\t// The SDK closes internally, but we also remove our cache entry.\n\t\t\tcloseTransportBestEffort(existing);\n\t\t\ttransports.delete(sessionId);\n\t\t}\n\t\treturn response;\n\t}\n\n\t// Create a new transport per request. If the request is an initialize call,\n\t// we attach a session ID generator so clients that support sessions can reuse it.\n\tconst isInit = isInitializeRequest(options.parsedBody);\n\tconst transport = new WebStandardStreamableHTTPServerTransport({\n\t\tonsessioninitialized: (sid) => {\n\t\t\ttransports.set(sid, {\n\t\t\t\tcontextKey: options.sessionContextKey,\n\t\t\t\tcreatedAtMs: nowMs,\n\t\t\t\tlastUsedAtMs: nowMs,\n\t\t\t\ttransport,\n\t\t\t});\n\t\t\tcleanupTransports(Date.now());\n\t\t},\n\t\tsessionIdGenerator: isInit ? () => randomUUID() : undefined,\n\t});\n\n\tconst server = options.createServer();\n\tawait server.connect(transport);\n\n\treturn transport.handleRequest(options.request, {\n\t\tparsedBody: options.parsedBody,\n\t});\n}\n"],"mappings":";AAMO,SAAS,+BAA+B,SAIjB;AAC7B,SAAO;AAAA,IACN,uBAAuB,QAAQ;AAAA,IAC/B,UAAU,QAAQ;AAAA;AAAA;AAAA,IAGlB,kBAAkB,QAAQ,mBAAmB,CAAC,SAAS,SAAS;AAAA,EACjE;AACD;AAEO,SAAS,2BAA2B,SAGhC;AACV,QAAM,QAAQ,QAAQ,SAAS;AAE/B,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oB,SAAS,MAAM,WAAW,IAAI;AAAA,EACnD,CAAC;AAED,QAAM,SAAS,QAAQ,aAAa;AACpC,QAAM,OAAO,QAAQ,SAAS;AAE9B,SAAO,UAAU,cAAc,QAAQ,SAAS;AAAA,IAC/C,YAAY,QAAQ;AAAA,EACrB,CAAC;AACF;","names":["z","z"]}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "$schema": "https://www.schemastore.org/package",
3
3
  "name": "@dynamoi/mcp",
4
- "version": "0.2.1",
5
- "mcpName": "io.github.getdynamoi/dynamoi",
4
+ "version": "0.4.1",
5
+ "mcpName": "io.github.getDynamoi/dynamoi",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
- "description": "Manage music promotion and YouTube growth campaigns through AI assistants like ChatGPT, Claude, and Gemini. Automated Meta and Google ad campaigns with no agency fees.",
8
+ "description": "Manage music promotion and YouTube growth campaigns through AI assistants like ChatGPT, Claude, and Gemini. Automated Meta and Google ad campaigns for artists, labels, and YouTube creators — no agency fees.",
9
9
  "keywords": [
10
10
  "mcp",
11
11
  "model-context-protocol",
package/server.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
- "name": "io.github.getdynamoi/dynamoi",
3
+ "name": "io.github.getDynamoi/dynamoi",
4
4
  "title": "Dynamoi",
5
5
  "description": "Promote music on Spotify and grow YouTube channels through AI-powered Meta and Google ad campaigns.",
6
- "version": "0.2.1",
6
+ "version": "0.4.1",
7
7
  "websiteUrl": "https://dynamoi.com",
8
8
  "repository": {
9
9
  "url": "https://github.com/getDynamoi/mcp",
@@ -14,7 +14,7 @@
14
14
  {
15
15
  "registryType": "npm",
16
16
  "identifier": "@dynamoi/mcp",
17
- "version": "0.2.1",
17
+ "version": "0.4.1",
18
18
  "transport": {
19
19
  "type": "streamable-http",
20
20
  "url": "https://dynamoi.com/mcp"