create-mcp-use-app 0.4.3 → 0.4.4-canary.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/README.md CHANGED
@@ -13,9 +13,9 @@
13
13
  <img src="https://img.shields.io/npm/dw/create-mcp-use-app.svg"/></a>
14
14
  <a href="https://www.npmjs.com/package/create-mcp-use-app" alt="NPM Version">
15
15
  <img src="https://img.shields.io/npm/v/create-mcp-use-app.svg"/></a>
16
- <a href="https://github.com/mcp-use/mcp-use-ts/blob/main/LICENSE" alt="License">
16
+ <a href="https://github.com/mcp-use/mcp-use/blob/main/LICENSE" alt="License">
17
17
  <img src="https://img.shields.io/github/license/mcp-use/mcp-use-ts" /></a>
18
- <a href="https://github.com/mcp-use/mcp-use-ts/stargazers" alt="GitHub stars">
18
+ <a href="https://github.com/mcp-use/mcp-use/stargazers" alt="GitHub stars">
19
19
  <img src="https://img.shields.io/github/stars/mcp-use/mcp-use-ts?style=social" /></a>
20
20
  <a href="https://discord.gg/XkNkSkMz3V" alt="Discord">
21
21
  <img src="https://dcbadge.limes.pink/api/server/XkNkSkMz3V?style=flat" /></a>
@@ -27,9 +27,9 @@
27
27
 
28
28
  | Package | Description | Version |
29
29
  | ---------------------------------------------------------------------------------------- | ----------------------- | --------------------------------------------------------------------------------------------------------------- |
