@mcp-use/cli 1.0.10 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +118 -70
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -225853,11 +225853,11 @@ var require_react_jsx_runtime_development = __commonJS({
225853
225853
  return jsxWithValidation(type, props, key, false);
225854
225854
  }
225855
225855
  }
225856
- var jsx10 = jsxWithValidationDynamic;
225857
- var jsxs7 = jsxWithValidationStatic;
225856
+ var jsx11 = jsxWithValidationDynamic;
225857
+ var jsxs8 = jsxWithValidationStatic;
225858
225858
  exports2.Fragment = REACT_FRAGMENT_TYPE;
225859
- exports2.jsx = jsx10;
225860
- exports2.jsxs = jsxs7;
225859
+ exports2.jsx = jsx11;
225860
+ exports2.jsxs = jsxs8;
225861
225861
  })();
225862
225862
  }
225863
225863
  }
@@ -279363,9 +279363,7 @@ var LLMService = class {
279363
279363
  }
279364
279364
  createLLM() {
279365
279365
  if (!this.currentLLMConfig) {
279366
- throw new Error(
279367
- "No LLM configured. Use /model command to select a provider and model."
279368
- );
279366
+ return null;
279369
279367
  }
279370
279368
  const config3 = this.currentLLMConfig;
279371
279369
  const providerInfo = PROVIDERS[config3.provider];
@@ -279683,7 +279681,7 @@ var MCPConfigService = class {
279683
279681
  success: false,
279684
279682
  message: `Server(s) already exist: ${conflicts.join(
279685
279683
  ", "
279686
- )}. Please use different names.`
279684
+ )}. Please use different names. If you want to connect to it, use /server connect <name>.`
279687
279685
  };
279688
279686
  }
279689
279687
  for (const [name, serverConfig] of Object.entries(servers)) {
@@ -279705,7 +279703,10 @@ var MCPConfigService = class {
279705
279703
  success: true,
279706
279704
  message: `Configured ${serverNames.length} server(s)!
279707
279705
 
279708
- ${serverList}`,
279706
+ ${serverList}
279707
+
279708
+
279709
+ Use /server connect <name> to connect to it.`,
279709
279710
  data: {
279710
279711
  serversAdded: true,
279711
279712
  serverNames
@@ -279969,10 +279970,10 @@ This command will test if the server package can be started manually.`
279969
279970
 
279970
279971
  Command: ${result.command}
279971
279972
 
279972
- \u26A0\uFE0F Note: This will attempt to run the server command manually.
279973
+ Note: This will attempt to run the server command manually.
279973
279974
  Check the console for output and errors.
279974
279975
 
279975
- \u{1F4A1} Try running this command manually in your terminal:
279976
+ Try running this command manually in your terminal:
279976
279977
  ${result.command}`,
279977
279978
  data: { testServer: true, serverName, command: result.command }
279978
279979
  };
@@ -280202,14 +280203,14 @@ Available slash commands:
280202
280203
  statusText += "\n";
