@mcp-use/cli 1.0.0 → 1.0.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.
Files changed (54) hide show
  1. package/dist/InputPrompt.d.ts +13 -0
  2. package/dist/InputPrompt.js +188 -0
  3. package/dist/MultilineInput.d.ts +13 -0
  4. package/dist/MultilineInput.js +154 -0
  5. package/dist/MultilineTextInput.d.ts +11 -0
  6. package/dist/MultilineTextInput.js +97 -0
  7. package/dist/PasteAwareInput.d.ts +13 -0
  8. package/dist/PasteAwareInput.js +183 -0
  9. package/dist/SimpleMultilineInput.d.ts +11 -0
  10. package/dist/SimpleMultilineInput.js +125 -0
  11. package/dist/app.d.ts +1 -5
  12. package/dist/app.js +291 -186
  13. package/dist/cli.js +2 -5
  14. package/dist/commands.d.ts +15 -30
  15. package/dist/commands.js +308 -568
  16. package/dist/components/AsciiLogo.d.ts +2 -0
  17. package/dist/components/AsciiLogo.js +7 -0
  18. package/dist/components/Footer.d.ts +5 -0
  19. package/dist/components/Footer.js +19 -0
  20. package/dist/components/InputPrompt.d.ts +13 -0
  21. package/dist/components/InputPrompt.js +188 -0
  22. package/dist/components/Messages.d.ts +21 -0
  23. package/dist/components/Messages.js +80 -0
  24. package/dist/components/ServerStatus.d.ts +7 -0
  25. package/dist/components/ServerStatus.js +36 -0
  26. package/dist/components/Spinner.d.ts +16 -0
  27. package/dist/components/Spinner.js +63 -0
  28. package/dist/components/ToolStatus.d.ts +8 -0
  29. package/dist/components/ToolStatus.js +33 -0
  30. package/dist/components/textInput.d.ts +1 -0
  31. package/dist/components/textInput.js +1 -0
  32. package/dist/logger.d.ts +10 -0
  33. package/dist/logger.js +48 -0
  34. package/dist/mcp-service.d.ts +5 -4
  35. package/dist/mcp-service.js +98 -207
  36. package/dist/services/agent-service.d.ts +56 -0
  37. package/dist/services/agent-service.js +203 -0
  38. package/dist/services/cli-service.d.ts +132 -0
  39. package/dist/services/cli-service.js +591 -0
  40. package/dist/services/index.d.ts +4 -0
  41. package/dist/services/index.js +4 -0
  42. package/dist/services/llm-service.d.ts +174 -0
  43. package/dist/services/llm-service.js +567 -0
  44. package/dist/services/mcp-config-service.d.ts +69 -0
  45. package/dist/services/mcp-config-service.js +426 -0
  46. package/dist/services/mcp-service.d.ts +1 -0
  47. package/dist/services/mcp-service.js +1 -0
  48. package/dist/services/utility-service.d.ts +47 -0
  49. package/dist/services/utility-service.js +208 -0
  50. package/dist/storage.js +4 -4
  51. package/dist/types.d.ts +30 -0
  52. package/dist/types.js +1 -0
  53. package/package.json +22 -8
  54. package/readme.md +68 -39
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface SimpleMultilineInputProps {
3
+ value: string;
4
+ onChange: (value: string) => void;
5
+ onSubmit: (value: string) => void;
6
+ placeholder?: string;
7
+ mask?: string;
8
+ focus?: boolean;
9
+ }
10
+ export declare const SimpleMultilineInput: React.FC<SimpleMultilineInputProps>;
11
+ export {};
@@ -0,0 +1,125 @@
1
+ import React, { useState, useEffect, useCallback } from 'react';
2
+ import { Box, Text, useInput } from 'ink';
3
+ export const SimpleMultilineInput = ({ value, onChange, onSubmit, placeholder = '', mask, focus = true }) => {
4
+ const [cursorPosition, setCursorPosition] = useState(value.length);
5
+ const [lines, setLines] = useState([]);
6
+ // Update lines when value changes
7
+ useEffect(() => {
8
+ const newLines = value.split('\n');
9
+ setLines(newLines);
10
+ setCursorPosition(value.length);
11
+ }, [value]);
12
+ // Calculate cursor position in 2D space
13
+ const getCursorCoords = useCallback(() => {
14
+ let pos = 0;
15
+ for (let row = 0; row < lines.length; row++) {
16
+ const lineLength = lines[row]?.length || 0;
17
+ if (pos + lineLength >= cursorPosition) {
18
+ return [row, cursorPosition - pos];
19
+ }
20
+ pos += lineLength + 1; // +1 for newline
21
+ }
22
+ return [lines.length - 1, lines[lines.length - 1]?.length || 0];
23
+ }, [lines, cursorPosition]);
24
+ useInput((input, key) => {
25
+ if (!focus)
26
+ return;
27
+ // Submit on Enter
28
+ if (key.return && !key.ctrl && !key.meta) {
29
+ onSubmit(value);
30
+ return;
31
+ }
32
+ // New line on Ctrl+Enter or Meta+Enter
33
+ if (key.return && (key.ctrl || key.meta)) {
34
+ const beforeCursor = value.slice(0, cursorPosition);
35
+ const afterCursor = value.slice(cursorPosition);
36
+ onChange(beforeCursor + '\n' + afterCursor);
37
+ setCursorPosition(cursorPosition + 1);
38
+ return;
39
+ }
40
+ // Backspace
41
+ if (key.backspace || key.delete) {
42
+ if (cursorPosition > 0) {
43
+ const beforeCursor = value.slice(0, cursorPosition - 1);
44
+ const afterCursor = value.slice(cursorPosition);
45
+ onChange(beforeCursor + afterCursor);
46
+ setCursorPosition(cursorPosition - 1);
47
+ }
48
+ return;
49
+ }
50
+ // Left arrow
51
+ if (key.leftArrow) {
52
+ setCursorPosition(Math.max(0, cursorPosition - 1));
53
+ return;
54
+ }
55
+ // Right arrow
56
+ if (key.rightArrow) {
57
+ setCursorPosition(Math.min(value.length, cursorPosition + 1));
58
+ return;
59
+ }
60
+ // Up arrow - move cursor up
61
+ if (key.upArrow) {
62
+ const [row, col] = getCursorCoords();
63
+ if (row > 0) {
64
+ const prevLineLength = lines[row - 1]?.length || 0;
65
+ const newCol = Math.min(col, prevLineLength);
66
+ let newPos = 0;
67
+ for (let i = 0; i < row - 1; i++) {
68
+ newPos += (lines[i]?.length || 0) + 1;
69
+ }
70
+ newPos += newCol;
71
+ setCursorPosition(newPos);
72
+ }
73
+ return;
74
+ }
75
+ // Down arrow - move cursor down
76
+ if (key.downArrow) {
77
+ const [row, col] = getCursorCoords();
78
+ if (row < lines.length - 1) {
79
+ const nextLineLength = lines[row + 1]?.length || 0;
80
+ const newCol = Math.min(col, nextLineLength);
81
+ let newPos = 0;
82
+ for (let i = 0; i <= row; i++) {
83
+ newPos += (lines[i]?.length || 0) + 1;
84
+ }
85
+ newPos += newCol;
86
+ setCursorPosition(newPos);
87
+ }
88
+ return;
89
+ }
90
+ // Regular character input
91
+ if (input && !key.ctrl && !key.meta) {
92
+ const beforeCursor = value.slice(0, cursorPosition);
93
+ const afterCursor = value.slice(cursorPosition);
94
+ onChange(beforeCursor + input + afterCursor);
95
+ setCursorPosition(cursorPosition + input.length);
96
+ }
97
+ });
98
+ // Render the input
99
+ const renderContent = () => {
100
+ if (!value && placeholder && !focus) {
101
+ return React.createElement(Text, { dimColor: true }, placeholder);
102
+ }
103
+ const [cursorRow, cursorCol] = getCursorCoords();
104
+ return lines.map((line, row) => {
105
+ let displayLine = mask ? line.replace(/./g, mask) : line;
106
+ // Add cursor to the current line
107
+ if (row === cursorRow && focus) {
108
+ const before = displayLine.slice(0, cursorCol);
109
+ const at = displayLine[cursorCol] || ' ';
110
+ const after = displayLine.slice(cursorCol + 1);
111
+ return (React.createElement(Box, { key: row },
112
+ React.createElement(Text, null,
113
+ before,
114
+ React.createElement(Text, { inverse: true }, at),
115
+ after)));
116
+ }
117
+ return React.createElement(Box, { key: row },
118
+ React.createElement(Text, null, displayLine || ' '));
119
+ });
120
+ };
121
+ return (React.createElement(Box, { flexDirection: "column", flexGrow: 1 },
122
+ renderContent(),
123
+ focus && lines.length > 1 && (React.createElement(Box, { marginTop: 1 },
124
+ React.createElement(Text, { dimColor: true, italic: true }, "Ctrl+Enter for new line, Enter to submit")))));
125
+ };
package/dist/app.d.ts CHANGED
@@ -1,6 +1,2 @@
1
1
  import React from 'react';
2
- type Props = {
3
- name?: string;
4
- };
5
- export default function App({ name }: Props): React.JSX.Element;
6
- export {};
2
+ export default function App(): React.JSX.Element;