30
- | [mcp-use](https://github.com/mcp-use/mcp-use-ts/tree/main/packages/mcp-use) | Core MCP framework | [![npm](https://img.shields.io/npm/v/mcp-use.svg)](https://www.npmjs.com/package/mcp-use) |
31
- | [@mcp-use/cli](https://github.com/mcp-use/mcp-use-ts/tree/main/packages/cli) | Build tool for MCP apps | [![npm](https://img.shields.io/npm/v/@mcp-use/cli.svg)](https://www.npmjs.com/package/@mcp-use/cli) |
32
- | [@mcp-use/inspector](https://github.com/mcp-use/mcp-use-ts/tree/main/packages/inspector) | Web-based MCP inspector | [![npm](https://img.shields.io/npm/v/@mcp-use/inspector.svg)](https://www.npmjs.com/package/@mcp-use/inspector) |
30
+ | [mcp-use](https://github.com/mcp-use/mcp-use/tree/main/packages/mcp-use) | Core MCP framework | [![npm](https://img.shields.io/npm/v/mcp-use.svg)](https://www.npmjs.com/package/mcp-use) |
31
+ | [@mcp-use/cli](https://github.com/mcp-use/mcp-use/tree/main/packages/cli) | Build tool for MCP apps | [![npm](https://img.shields.io/npm/v/@mcp-use/cli.svg)](https://www.npmjs.com/package/@mcp-use/cli) |
32
+ | [@mcp-use/inspector](https://github.com/mcp-use/mcp-use/tree/main/packages/inspector) | Web-based MCP inspector | [![npm](https://img.shields.io/npm/v/@mcp-use/inspector.svg)](https://www.npmjs.com/package/@mcp-use/inspector) |
33
33
 
34
34
  ---
35
35
 
@@ -439,17 +439,17 @@ We welcome contributions! To contribute:
439
439
  3. Make your changes
440
440
  4. Submit a pull request
441
441
 
442
- See our [contributing guide](https://github.com/mcp-use/mcp-use-ts/blob/main/CONTRIBUTING.md) for more details.
442
+ See our [contributing guide](https://github.com/mcp-use/mcp-use/blob/main/CONTRIBUTING.md) for more details.
443
443
 
444
444
  ---
445
445
 
446
446
  ## 📚 Learn More
447
447
 
448
- - [mcp-use Documentation](https://github.com/mcp-use/mcp-use-ts)
448
+ - [mcp-use Documentation](https://github.com/mcp-use/mcp-use)
449
449
  - [Model Context Protocol Spec](https://modelcontextprotocol.io)
450
- - [Creating MCP Tools](https://github.com/mcp-use/mcp-use-ts/tree/main/packages/mcp-use#-mcp-server-framework)
451
- - [Building UI Widgets](https://github.com/mcp-use/mcp-use-ts/tree/main/packages/cli#-creating-ui-widgets)
452
- - [Using the Inspector](https://github.com/mcp-use/mcp-use-ts/tree/main/packages/inspector)
450
+ - [Creating MCP Tools](https://github.com/mcp-use/mcp-use/tree/main/packages/mcp-use#-mcp-server-framework)
451
+ - [Building UI Widgets](https://github.com/mcp-use/mcp-use/tree/main/packages/cli#-creating-ui-widgets)
452
+ - [Using the Inspector](https://github.com/mcp-use/mcp-use/tree/main/packages/inspector)
453
453
 
454
454
  ---
455
455
 
package/dist/index.js CHANGED
@@ -31,6 +31,39 @@ function runPackageManager(packageManager, args, cwd) {
31
31
  });
32
32
  });
33
33
  }
34
+ function detectPackageManager() {
35
+ const userAgent = process.env.npm_config_user_agent || "";
36
+ if (userAgent.includes("yarn")) {
37
+ return "yarn";
38
+ } else if (userAgent.includes("pnpm")) {
39
+ return "pnpm";
40
+ } else if (userAgent.includes("npm")) {
41
+ return "npm";
42
+ }
43
+ return null;
44
+ }
45
+ function getDevCommand(packageManager) {
46
+ switch (packageManager) {
47
+ case "yarn":
48
+ return "yarn dev";
49
+ case "pnpm":
50
+ return "pnpm dev";
51
+ case "npm":
52
+ default:
53
+ return "npm run dev";
54
+ }
55
+ }
56
+ function getInstallCommand(packageManager) {
57
+ switch (packageManager) {
58
+ case "yarn":
59
+ return "yarn";
60
+ case "pnpm":
61
+ return "pnpm install";
62
+ case "npm":
63
+ default:
64
+ return "npm install";
65
+ }
66
+ }
34
67
  var program = new Command();
35
68
  function renderLogo() {
36
69
  console.log(chalk.cyan("\u259B\u259B\u258C\u259B\u2598\u259B\u258C\u2584\u2596\u258C\u258C\u259B\u2598\u2588\u258C"));
@@ -89,7 +122,7 @@ function processTemplateFile(filePath, versions, isDevelopment = false, useCanar
89
122
  }
90
123
  return processedContent;
91
124
  }
92
- program.name("create-mcp-use-app").description("Create a new MCP server project").version(packageJson.version).argument("[project-name]", "Name of the MCP server project").option("-t, --template <template>", "Template to use", "simple").option("--no-install", "Skip installing dependencies").option("--dev", "Use workspace dependencies for development").option("--canary", "Use canary versions of packages").action(async (projectName, options) => {
125
+ program.name("create-mcp-use-app").description("Create a new MCP server project").version(packageJson.version).argument("[project-name]", "Name of the MCP server project").option("-t, --template <template>", "Template to use", "simple").option("--no-install", "Skip installing dependencies").option("--dev", "Use workspace dependencies for development").option("--canary", "Use canary versions of packages").option("--yarn", "Use yarn as package manager").option("--npm", "Use npm as package manager").option("--pnpm", "Use pnpm as package manager").action(async (projectName, options) => {
93
126
  try {
94
127
  let selectedTemplate = options.template;
95
128
  if (!projectName) {
@@ -130,20 +163,76 @@ program.name("create-mcp-use-app").description("Create a new MCP server project"
130
163
  const versions = getCurrentPackageVersions(options.dev, options.canary);
131
164
  await copyTemplate(projectPath, validatedTemplate, versions, options.dev, options.canary);
132
165
  updatePackageJson(projectPath, sanitizedProjectName);
166
+ let usedPackageManager = "npm";
167
+ if (options.yarn) {
168
+ usedPackageManager = "yarn";
169
+ } else if (options.npm) {
170
+ usedPackageManager = "npm";
171
+ } else if (options.pnpm) {
172
+ usedPackageManager = "pnpm";
173
+ } else {
174
+ const detected = detectPackageManager();
175
+ if (detected) {
176
+ usedPackageManager = detected;
177
+ } else {
178
+ const defaultOrder = ["yarn", "npm", "pnpm"];
179
+ usedPackageManager = defaultOrder[0];
180
+ }
181
+ }
133
182
  if (options.install) {
134
- const spinner = ora("Installing packages...").start();
183
+ const showSpinner = usedPackageManager !== "yarn" && usedPackageManager !== "npm";
184
+ const spinner = showSpinner ? ora("Installing packages...").start() : null;
135
185
  try {
136
- await runPackageManager("pnpm", ["install"], projectPath);
137
- spinner.succeed("Packages installed successfully");
138
- } catch {
139
- spinner.text = "pnpm not found, trying npm...";
140
- try {
141
- await runPackageManager("npm", ["install"], projectPath);
142
- spinner.succeed("Packages installed successfully");
143
- } catch (error) {
186
+ if (options.yarn || options.npm || options.pnpm || detectPackageManager()) {
187
+ if (!showSpinner) {
188
+ console.log("");
189
+ }
190
+ await runPackageManager(usedPackageManager, ["install"], projectPath);
191
+ if (spinner) {
192
+ spinner.succeed(`Packages installed successfully with ${usedPackageManager}`);
193
+ } else {
194
+ console.log("");
195
+ }
196
+ } else {
197
+ if (spinner) spinner.text = "Installing packages (trying yarn)...";
198
+ try {
199
+ if (!spinner) console.log("");
200
+ await runPackageManager("yarn", ["install"], projectPath);
201
+ usedPackageManager = "yarn";
202
+ if (spinner) {
203
+ spinner.succeed("Packages installed successfully with yarn");
204
+ } else {
205
+ console.log("");
206
+ }
207
+ } catch {
208
+ if (spinner) spinner.text = "yarn not found, trying npm...";
209
+ try {
210
+ await runPackageManager("npm", ["install"], projectPath);
211
+ usedPackageManager = "npm";
212
+ if (spinner) {
213
+ spinner.succeed("Packages installed successfully with npm");
214
+ } else {
215
+ console.log("");
216
+ }
217
+ } catch {
218
+ if (spinner) spinner.text = "npm not found, trying pnpm...";
219
+ await runPackageManager("pnpm", ["install"], projectPath);
220
+ usedPackageManager = "pnpm";
221
+ if (spinner) {
222
+ spinner.succeed("Packages installed successfully with pnpm");
223
+ } else {
224
+ console.log("");
225
+ }
226
+ }
227
+ }
228
+ }
229
+ } catch (error) {
230
+ if (spinner) {
144
231
  spinner.fail("Package installation failed");
145
- console.log('\u26A0\uFE0F Please run "npm install" or "pnpm install" manually');
232
+ } else {
233
+ console.log("\u274C Package installation failed");
146
234
  }
235
+ console.log('\u26A0\uFE0F Please run "npm install", "yarn install", or "pnpm install" manually');
147
236
  }
148
237
  }
149
238
  console.log("");
@@ -172,9 +261,9 @@ program.name("create-mcp-use-app").description("Create a new MCP server project"
172
261
  console.log(chalk.bold("\u{1F680} To get started:"));
173
262
  console.log(chalk.cyan(` cd ${sanitizedProjectName}`));
174
263
  if (!options.install) {
175
- console.log(chalk.cyan(" npm install"));
264
+ console.log(chalk.cyan(` ${getInstallCommand(usedPackageManager)}`));
176
265
  }
177
- console.log(chalk.cyan(" npm run dev"));
266
+ console.log(chalk.cyan(` ${getDevCommand(usedPackageManager)}`));
178
267
  console.log("");
179
268
  if (options.dev) {
180
269
  console.log(chalk.yellow("\u{1F4A1} Development mode: Your project uses workspace dependencies"));
@@ -214,8 +303,9 @@ async function copyTemplate(projectPath, template, versions, isDevelopment = fal
214
303
  } else {
215
304
  console.log("No templates directory found");
216
305
  }
217
- console.log('\u{1F4A1} Tip: Use "ui" template for React components and modern UI features');
218
- console.log('\u{1F4A1} Tip: Use "uiresource" template for UI resources and advanced server examples');
306
+ console.log('\u{1F4A1} Tip: Use "starter" template for a comprehensive MCP server with all features');
307
+ console.log('\u{1F4A1} Tip: Use "ui-resource" template for a MCP server with mcp-ui resources');
308
+ console.log('\u{1F4A1} Tip: Use "apps-sdk-demo" template for a MCP server with OpenAI Apps SDK integration');
219
309
  process.exit(1);
220
310
  }
221
311
  copyDirectoryWithProcessing(templatePath, projectPath, versions, isDevelopment, useCanary);
@@ -270,11 +360,11 @@ async function promptForProjectName() {
270
360
  }
271
361
  async function promptForTemplate() {
272
362
  const templatesDir = join(__dirname, "templates");
273
- const availableTemplates = existsSync(templatesDir) ? readdirSync(templatesDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name).sort() : ["simple", "ui", "uiresource"];
363
+ const availableTemplates = existsSync(templatesDir) ? readdirSync(templatesDir, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()).map((dirent) => dirent.name).sort() : ["starter", "ui-resource", "apps-sdk-demo"];
274
364
  const templateDescriptions = {
275
- "simple": "Simple MCP server with a basic calculator tool (add numbers)",
276
- "ui": "MCP Server with mcp-ui resources returned from tools",
277
- "uiresource": "MCP Server with mcp-ui resources"
365
+ "starter": "Starter MCP server with all features",
366
+ "ui-resource": "MCP Server with mcp-ui resources returned from tools",
367
+ "apps-sdk-demo": "MCP Server with mcp-ui resources"
278
368
  };
279
369
  const { template } = await inquirer.prompt([
280
370
  {
@@ -363,7 +363,7 @@ console.log('Resource:', resource)
363
363
  ## 📂 Project Structure
364
364
 
365
365
  ```
366
- apps_sdk/
366
+ apps-sdk/
367
367
  ├── index.ts # Entry point
368
368
  ├── package.json # Dependencies
369
369
  ├── tsconfig.json # TypeScript config
@@ -151,30 +151,3 @@ export function getPizzazWidgetsSummary() {
151
151
  }))
152
152
  }
153
153
 
154
- /**
155
- * Create widget metadata for a specific widget
156
- */
157
- export function widgetMeta(widget: PizzazWidgetDefinition) {
158
- return {
159
- 'openai/outputTemplate': widget.templateUri,
160
- 'openai/toolInvocation/invoking': widget.invoking,
161
- 'openai/toolInvocation/invoked': widget.invoked,
162
- 'openai/widgetAccessible': true,
163
- 'openai/resultCanProduceWidget': true
164
- } as const
165
- }
166
-
167
- /**
168
- * Get widget by ID
169
- */
170
- export function getWidgetById(id: string): PizzazWidgetDefinition | undefined {
171
- return pizzazWidgets.find(w => w.id === id)
172
- }
173
-
174
- /**
175
- * Get widget by template URI
176
- */
177
- export function getWidgetByUri(uri: string): PizzazWidgetDefinition | undefined {
178
- return pizzazWidgets.find(w => w.templateUri === uri)
179
- }
180
-