280203
280204
  if (!currentConfig) {
280204
280205
  if (availableProviders.length === 0) {
280205
- statusText += "\u26A0\uFE0F No model selected\n";
280206
+ statusText += " No model selected\n";
280206
280207
  statusText += "\nChoose a model to get started:\n";
280207
280208
  statusText += "\u2022 /model openai gpt-4o-mini\n";
280208
280209
  statusText += "\u2022 /model anthropic claude-3-5-sonnet-20241022\n";
280209
280210
  statusText += "\u2022 /model google gemini-1.5-pro\n";
280210
280211
  statusText += "\nThe CLI will help you set up API keys when needed.";
280211
280212
  } else {
280212
- statusText += "\u26A0\uFE0F No model selected\n";
280213
+ statusText += " No model selected\n";
280213
280214
  statusText += `
280214
280215
  Available providers: ${availableProviders.join(
280215
280216
  ", "
@@ -280845,7 +280846,7 @@ Configured servers: ${configuredServers.join(
280845
280846
  await this.agentService.connectServer(serverName, serverConfig);
280846
280847
  return {
280847
280848
  type: "success",
280848
- message: `\u2705 Connected to server "${serverName}"!`,
280849
+ message: `Connected to server "${serverName}"!`,
280849
280850
  data: { reinitializeAgent: true }
280850
280851
  };
280851
280852
  } catch (error) {
@@ -280911,6 +280912,13 @@ Connected servers: ${connectedServers.join(
280911
280912
  };
280912
280913
  }
280913
280914
  }
280915
+ /**
280916
+ * Returns the command registry.
280917
+ * @returns The map of registered commands
280918
+ */
280919
+ getCommandRegistry() {
280920
+ return this.commandRegistry;
280921
+ }
280914
280922
  };
280915
280923
  var cliService = new CLIService();
280916
280924
 
@@ -282934,7 +282942,7 @@ function ToolStatus({ tools, error }) {
282934
282942
  "\u274C Error: ",
282935
282943
  error
282936
282944
  ] }),
282937
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: "\u{1F4A1} This might indicate:" }),
282945
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: " This might indicate:" }),
282938
282946
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { marginLeft: 2, flexDirection: "column", children: [
282939
282947
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: "\u2022 MCP servers failed to start" }),
282940
282948
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: "\u2022 Connection issues with configured servers" })
@@ -283100,8 +283108,29 @@ var Footer = ({
283100
283108
  );
283101
283109
  };
283102
283110
 
283103
- // source/app.tsx
283111
+ // source/components/CommandSuggestions.tsx
283104
283112
  var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
283113
+ function CommandSuggestions({
283114
+ suggestions,
283115
+ query
283116
+ }) {
283117
+ const filteredSuggestions = suggestions.filter(
283118
+ ([command]) => command.startsWith(query)
283119
+ );
283120
+ if (filteredSuggestions.length === 0) {
283121
+ return null;
283122
+ }
283123
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { borderStyle: "round", paddingX: 1, flexDirection: "column", children: [
283124
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { bold: true, children: "COMMANDS" }),
283125
+ filteredSuggestions.map(([command, { description }]) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "row", children: [
283126
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { width: 20, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: command }) }),
283127
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: description })
283128
+ ] }, command))
283129
+ ] }) });
283130
+ }
283131
+
283132
+ // source/app.tsx
283133
+ var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
283105
283134
  function App2() {
283106
283135
  const [messages2, setMessages] = (0, import_react26.useState)([]);
283107
283136
  const [input, setInput] = (0, import_react26.useState)("");
@@ -283119,6 +283148,7 @@ function App2() {
283119
283148
  const [inputHistory, setInputHistory] = (0, import_react26.useState)([]);
283120
283149
  const [historyIndex, setHistoryIndex] = (0, import_react26.useState)(-1);
283121
283150
  const [tempInput, setTempInput] = (0, import_react26.useState)("");
283151
+ const [commandSuggestions, setCommandSuggestions] = (0, import_react26.useState)([]);
283122
283152
  const { stdout } = use_stdout_default();
283123
283153
  (0, import_react26.useEffect)(() => {
283124
283154
  const initializeMCP = async () => {
@@ -283132,6 +283162,7 @@ function App2() {
283132
283162
  model,
283133
283163
  connectedServers: servers
283134
283164
  });
283165
+ setCommandSuggestions([...cliService.getCommandRegistry().entries()]);
283135
283166
  setCurrentModel(model);
283136
283167
  setConnectedServers(servers);
283137
283168
  setShowInput(true);
@@ -283360,6 +283391,17 @@ function App2() {
283360
283391
  };
283361
283392
  setMessages((prev) => [...prev, userMessage]);
283362
283393
  setInput("");
283394
+ if (currentModel.includes("No") && !trimmedInput.startsWith("/")) {
283395
+ const errorMessage = {
283396
+ id: (Date.now() + 1).toString(),
283397
+ role: "assistant",
283398
+ content: `No model configured. Use /model to select a provider and model.`,
283399
+ timestamp: /* @__PURE__ */ new Date()
283400
+ };
283401
+ setMessages((prev) => [...prev, errorMessage]);
283402
+ setIsLoading(false);
283403
+ return;
283404
+ }
283363
283405
  setIsLoading(true);
283364
283406
  try {
283365
283407
  const stream = cliService.sendMessage(trimmedInput);
@@ -283457,13 +283499,13 @@ function App2() {
283457
283499
  setIsLoading(false);
283458
283500
  }
283459
283501
  };
283460
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", minHeight: stdout.rows || 24, children: [
283461
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", flexGrow: 1, paddingX: 1, children: [
283462
- initializationError && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { color: "red", children: [
283502
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", minHeight: stdout.rows || 24, children: [
283503
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", flexGrow: 1, paddingX: 1, children: [
283504
+ initializationError && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { color: "red", children: [
283463
283505
  "\u274C ",
283464
283506
  initializationError
283465
283507
  ] }) }),
283466
- !initializationError && messages2.length === 0 && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
283508
+ !initializationError && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
283467
283509
  Box_default,
283468
283510
  {
283469
283511
  marginBottom: 1,
@@ -283472,64 +283514,70 @@ function App2() {
283472
283514
  borderColor: "blue",
283473
283515
  padding: 2,
283474
283516
  children: [
283475
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AsciiLogo, {}),
283476
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "gray", children: "Welcome to MCP-Use CLI!" }),
283477
- currentModel.includes("No") ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", children: [
283478
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Text, { color: "yellow", children: [
283479
- "\u26A0\uFE0F ",
283480
- currentModel
283481
- ] }),
283482
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "gray", children: "Choose a model to get started - the CLI will help you set up the API key." }),
283483
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "cyan", children: "\u{1F4A1} Try: /model openai gpt-4o-mini" }),
283484
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "gray", children: "Or use /models to see all options, /help for commands." })
283485
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", children: [
283486
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "gray", children: "Type your message and press Enter to start chatting." }),
283487
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "gray", children: "Use slash commands like /help, /model, or /status for configuration." })
283517
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(AsciiLogo, {}),
283518
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", children: "Welcome to MCP-Use CLI!" }),
283519
+ currentModel.includes("No") ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", children: [
283520
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "yellow", children: currentModel }),
283521
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", children: "Choose a model to get started - the CLI will help you set up the API key." }),
283522
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "cyan", children: "Try: /model openai gpt-4o-mini" }),
283523
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", children: "Or use /models to see all options, /help for commands." })
283524
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", children: [
283525
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", children: "Type your message and press Enter to start chatting." }),
283526
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", children: "Use slash commands like /help, /model, or /status for configuration." })
283488
283527
  ] }),
283489
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "gray", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(dist_default5, { name: "vice", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: "To support us check out https://mcp-use.com \u2764\uFE0F \u2B50" }) }) }) })
283528
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "gray", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(dist_default5, { name: "vice", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { children: "To support us check out https://mcp-use.com \u2764\uFE0F \u2B50" }) }) }) })
283490
283529
  ]
283491
283530
  }
283492
283531
  ),
283493
- !initializationError && messages2.length === 0 && isLoading && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "blue", children: "\u{1F504} Initializing MCP service..." }) }),
283494
- messages2.map((message) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MessageRenderer, { message })),
283495
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { marginRight: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { color: "blue", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Spinner_default, { type: "mcpuse" }) }) }) })
283532
+ !initializationError && messages2.length === 0 && isLoading && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "blue", children: "\u{1F504} Initializing MCP service..." }) }),
283533
+ messages2.map((message) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MessageRenderer, { message })),
283534
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginRight: 1, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { color: "blue", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Spinner_default, { type: "mcpuse" }) }) }) })
283496
283535
  ] }),
283497
- showInput && !initializationError && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { flexDirection: "column", marginTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
283498
- Box_default,
283499
- {
283500
- borderStyle: "round",
283501
- borderColor: isWaitingForApiKey ? "yellow" : isWaitingForServerConfig ? "blue" : "gray",
283502
- minHeight: 3,
283503
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "row", width: "100%", children: [
283504
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Box_default, { marginRight: 1, alignSelf: "flex-start", flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
283505
- Text,
283506
- {
283507
- color: isWaitingForApiKey ? "yellow" : isWaitingForServerConfig ? "blue" : "green",
283508
- bold: true,
283509
- children: isWaitingForApiKey ? "\u{1F511}" : isWaitingForServerConfig ? "\u{1F527}" : "\u276F"
283510
- }
283511
- ) }),
283512
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
283513
- InputPrompt,
283514
- {
283515
- value: input,
283516
- onChange: setInput,
283517
- onSubmit: handleSubmit,
283518
- onHistoryUp: handleHistoryUp,
283519
- onHistoryDown: handleHistoryDown,
283520
- placeholder: isWaitingForApiKey ? `Enter ${pendingProvider.toUpperCase()} API key...` : isWaitingForServerConfig ? "Enter server configuration..." : "Type your message...",
283521
- mask: isWaitingForApiKey ? "*" : void 0
283522
- }
283523
- )
283524
- ] })
283525
- }
283526
- ) }),
283527
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Footer, { servers: connectedServers, modelSlug: currentModel })
283536
+ showInput && !initializationError && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", marginTop: 1, children: [
283537
+ input.startsWith("/") && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
283538
+ CommandSuggestions,
283539
+ {
283540
+ suggestions: commandSuggestions,
283541
+ query: input
283542
+ }
283543
+ ),
283544
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
283545
+ Box_default,
283546
+ {
283547
+ borderStyle: "round",
283548
+ borderColor: isWaitingForApiKey ? "yellow" : isWaitingForServerConfig ? "blue" : "gray",
283549
+ minHeight: 3,
283550
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "row", width: "100%", children: [
283551
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { marginRight: 1, alignSelf: "flex-start", flexShrink: 0, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
283552
+ Text,
283553
+ {
283554
+ color: isWaitingForApiKey ? "yellow" : isWaitingForServerConfig ? "blue" : "green",
283555
+ bold: true,
283556
+ children: isWaitingForApiKey ? "\u{1F511}" : isWaitingForServerConfig ? "\u{1F527}" : "\u276F"
283557
+ }
283558
+ ) }),
283559
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
283560
+ InputPrompt,
283561
+ {
283562
+ value: input,
283563
+ onChange: setInput,
283564
+ onSubmit: handleSubmit,
283565
+ onHistoryUp: handleHistoryUp,
283566
+ onHistoryDown: handleHistoryDown,
283567
+ placeholder: isWaitingForApiKey ? `Enter ${pendingProvider.toUpperCase()} API key...` : isWaitingForServerConfig ? "Enter server configuration..." : "Type your message...",
283568
+ mask: isWaitingForApiKey ? "*" : void 0
283569
+ }
283570
+ )
283571
+ ] })
283572
+ }
283573
+ )
283574
+ ] }),
283575
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Footer, { servers: connectedServers, modelSlug: currentModel })
283528
283576
  ] });
283529
283577
  }
283530
283578
 
283531
283579
  // source/cli.tsx
283532
- var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
283580
+ var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1);
283533
283581
  meow_default(
283534
283582
  `
283535
283583
  Usage
@@ -283561,7 +283609,7 @@ meow_default(
283561
283609
  }
283562
283610
  }
283563
283611
  );
283564
- render_default(/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(App2, {}));
283612
+ render_default(/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(App2, {}));
283565
283613
  /*! Bundled license information:
283566
283614
 
283567
283615
  react/cjs/react.production.min.js:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-use/cli",
3
- "version": "1.0.10",
3
+ "version": "1.0.14",
4
4
  "license": "MIT",
5
5
  "description": "CLI for interacting with Model Context Protocol servers via natural language",
6
6
  "keywords": [