create-mastra 0.0.0-separate-trace-data-from-component-20250501141108 → 0.0.0-taofeeqInngest-20250603090617

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/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { randomUUID } from 'node:crypto';
4
4
  import * as fs3__default from 'node:fs';
5
5
  import fs3__default__default, { existsSync, readFileSync, writeFileSync } from 'node:fs';
6
6
  import os from 'node:os';
7
- import path, { dirname } from 'node:path';
7
+ import path2, { dirname } from 'node:path';
8
8
  import { fileURLToPath } from 'node:url';
9
9
  import { PostHog } from 'posthog-node';
10
10
  import h, { stdin, stdout } from 'node:process';
@@ -17,13 +17,12 @@ import fs4 from 'node:fs/promises';
17
17
  import { execa } from 'execa';
18
18
  import fsExtra3, { readJSON, ensureFile, writeJSON } from 'fs-extra/esm';
19
19
  import prettier from 'prettier';
20
- import { Transform } from 'node:stream';
21
20
  import pino from 'pino';
22
21
  import pretty from 'pino-pretty';
23
22
  import fsExtra from 'fs-extra';
24
23
 
25
24
  var __filename = fileURLToPath(import.meta.url);
26
- var __dirname = path.dirname(__filename);
25
+ var __dirname = path2.dirname(__filename);
27
26
  var PosthogAnalytics = class {
28
27
  sessionId;
29
28
  client;
@@ -35,7 +34,7 @@ var PosthogAnalytics = class {
35
34
  host = "https://app.posthog.com"
36
35
  }) {
37
36
  this.version = version;
38
- const cliConfigPath = path.join(__dirname, "mastra-cli.json");
37
+ const cliConfigPath = path2.join(__dirname, "mastra-cli.json");
39
38
  if (existsSync(cliConfigPath)) {
40
39
  try {
41
40
  const { distinctId, sessionId } = JSON.parse(readFileSync(cliConfigPath, "utf-8"));
@@ -63,7 +62,7 @@ var PosthogAnalytics = class {
63
62
  }
64
63
  writeCliConfig({ distinctId, sessionId }) {
65
64
  try {
66
- writeFileSync(path.join(__dirname, "mastra-cli.json"), JSON.stringify({ distinctId, sessionId }));
65
+ writeFileSync(path2.join(__dirname, "mastra-cli.json"), JSON.stringify({ distinctId, sessionId }));
67
66
  } catch {
68
67
  }
69
68
  }
@@ -416,6 +415,283 @@ ${color2.gray($)} ${s}
416
415
  `);let m=0,w=0;p(),i=setInterval(()=>{const L=color2.magenta(s[m]),O=".".repeat(Math.floor(w)).slice(0,3);process.stdout.write(srcExports.cursor.move(-999,0)),process.stdout.write(srcExports.erase.down(1)),process.stdout.write(`${L} ${o}${O}`),m=m+1<s.length?m+1:0,w=w<s.length?w+.125:0;},n);},x=(g="",m=0)=>{o=g??o,r=false,clearInterval(i);const w=m===0?color2.green(M):m===1?color2.red(P):color2.red(V);process.stdout.write(srcExports.cursor.move(-999,0)),process.stdout.write(srcExports.erase.down(1)),process.stdout.write(`${w} ${o}
417
416
  `),S(),t();};return {start:f,stop:x,message:(g="")=>{o=g??o;}}};function ye(){const s=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(s,"g")}const ve=async(s,n)=>{const t={},i=Object.keys(s);for(const r of i){const o=s[r],c=await o({results:t})?.catch(l=>{throw l});if(typeof n?.onCancel=="function"&&lD(c)){t[r]="canceled",n.onCancel({results:t});continue}t[r]=c;}return t};
418
417
 
418
+ var shellQuote$1 = {};
419
+
420
+ var quote;
421
+ var hasRequiredQuote;
422
+
423
+ function requireQuote () {
424
+ if (hasRequiredQuote) return quote;
425
+ hasRequiredQuote = 1;
426
+
427
+ quote = function quote(xs) {
428
+ return xs.map(function (s) {
429
+ if (s === '') {
430
+ return '\'\'';
431
+ }
432
+ if (s && typeof s === 'object') {
433
+ return s.op.replace(/(.)/g, '\\$1');
434
+ }
435
+ if ((/["\s]/).test(s) && !(/'/).test(s)) {
436
+ return "'" + s.replace(/(['\\])/g, '\\$1') + "'";
437
+ }
438
+ if ((/["'\s]/).test(s)) {
439
+ return '"' + s.replace(/(["\\$`!])/g, '\\$1') + '"';
440
+ }
441
+ return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, '$1\\$2');
442
+ }).join(' ');
443
+ };
444
+ return quote;
445
+ }
446
+
447
+ var parse;
448
+ var hasRequiredParse;
449
+
450
+ function requireParse () {
451
+ if (hasRequiredParse) return parse;
452
+ hasRequiredParse = 1;
453
+
454
+ // '<(' is process substitution operator and
455
+ // can be parsed the same as control operator
456
+ var CONTROL = '(?:' + [
457
+ '\\|\\|',
458
+ '\\&\\&',
459
+ ';;',
460
+ '\\|\\&',
461
+ '\\<\\(',
462
+ '\\<\\<\\<',
463
+ '>>',
464
+ '>\\&',
465
+ '<\\&',
466
+ '[&;()|<>]'
467
+ ].join('|') + ')';
468
+ var controlRE = new RegExp('^' + CONTROL + '$');
469
+ var META = '|&;()<> \\t';
470
+ var SINGLE_QUOTE = '"((\\\\"|[^"])*?)"';
471
+ var DOUBLE_QUOTE = '\'((\\\\\'|[^\'])*?)\'';
472
+ var hash = /^#$/;
473
+
474
+ var SQ = "'";
475
+ var DQ = '"';
476
+ var DS = '$';
477
+
478
+ var TOKEN = '';
479
+ var mult = 0x100000000; // Math.pow(16, 8);
480
+ for (var i = 0; i < 4; i++) {
481
+ TOKEN += (mult * Math.random()).toString(16);
482
+ }
483
+ var startsWithToken = new RegExp('^' + TOKEN);
484
+
485
+ function matchAll(s, r) {
486
+ var origIndex = r.lastIndex;
487
+
488
+ var matches = [];
489
+ var matchObj;
490
+
491
+ while ((matchObj = r.exec(s))) {
492
+ matches.push(matchObj);
493
+ if (r.lastIndex === matchObj.index) {
494
+ r.lastIndex += 1;
495
+ }
496
+ }
497
+
498
+ r.lastIndex = origIndex;
499
+
500
+ return matches;
501
+ }
502
+
503
+ function getVar(env, pre, key) {
504
+ var r = typeof env === 'function' ? env(key) : env[key];
505
+ if (typeof r === 'undefined' && key != '') {
506
+ r = '';
507
+ } else if (typeof r === 'undefined') {
508
+ r = '$';
509
+ }
510
+
511
+ if (typeof r === 'object') {
512
+ return pre + TOKEN + JSON.stringify(r) + TOKEN;
513
+ }
514
+ return pre + r;
515
+ }
516
+
517
+ function parseInternal(string, env, opts) {
518
+ if (!opts) {
519
+ opts = {};
520
+ }
521
+ var BS = opts.escape || '\\';
522
+ var BAREWORD = '(\\' + BS + '[\'"' + META + ']|[^\\s\'"' + META + '])+';
523
+
524
+ var chunker = new RegExp([
525
+ '(' + CONTROL + ')', // control chars
526
+ '(' + BAREWORD + '|' + SINGLE_QUOTE + '|' + DOUBLE_QUOTE + ')+'
527
+ ].join('|'), 'g');
528
+
529
+ var matches = matchAll(string, chunker);
530
+
531
+ if (matches.length === 0) {
532
+ return [];
533
+ }
534
+ if (!env) {
535
+ env = {};
536
+ }
537
+
538
+ var commented = false;
539
+
540
+ return matches.map(function (match) {
541
+ var s = match[0];
542
+ if (!s || commented) {
543
+ return void 0;
544
+ }
545
+ if (controlRE.test(s)) {
546
+ return { op: s };
547
+ }
548
+
549
+ // Hand-written scanner/parser for Bash quoting rules:
550
+ //
551
+ // 1. inside single quotes, all characters are printed literally.
552
+ // 2. inside double quotes, all characters are printed literally
553
+ // except variables prefixed by '$' and backslashes followed by
554
+ // either a double quote or another backslash.
555
+ // 3. outside of any quotes, backslashes are treated as escape
556
+ // characters and not printed (unless they are themselves escaped)
557
+ // 4. quote context can switch mid-token if there is no whitespace
558
+ // between the two quote contexts (e.g. all'one'"token" parses as
559
+ // "allonetoken")
560
+ var quote = false;
561
+ var esc = false;
562
+ var out = '';
563
+ var isGlob = false;
564
+ var i;
565
+
566
+ function parseEnvVar() {
567
+ i += 1;
568
+ var varend;
569
+ var varname;
570
+ var char = s.charAt(i);
571
+
572
+ if (char === '{') {
573
+ i += 1;
574
+ if (s.charAt(i) === '}') {
575
+ throw new Error('Bad substitution: ' + s.slice(i - 2, i + 1));
576
+ }
577
+ varend = s.indexOf('}', i);
578
+ if (varend < 0) {
579
+ throw new Error('Bad substitution: ' + s.slice(i));
580
+ }
581
+ varname = s.slice(i, varend);
582
+ i = varend;
583
+ } else if ((/[*@#?$!_-]/).test(char)) {
584
+ varname = char;
585
+ i += 1;
586
+ } else {
587
+ var slicedFromI = s.slice(i);
588
+ varend = slicedFromI.match(/[^\w\d_]/);
589
+ if (!varend) {
590
+ varname = slicedFromI;
591
+ i = s.length;
592
+ } else {
593
+ varname = slicedFromI.slice(0, varend.index);
594
+ i += varend.index - 1;
595
+ }
596
+ }
597
+ return getVar(env, '', varname);
598
+ }
599
+
600
+ for (i = 0; i < s.length; i++) {
601
+ var c = s.charAt(i);
602
+ isGlob = isGlob || (!quote && (c === '*' || c === '?'));
603
+ if (esc) {
604
+ out += c;
605
+ esc = false;
606
+ } else if (quote) {
607
+ if (c === quote) {
608
+ quote = false;
609
+ } else if (quote == SQ) {
610
+ out += c;
611
+ } else { // Double quote
612
+ if (c === BS) {
613
+ i += 1;
614
+ c = s.charAt(i);
615
+ if (c === DQ || c === BS || c === DS) {
616
+ out += c;
617
+ } else {
618
+ out += BS + c;
619
+ }
620
+ } else if (c === DS) {
621
+ out += parseEnvVar();
622
+ } else {
623
+ out += c;
624
+ }
625
+ }
626
+ } else if (c === DQ || c === SQ) {
627
+ quote = c;
628
+ } else if (controlRE.test(c)) {
629
+ return { op: s };
630
+ } else if (hash.test(c)) {
631
+ commented = true;
632
+ var commentObj = { comment: string.slice(match.index + i + 1) };
633
+ if (out.length) {
634
+ return [out, commentObj];
635
+ }
636
+ return [commentObj];
637
+ } else if (c === BS) {
638
+ esc = true;
639
+ } else if (c === DS) {
640
+ out += parseEnvVar();
641
+ } else {
642
+ out += c;
643
+ }
644
+ }
645
+
646
+ if (isGlob) {
647
+ return { op: 'glob', pattern: out };
648
+ }
649
+
650
+ return out;
651
+ }).reduce(function (prev, arg) { // finalize parsed arguments
652
+ // TODO: replace this whole reduce with a concat
653
+ return typeof arg === 'undefined' ? prev : prev.concat(arg);
654
+ }, []);
655
+ }
656
+
657
+ parse = function parse(s, env, opts) {
658
+ var mapped = parseInternal(s, env, opts);
659
+ if (typeof env !== 'function') {
660
+ return mapped;
661
+ }
662
+ return mapped.reduce(function (acc, s) {
663
+ if (typeof s === 'object') {
664
+ return acc.concat(s);
665
+ }
666
+ var xs = s.split(RegExp('(' + TOKEN + '.*?' + TOKEN + ')', 'g'));
667
+ if (xs.length === 1) {
668
+ return acc.concat(xs[0]);
669
+ }
670
+ return acc.concat(xs.filter(Boolean).map(function (x) {
671
+ if (startsWithToken.test(x)) {
672
+ return JSON.parse(x.split(TOKEN)[1]);
673
+ }
674
+ return x;
675
+ }));
676
+ }, []);
677
+ };
678
+ return parse;
679
+ }
680
+
681
+ var hasRequiredShellQuote;
682
+
683
+ function requireShellQuote () {
684
+ if (hasRequiredShellQuote) return shellQuote$1;
685
+ hasRequiredShellQuote = 1;
686
+
687
+ shellQuote$1.quote = requireQuote();
688
+ shellQuote$1.parse = requireParse();
689
+ return shellQuote$1;
690
+ }
691
+
692
+ var shellQuoteExports = requireShellQuote();
693
+ var shellQuote = /*@__PURE__*/getDefaultExportFromCjs(shellQuoteExports);
694
+
419
695
  // eslint-disable-next-line no-warning-comments
420
696
  // TODO: Use a better method when it's added to Node.js (https://github.com/nodejs/node/pull/40240)
421
697
  // Lots of optionals here to support Deno.
@@ -789,46 +1065,65 @@ function yoctoSpinner(options) {
789
1065
  }
790
1066
 
791
1067
  var LogLevel = {
792
- INFO: "info"};
793
- var Logger = class {
794
- logger;
1068
+ INFO: "info",
1069
+ ERROR: "error"};
1070
+ var MastraLogger = class {
1071
+ name;
1072
+ level;
795
1073
  transports;
796
1074
  constructor(options = {}) {
797
- this.transports = options.transports || {};
798
- const transportsAry = Object.entries(this.transports);
1075
+ this.name = options.name || "Mastra";
1076
+ this.level = options.level || LogLevel.ERROR;
1077
+ this.transports = new Map(Object.entries(options.transports || {}));
1078
+ }
1079
+ getTransports() {
1080
+ return this.transports;
1081
+ }
1082
+ async getLogs(transportId) {
1083
+ if (!transportId || !this.transports.has(transportId)) {
1084
+ return [];
1085
+ }
1086
+ return this.transports.get(transportId).getLogs() ?? [];
1087
+ }
1088
+ async getLogsByRunId({ transportId, runId }) {
1089
+ if (!transportId || !this.transports.has(transportId) || !runId) {
1090
+ return [];
1091
+ }
1092
+ return this.transports.get(transportId).getLogsByRunId({ runId }) ?? [];
1093
+ }
1094
+ };
1095
+
1096
+ var PinoLogger = class extends MastraLogger {
1097
+ logger;
1098
+ constructor(options = {}) {
1099
+ super(options);
1100
+ let prettyStream = void 0;
1101
+ if (!options.overrideDefaultTransports) {
1102
+ prettyStream = pretty({
1103
+ colorize: true,
1104
+ levelFirst: true,
1105
+ ignore: "pid,hostname",
1106
+ colorizeObjects: true,
1107
+ translateTime: "SYS:standard",
1108
+ singleLine: false
1109
+ });
1110
+ }
1111
+ const transportsAry = [...this.getTransports().entries()];
799
1112
  this.logger = pino(
800
1113
  {
801
1114
  name: options.name || "app",
802
1115
  level: options.level || LogLevel.INFO,
803
1116
  formatters: {
804
- level: (label) => {
805
- return {
806
- level: label
807
- };
808
- }
1117
+ level: (label) => ({ level: label })
809
1118
  }
810
1119
  },
811
- options.overrideDefaultTransports ? options?.transports?.default : transportsAry.length === 0 ? pretty({
812
- colorize: true,
813
- levelFirst: true,
814
- ignore: "pid,hostname",
815
- colorizeObjects: true,
816
- translateTime: "SYS:standard",
817
- singleLine: false
818
- }) : pino.multistream([
1120
+ options.overrideDefaultTransports ? options?.transports?.default : transportsAry.length === 0 ? prettyStream : pino.multistream([
819
1121
  ...transportsAry.map(([, transport]) => ({
820
1122
  stream: transport,
821
1123
  level: options.level || LogLevel.INFO
822
1124
  })),
823
1125
  {
824
- stream: pretty({
825
- colorize: true,
826
- levelFirst: true,
827
- ignore: "pid,hostname",
828
- colorizeObjects: true,
829
- translateTime: "SYS:standard",
830
- singleLine: false
831
- }),
1126
+ stream: prettyStream,
832
1127
  level: options.level || LogLevel.INFO
833
1128
  }
834
1129
  ])
@@ -846,31 +1141,7 @@ var Logger = class {
846
1141
  error(message, args = {}) {
847
1142
  this.logger.error(args, message);
848
1143
  }
849
- // Stream creation for process output handling
850
- createStream() {
851
- return new Transform({
852
- transform: (chunk, _encoding, callback) => {
853
- const line = chunk.toString().trim();
854
- if (line) {
855
- this.info(line);
856
- }
857
- callback(null, chunk);
858
- }
859
- });
860
- }
861
- async getLogs(transportId) {
862
- if (!transportId || !this.transports[transportId]) {
863
- return [];
864
- }
865
- return this.transports[transportId].getLogs();
866
- }
867
- async getLogsByRunId({ runId, transportId }) {
868
- return this.transports[transportId]?.getLogsByRunId({ runId });
869
- }
870
1144
  };
871
- function createLogger(options) {
872
- return new Logger(options);
873
- }
874
1145
 
875
1146
  var DepsService = class {
876
1147
  packageManager;
@@ -880,11 +1151,11 @@ var DepsService = class {
880
1151
  findLockFile(dir) {
881
1152
  const lockFiles = ["pnpm-lock.yaml", "package-lock.json", "yarn.lock", "bun.lock"];
882
1153
  for (const file of lockFiles) {
883
- if (fs3__default__default.existsSync(path.join(dir, file))) {
1154
+ if (fs3__default__default.existsSync(path2.join(dir, file))) {
884
1155
  return file;
885
1156
  }
886
1157
  }
887
- const parentDir = path.resolve(dir, "..");
1158
+ const parentDir = path2.resolve(dir, "..");
888
1159
  if (parentDir !== dir) {
889
1160
  return this.findLockFile(parentDir);
890
1161
  }
@@ -921,7 +1192,7 @@ var DepsService = class {
921
1192
  }
922
1193
  async checkDependencies(dependencies) {
923
1194
  try {
924
- const packageJsonPath = path.join(process.cwd(), "package.json");
1195
+ const packageJsonPath = path2.join(process.cwd(), "package.json");
925
1196
  try {
926
1197
  await fs4.access(packageJsonPath);
927
1198
  } catch {
@@ -941,7 +1212,7 @@ var DepsService = class {
941
1212
  }
942
1213
  async getProjectName() {
943
1214
  try {
944
- const packageJsonPath = path.join(process.cwd(), "package.json");
1215
+ const packageJsonPath = path2.join(process.cwd(), "package.json");
945
1216
  const packageJson = await fs4.readFile(packageJsonPath, "utf-8");
946
1217
  const pkg = JSON.parse(packageJson);
947
1218
  return pkg.name;
@@ -952,7 +1223,7 @@ var DepsService = class {
952
1223
  async getPackageVersion() {
953
1224
  const __filename = fileURLToPath(import.meta.url);
954
1225
  const __dirname = dirname(__filename);
955
- const pkgJsonPath = path.join(__dirname, "..", "package.json");
1226
+ const pkgJsonPath = path2.join(__dirname, "..", "package.json");
956
1227
  const content = await fsExtra3.readJSON(pkgJsonPath);
957
1228
  return content.version;
958
1229
  }
@@ -1001,56 +1272,87 @@ function getPackageManagerInstallCommand(pm) {
1001
1272
  }
1002
1273
  }
1003
1274
  var args = ["-y", "@mastra/mcp-docs-server@latest"];
1004
- var mcpConfig = {
1005
- mcpServers: {
1006
- mastra: process.platform === `win32` ? {
1007
- command: "cmd",
1008
- args: ["/c", "npx", ...args]
1009
- } : {
1010
- command: "npx",
1011
- args
1012
- }
1275
+ var createMcpConfig = (editor) => {
1276
+ if (editor === "vscode") {
1277
+ return {
1278
+ servers: {
1279
+ mastra: process.platform === `win32` ? {
1280
+ command: "cmd",
1281
+ args: ["/c", "npx", ...args],
1282
+ type: "stdio"
1283
+ } : {
1284
+ command: "npx",
1285
+ args,
1286
+ type: "stdio"
1287
+ }
1288
+ }
1289
+ };
1013
1290
  }
1291
+ return {
1292
+ mcpServers: {
1293
+ mastra: process.platform === `win32` ? {
1294
+ command: "cmd",
1295
+ args: ["/c", "npx", ...args]
1296
+ } : {
1297
+ command: "npx",
1298
+ args
1299
+ }
1300
+ }
1301
+ };
1014
1302
  };
1015
- function makeConfig(original) {
1303
+ function makeConfig(original, editor) {
1304
+ if (editor === "vscode") {
1305
+ return {
1306
+ ...original,
1307
+ servers: {
1308
+ ...original?.servers || {},
1309
+ ...createMcpConfig(editor).servers
1310
+ }
1311
+ };
1312
+ }
1016
1313
  return {
1017
1314
  ...original,
1018
1315
  mcpServers: {
1019
1316
  ...original?.mcpServers || {},
1020
- ...mcpConfig.mcpServers
1317
+ ...createMcpConfig(editor).mcpServers
1021
1318
  }
1022
1319
  };
1023
1320
  }
1024
- async function writeMergedConfig(configPath) {
1321
+ async function writeMergedConfig(configPath, editor) {
1025
1322
  const configExists = existsSync(configPath);
1026
- const config = makeConfig(configExists ? await readJSON(configPath) : {});
1323
+ const config = makeConfig(configExists ? await readJSON(configPath) : {}, editor);
1027
1324
  await ensureFile(configPath);
1028
1325
  await writeJSON(configPath, config, {
1029
1326
  spaces: 2
1030
1327
  });
1031
1328
  }
1032
- var windsurfGlobalMCPConfigPath = path.join(os.homedir(), ".codeium", "windsurf", "mcp_config.json");
1033
- var cursorGlobalMCPConfigPath = path.join(os.homedir(), ".cursor", "mcp.json");
1034
- async function installMastraDocsMCPServer({
1035
- editor,
1036
- directory
1037
- }) {
1329
+ var windsurfGlobalMCPConfigPath = path2.join(os.homedir(), ".codeium", "windsurf", "mcp_config.json");
1330
+ var cursorGlobalMCPConfigPath = path2.join(os.homedir(), ".cursor", "mcp.json");
1331
+ path2.join(process.cwd(), ".vscode", "mcp.json");
1332
+ var vscodeGlobalMCPConfigPath = path2.join(
1333
+ os.homedir(),
1334
+ process.platform === "win32" ? path2.join("AppData", "Roaming", "Code", "User", "settings.json") : process.platform === "darwin" ? path2.join("Library", "Application Support", "Code", "User", "settings.json") : path2.join(".config", "Code", "User", "settings.json")
1335
+ );
1336
+ async function installMastraDocsMCPServer({ editor, directory }) {
1038
1337
  if (editor === `cursor`) {
1039
- await writeMergedConfig(path.join(directory, ".cursor", "mcp.json"));
1338
+ await writeMergedConfig(path2.join(directory, ".cursor", "mcp.json"), "cursor");
1339
+ }
1340
+ if (editor === `vscode`) {
1341
+ await writeMergedConfig(path2.join(directory, ".vscode", "mcp.json"), "vscode");
1040
1342
  }
1041
1343
  if (editor === `cursor-global`) {
1042
1344
  const alreadyInstalled = await globalMCPIsAlreadyInstalled(editor);
1043
1345
  if (alreadyInstalled) {
1044
1346
  return;
1045
1347
  }
1046
- await writeMergedConfig(cursorGlobalMCPConfigPath);
1348
+ await writeMergedConfig(cursorGlobalMCPConfigPath, "cursor-global");
1047
1349
  }
1048
1350
  if (editor === `windsurf`) {
1049
1351
  const alreadyInstalled = await globalMCPIsAlreadyInstalled(editor);
1050
1352
  if (alreadyInstalled) {
1051
1353
  return;
1052
1354
  }
1053
- await writeMergedConfig(windsurfGlobalMCPConfigPath);
1355
+ await writeMergedConfig(windsurfGlobalMCPConfigPath, editor);
1054
1356
  }
1055
1357
  }
1056
1358
  async function globalMCPIsAlreadyInstalled(editor) {
@@ -1059,12 +1361,21 @@ async function globalMCPIsAlreadyInstalled(editor) {
1059
1361
  configPath = windsurfGlobalMCPConfigPath;
1060
1362
  } else if (editor === "cursor-global") {
1061
1363
  configPath = cursorGlobalMCPConfigPath;
1364
+ } else if (editor === "vscode") {
1365
+ configPath = vscodeGlobalMCPConfigPath;
1062
1366
  }
1063
1367
  if (!configPath || !existsSync(configPath)) {
1064
1368
  return false;
1065
1369
  }
1066
1370
  try {
1067
1371
  const configContents = await readJSON(configPath);
1372
+ if (editor === "vscode") {
1373
+ if (!configContents?.servers) return false;
1374
+ const hasMastraMCP2 = Object.values(configContents.servers).some(
1375
+ (server) => server?.args?.find((arg) => arg?.includes(`@mastra/mcp-docs-server`))
1376
+ );
1377
+ return hasMastraMCP2;
1378
+ }
1068
1379
  if (!configContents?.mcpServers) return false;
1069
1380
  const hasMastraMCP = Object.values(configContents.mcpServers).some(
1070
1381
  (server) => server?.args?.find((arg) => arg?.includes(`@mastra/mcp-docs-server`))
@@ -1146,8 +1457,8 @@ var FileService = class {
1146
1457
  */
1147
1458
  async copyStarterFile(inputFile, outputFilePath, replaceIfExists) {
1148
1459
  const __filename = fileURLToPath(import.meta.url);
1149
- const __dirname = path.dirname(__filename);
1150
- const filePath = path.resolve(__dirname, "starter-files", inputFile);
1460
+ const __dirname = path2.dirname(__filename);
1461
+ const filePath = path2.resolve(__dirname, "starter-files", inputFile);
1151
1462
  const fileString = fs3__default__default.readFileSync(filePath, "utf8");
1152
1463
  if (fs3__default__default.existsSync(outputFilePath) && !replaceIfExists) {
1153
1464
  console.log(`${outputFilePath} already exists`);
@@ -1157,7 +1468,7 @@ var FileService = class {
1157
1468
  return true;
1158
1469
  }
1159
1470
  async setupEnvFile({ dbUrl }) {
1160
- const envPath = path.join(process.cwd(), ".env.development");
1471
+ const envPath = path2.join(process.cwd(), ".env.development");
1161
1472
  await fsExtra3.ensureFile(envPath);
1162
1473
  const fileEnvService = new FileEnvService(envPath);
1163
1474
  await fileEnvService.setEnvValue("DB_URL", dbUrl);
@@ -1181,7 +1492,7 @@ var FileService = class {
1181
1492
  fs3__default__default.writeFileSync(filePath, fileContent);
1182
1493
  }
1183
1494
  };
1184
- createLogger({
1495
+ new PinoLogger({
1185
1496
  name: "Mastra CLI",
1186
1497
  level: "debug"
1187
1498
  });
@@ -1207,7 +1518,7 @@ var getProviderImportAndModelItem = (llmProvider) => {
1207
1518
  let modelItem = "";
1208
1519
  if (llmProvider === "openai") {
1209
1520
  providerImport = `import { openai } from '${getAISDKPackage(llmProvider)}';`;
1210
- modelItem = `openai('gpt-4o')`;
1521
+ modelItem = `openai('gpt-4o-mini')`;
1211
1522
  } else if (llmProvider === "anthropic") {
1212
1523
  providerImport = `import { anthropic } from '${getAISDKPackage(llmProvider)}';`;
1213
1524
  modelItem = `anthropic('claude-3-5-sonnet-20241022')`;
@@ -1241,7 +1552,8 @@ async function writeAgentSample(llmProvider, destPath, addExampleTool) {
1241
1552
  ${providerImport}
1242
1553
  import { Agent } from '@mastra/core/agent';
1243
1554
  import { Memory } from '@mastra/memory';
1244
- ${addExampleTool ? `import { weatherTool } from '../tools';` : ""}
1555
+ import { LibSQLStore } from '@mastra/libsql';
1556
+ ${addExampleTool ? `import { weatherTool } from '../tools/weather-tool';` : ""}
1245
1557
 
1246
1558
  export const weatherAgent = new Agent({
1247
1559
  name: 'Weather Agent',
@@ -1249,13 +1561,9 @@ export const weatherAgent = new Agent({
1249
1561
  model: ${modelItem},
1250
1562
  ${addExampleTool ? "tools: { weatherTool }," : ""}
1251
1563
  memory: new Memory({
1252
- options: {
1253
- lastMessages: 10,
1254
- semanticRecall: false,
1255
- threads: {
1256
- generateTitle: false
1257
- }
1258
- }
1564
+ storage: new LibSQLStore({
1565
+ url: "file:../mastra.db", // path is relative to the .mastra/output directory
1566
+ })
1259
1567
  })
1260
1568
  });
1261
1569
  `;
@@ -1270,7 +1578,7 @@ async function writeWorkflowSample(destPath, llmProvider) {
1270
1578
  const { providerImport, modelItem } = getProviderImportAndModelItem(llmProvider);
1271
1579
  const content = `${providerImport}
1272
1580
  import { Agent } from '@mastra/core/agent';
1273
- import { Step, Workflow } from '@mastra/core/workflows';
1581
+ import { createStep, createWorkflow } from '@mastra/core/workflows';
1274
1582
  import { z } from 'zod';
1275
1583
 
1276
1584
  const llm = ${modelItem};
@@ -1323,80 +1631,107 @@ const agent = new Agent({
1323
1631
  \`,
1324
1632
  });
1325
1633
 
1326
- const forecastSchema = z.array(
1327
- z.object({
1328
- date: z.string(),
1329
- maxTemp: z.number(),
1330
- minTemp: z.number(),
1331
- precipitationChance: z.number(),
1332
- condition: z.string(),
1333
- location: z.string(),
1334
- }),
1335
- );
1634
+ const forecastSchema = z.object({
1635
+ date: z.string(),
1636
+ maxTemp: z.number(),
1637
+ minTemp: z.number(),
1638
+ precipitationChance: z.number(),
1639
+ condition: z.string(),
1640
+ location: z.string(),
1641
+ })
1642
+
1643
+ function getWeatherCondition(code: number): string {
1644
+ const conditions: Record<number, string> = {
1645
+ 0: 'Clear sky',
1646
+ 1: 'Mainly clear',
1647
+ 2: 'Partly cloudy',
1648
+ 3: 'Overcast',
1649
+ 45: 'Foggy',
1650
+ 48: 'Depositing rime fog',
1651
+ 51: 'Light drizzle',
1652
+ 53: 'Moderate drizzle',
1653
+ 55: 'Dense drizzle',
1654
+ 61: 'Slight rain',
1655
+ 63: 'Moderate rain',
1656
+ 65: 'Heavy rain',
1657
+ 71: 'Slight snow fall',
1658
+ 73: 'Moderate snow fall',
1659
+ 75: 'Heavy snow fall',
1660
+ 95: 'Thunderstorm',
1661
+ }
1662
+ return conditions[code] || 'Unknown'
1663
+ }
1336
1664
 
1337
- const fetchWeather = new Step({
1665
+ const fetchWeather = createStep({
1338
1666
  id: 'fetch-weather',
1339
1667
  description: 'Fetches weather forecast for a given city',
1340
1668
  inputSchema: z.object({
1341
1669
  city: z.string().describe('The city to get the weather for'),
1342
1670
  }),
1343
1671
  outputSchema: forecastSchema,
1344
- execute: async ({ context }) => {
1345
- const triggerData = context?.getStepResult<{ city: string }>('trigger');
1346
-
1347
- if (!triggerData) {
1348
- throw new Error('Trigger data not found');
1672
+ execute: async ({ inputData }) => {
1673
+ if (!inputData) {
1674
+ throw new Error('Input data not found');
1349
1675
  }
1350
1676
 
1351
- const geocodingUrl = \`https://geocoding-api.open-meteo.com/v1/search?name=\${encodeURIComponent(triggerData.city)}&count=1\`;
1677
+ const geocodingUrl = \`https://geocoding-api.open-meteo.com/v1/search?name=\${encodeURIComponent(inputData.city)}&count=1\`;
1352
1678
  const geocodingResponse = await fetch(geocodingUrl);
1353
1679
  const geocodingData = (await geocodingResponse.json()) as {
1354
1680
  results: { latitude: number; longitude: number; name: string }[];
1355
1681
  };
1356
1682
 
1357
1683
  if (!geocodingData.results?.[0]) {
1358
- throw new Error(\`Location '\${triggerData.city}' not found\`);
1684
+ throw new Error(\`Location '\${inputData.city}' not found\`);
1359
1685
  }
1360
1686
 
1361
1687
  const { latitude, longitude, name } = geocodingData.results[0];
1362
1688
 
1363
- const weatherUrl = \`https://api.open-meteo.com/v1/forecast?latitude=\${latitude}&longitude=\${longitude}&daily=temperature_2m_max,temperature_2m_min,precipitation_probability_mean,weathercode&timezone=auto\`;
1689
+ const weatherUrl = \`https://api.open-meteo.com/v1/forecast?latitude=\${latitude}&longitude=\${longitude}&current=precipitation,weathercode&timezone=auto,&hourly=precipitation_probability,temperature_2m\`;
1364
1690
  const response = await fetch(weatherUrl);
1365
1691
  const data = (await response.json()) as {
1366
- daily: {
1367
- time: string[];
1368
- temperature_2m_max: number[];
1369
- temperature_2m_min: number[];
1370
- precipitation_probability_mean: number[];
1371
- weathercode: number[];
1372
- };
1373
- };
1692
+ current: {
1693
+ time: string
1694
+ precipitation: number
1695
+ weathercode: number
1696
+ }
1697
+ hourly: {
1698
+ precipitation_probability: number[]
1699
+ temperature_2m: number[]
1700
+ }
1701
+ }
1374
1702
 
1375
- const forecast = data.daily.time.map((date: string, index: number) => ({
1376
- date,
1377
- maxTemp: data.daily.temperature_2m_max[index],
1378
- minTemp: data.daily.temperature_2m_min[index],
1379
- precipitationChance: data.daily.precipitation_probability_mean[index],
1380
- condition: getWeatherCondition(data.daily.weathercode[index]!),
1381
- location: name,
1382
- }));
1703
+ const forecast = {
1704
+ date: new Date().toISOString(),
1705
+ maxTemp: Math.max(...data.hourly.temperature_2m),
1706
+ minTemp: Math.min(...data.hourly.temperature_2m),
1707
+ condition: getWeatherCondition(data.current.weathercode),
1708
+ precipitationChance: data.hourly.precipitation_probability.reduce(
1709
+ (acc, curr) => Math.max(acc, curr),
1710
+ 0
1711
+ ),
1712
+ location: name
1713
+ }
1383
1714
 
1384
1715
  return forecast;
1385
1716
  },
1386
1717
  });
1387
1718
 
1388
1719
 
1389
- const planActivities = new Step({
1720
+ const planActivities = createStep({
1390
1721
  id: 'plan-activities',
1391
1722
  description: 'Suggests activities based on weather conditions',
1392
- execute: async ({ context, mastra }) => {
1393
- const forecast = context?.getStepResult(fetchWeather);
1723
+ inputSchema: forecastSchema,
1724
+ outputSchema: z.object({
1725
+ activities: z.string(),
1726
+ }),
1727
+ execute: async ({ inputData }) => {
1728
+ const forecast = inputData
1394
1729
 
1395
- if (!forecast || forecast.length === 0) {
1396
- throw new Error('Forecast data not found');
1730
+ if (!forecast) {
1731
+ throw new Error('Forecast data not found')
1397
1732
  }
1398
1733
 
1399
- const prompt = \`Based on the following weather forecast for \${forecast[0]?.location}, suggest appropriate activities:
1734
+ const prompt = \`Based on the following weather forecast for \${forecast.location}, suggest appropriate activities:
1400
1735
  \${JSON.stringify(forecast, null, 2)}
1401
1736
  \`;
1402
1737
 
@@ -1408,7 +1743,7 @@ const planActivities = new Step({
1408
1743
  ]);
1409
1744
 
1410
1745
  let activitiesText = '';
1411
-
1746
+
1412
1747
  for await (const chunk of response.textStream) {
1413
1748
  process.stdout.write(chunk);
1414
1749
  activitiesText += chunk;
@@ -1420,35 +1755,16 @@ const planActivities = new Step({
1420
1755
  },
1421
1756
  });
1422
1757
 
1423
- function getWeatherCondition(code: number): string {
1424
- const conditions: Record<number, string> = {
1425
- 0: 'Clear sky',
1426
- 1: 'Mainly clear',
1427
- 2: 'Partly cloudy',
1428
- 3: 'Overcast',
1429
- 45: 'Foggy',
1430
- 48: 'Depositing rime fog',
1431
- 51: 'Light drizzle',
1432
- 53: 'Moderate drizzle',
1433
- 55: 'Dense drizzle',
1434
- 61: 'Slight rain',
1435
- 63: 'Moderate rain',
1436
- 65: 'Heavy rain',
1437
- 71: 'Slight snow fall',
1438
- 73: 'Moderate snow fall',
1439
- 75: 'Heavy snow fall',
1440
- 95: 'Thunderstorm',
1441
- };
1442
- return conditions[code] || 'Unknown';
1443
- }
1444
-
1445
- const weatherWorkflow = new Workflow({
1446
- name: 'weather-workflow',
1447
- triggerSchema: z.object({
1758
+ const weatherWorkflow = createWorkflow({
1759
+ id: 'weather-workflow',
1760
+ inputSchema: z.object({
1448
1761
  city: z.string().describe('The city to get the weather for'),
1449
1762
  }),
1763
+ outputSchema: z.object({
1764
+ activities: z.string(),
1765
+ })
1450
1766
  })
1451
- .step(fetchWeather)
1767
+ .then(fetchWeather)
1452
1768
  .then(planActivities);
1453
1769
 
1454
1770
  weatherWorkflow.commit();
@@ -1488,7 +1804,7 @@ var writeIndexFile = async ({
1488
1804
  addWorkflow
1489
1805
  }) => {
1490
1806
  const indexPath = dirPath + "/index.ts";
1491
- const destPath = path.join(indexPath);
1807
+ const destPath = path2.join(indexPath);
1492
1808
  try {
1493
1809
  await fs4.writeFile(destPath, "");
1494
1810
  const filteredExports = [
@@ -1510,10 +1826,10 @@ export const mastra = new Mastra()
1510
1826
  destPath,
1511
1827
  `
1512
1828
  import { Mastra } from '@mastra/core/mastra';
1513
- import { createLogger } from '@mastra/core/logger';
1829
+ import { PinoLogger } from '@mastra/loggers';
1514
1830
  import { LibSQLStore } from '@mastra/libsql';
1515
- ${addWorkflow ? `import { weatherWorkflow } from './workflows';` : ""}
1516
- ${addAgent ? `import { weatherAgent } from './agents';` : ""}
1831
+ ${addWorkflow ? `import { weatherWorkflow } from './workflows/weather-workflow';` : ""}
1832
+ ${addAgent ? `import { weatherAgent } from './agents/weather-agent';` : ""}
1517
1833
 
1518
1834
  export const mastra = new Mastra({
1519
1835
  ${filteredExports.join("\n ")}
@@ -1521,7 +1837,7 @@ export const mastra = new Mastra({
1521
1837
  // stores telemetry, evals, ... into memory storage, if it needs to persist, change to file:../mastra.db
1522
1838
  url: ":memory:",
1523
1839
  }),
1524
- logger: createLogger({
1840
+ logger: new PinoLogger({
1525
1841
  name: 'Mastra',
1526
1842
  level: 'info',
1527
1843
  }),
@@ -1557,11 +1873,13 @@ var writeAPIKey = async ({
1557
1873
  apiKey = "your-api-key"
1558
1874
  }) => {
1559
1875
  const key = await getAPIKey(provider);
1560
- await exec(`echo ${key}=${apiKey} >> .env.development`);
1876
+ const escapedKey = shellQuote.quote([key]);
1877
+ const escapedApiKey = shellQuote.quote([apiKey]);
1878
+ await exec(`echo ${escapedKey}=${escapedApiKey} >> .env`);
1561
1879
  };
1562
1880
  var createMastraDir = async (directory) => {
1563
1881
  let dir = directory.trim().split("/").filter((item) => item !== "");
1564
- const dirPath = path.join(process.cwd(), ...dir, "mastra");
1882
+ const dirPath = path2.join(process.cwd(), ...dir, "mastra");
1565
1883
  try {
1566
1884
  await fs4.access(dirPath);
1567
1885
  return { ok: false };
@@ -1571,7 +1889,7 @@ var createMastraDir = async (directory) => {
1571
1889
  }
1572
1890
  };
1573
1891
  var writeCodeSample = async (dirPath, component, llmProvider, importComponents) => {
1574
- const destPath = dirPath + `/${component}/index.ts`;
1892
+ const destPath = dirPath + `/${component}/weather-${component.slice(0, -1)}.ts`;
1575
1893
  try {
1576
1894
  await writeCodeSampleForComponents(llmProvider, component, destPath, importComponents);
1577
1895
  } catch (err) {
@@ -1635,6 +1953,7 @@ var interactivePrompt = async () => {
1635
1953
  configureEditorWithDocsMCP: async () => {
1636
1954
  const windsurfIsAlreadyInstalled = await globalMCPIsAlreadyInstalled(`windsurf`);
1637
1955
  const cursorIsAlreadyInstalled = await globalMCPIsAlreadyInstalled(`cursor`);
1956
+ const vscodeIsAlreadyInstalled = await globalMCPIsAlreadyInstalled(`vscode`);
1638
1957
  const editor = await le({
1639
1958
  message: `Make your AI IDE into a Mastra expert? (installs Mastra docs MCP server)`,
1640
1959
  options: [
@@ -1653,6 +1972,11 @@ var interactivePrompt = async () => {
1653
1972
  value: "windsurf",
1654
1973
  label: "Windsurf",
1655
1974
  hint: windsurfIsAlreadyInstalled ? `Already installed` : void 0
1975
+ },
1976
+ {
1977
+ value: "vscode",
1978
+ label: "VSCode",
1979
+ hint: vscodeIsAlreadyInstalled ? `Already installed` : void 0
1656
1980
  }
1657
1981
  ]
1658
1982
  });
@@ -1662,6 +1986,11 @@ var interactivePrompt = async () => {
1662
1986
  Windsurf is already installed, skipping.`);
1663
1987
  return void 0;
1664
1988
  }
1989
+ if (editor === `vscode` && vscodeIsAlreadyInstalled) {
1990
+ v.message(`
1991
+ VSCode is already installed, skipping.`);
1992
+ return void 0;
1993
+ }
1665
1994
  if (editor === `cursor`) {
1666
1995
  v.message(
1667
1996
  `
@@ -1751,6 +2080,10 @@ var init = async ({
1751
2080
  if (needsMemory) {
1752
2081
  await depService.installPackages(["@mastra/memory"]);
1753
2082
  }
2083
+ const needsLoggers = await depService.checkDependencies(["@mastra/loggers"]) !== `ok`;
2084
+ if (needsLoggers) {
2085
+ await depService.installPackages(["@mastra/loggers"]);
2086
+ }
1754
2087
  }
1755
2088
  const key = await getAPIKey(llmProvider || "openai");
1756
2089
  const aiSdkPackage = getAISDKPackage(llmProvider);
@@ -1770,7 +2103,7 @@ var init = async ({
1770
2103
  ${color2.green("Mastra initialized successfully!")}
1771
2104
 
1772
2105
  Add your ${color2.cyan(key)} as an environment variable
1773
- in your ${color2.cyan(".env.development")} file
2106
+ in your ${color2.cyan(".env")} file
1774
2107
  `);
1775
2108
  } else {
1776
2109
  me(`
@@ -1860,10 +2193,12 @@ var createMastraProject = async ({
1860
2193
  s2.message("Creating project");
1861
2194
  await exec3(`npm init -y`);
1862
2195
  await exec3(`npm pkg set type="module"`);
2196
+ await exec3(`npm pkg set engines.node=">=20.9.0"`);
1863
2197
  const depsService = new DepsService();
1864
2198
  await depsService.addScriptsToPackageJson({
1865
2199
  dev: "mastra dev",
1866
- build: "mastra build"
2200
+ build: "mastra build",
2201
+ start: "mastra start"
1867
2202
  });
1868
2203
  s2.stop("Project created");
1869
2204
  s2.start(`Installing ${pm} dependencies`);
@@ -1931,23 +2266,25 @@ var create = async (args2) => {
1931
2266
  components,
1932
2267
  llmProvider,
1933
2268
  addExample,
1934
- llmApiKey
2269
+ llmApiKey,
2270
+ configureEditorWithDocsMCP: args2.mcpServer
1935
2271
  });
1936
2272
  postCreate({ projectName });
1937
2273
  };
1938
2274
  var postCreate = ({ projectName }) => {
2275
+ const packageManager = getPackageManager();
1939
2276
  ge(`
1940
2277
  ${color2.green("To start your project:")}
1941
2278
 
1942
2279
  ${color2.cyan("cd")} ${projectName}
1943
- ${color2.cyan("npm run dev")}
2280
+ ${color2.cyan(`${packageManager} run dev`)}
1944
2281
  `);
1945
2282
  };
1946
2283
 
1947
2284
  async function getPackageVersion() {
1948
2285
  const __filename = fileURLToPath(import.meta.url);
1949
2286
  const __dirname = dirname(__filename);
1950
- const pkgJsonPath = path.join(__dirname, "..", "package.json");
2287
+ const pkgJsonPath = path2.join(__dirname, "..", "package.json");
1951
2288
  const content = await fsExtra.readJSON(pkgJsonPath);
1952
2289
  return content.version;
1953
2290
  }
@@ -1956,7 +2293,7 @@ async function getCreateVersionTag() {
1956
2293
  const pkgPath = fileURLToPath(import.meta.resolve("create-mastra/package.json"));
1957
2294
  const json = await fsExtra.readJSON(pkgPath);
1958
2295
  const { stdout } = await execa("npm", ["dist-tag", "create-mastra"]);
1959
- const tagLine = stdout.split("\n").find((distLine) => distLine.includes(`: ${json.version}`));
2296
+ const tagLine = stdout.split("\n").find((distLine) => distLine.endsWith(`: ${json.version}`));
1960
2297
  const tag = tagLine ? tagLine.split(":")[0].trim() : "latest";
1961
2298
  return tag;
1962
2299
  } catch {
@@ -1985,16 +2322,17 @@ program.version(`${version}`, "-v, --version").description(`create-mastra ${vers
1985
2322
  program.name("create-mastra").description("Create a new Mastra project").argument("[project-name]", "Directory name of the project").option(
1986
2323
  "-p, --project-name <string>",
1987
2324
  "Project name that will be used in package.json and as the project directory name."
1988
- ).option("--default", "Quick start with defaults(src, OpenAI, no examples)").option("-c, --components <components>", "Comma-separated list of components (agents, tools, workflows)").option("-l, --llm <model-provider>", "Default model provider (openai, anthropic, groq, google, or cerebras)").option("-k, --llm-api-key <api-key>", "API key for the model provider").option("-e, --example", "Include example code").option("-n, --no-example", "Do not include example code").option("-t, --timeout [timeout]", "Configurable timeout for package installation, defaults to 60000 ms").option("-d, --dir <directory>", "Target directory for Mastra source code (default: src/)").action(async (projectNameArg, args) => {
2325
+ ).option("--default", "Quick start with defaults(src, OpenAI, no examples)").option("-c, --components <components>", "Comma-separated list of components (agents, tools, workflows)").option("-l, --llm <model-provider>", "Default model provider (openai, anthropic, groq, google, or cerebras)").option("-k, --llm-api-key <api-key>", "API key for the model provider").option("-e, --example", "Include example code").option("-n, --no-example", "Do not include example code").option("-t, --timeout [timeout]", "Configurable timeout for package installation, defaults to 60000 ms").option("-d, --dir <directory>", "Target directory for Mastra source code (default: src/)").option("-m, --mcp <mcp>", "MCP Server for code editor (cursor, cursor-global, windsurf, vscode)").action(async (projectNameArg, args) => {
1989
2326
  const projectName = projectNameArg || args.projectName;
1990
2327
  const timeout = args?.timeout ? args?.timeout === true ? 6e4 : parseInt(args?.timeout, 10) : void 0;
1991
2328
  if (args.default) {
1992
2329
  await create({
1993
2330
  components: ["agents", "tools", "workflows"],
1994
2331
  llmProvider: "openai",
1995
- addExample: false,
2332
+ addExample: true,
1996
2333
  createVersionTag,
1997
- timeout
2334
+ timeout,
2335
+ mcpServer: args.mcp
1998
2336
  });
1999
2337
  return;
2000
2338
  }
@@ -2006,7 +2344,8 @@ program.name("create-mastra").description("Create a new Mastra project").argumen
2006
2344
  createVersionTag,
2007
2345
  timeout,
2008
2346
  projectName,
2009
- directory: args.dir
2347
+ directory: args.dir,
2348
+ mcpServer: args.mcp
2010
2349
  });
2011
2350
  });
2012
2351
  program.parse(process.argv);