@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.
- package/dist/InputPrompt.d.ts +13 -0
- package/dist/InputPrompt.js +188 -0
- package/dist/MultilineInput.d.ts +13 -0
- package/dist/MultilineInput.js +154 -0
- package/dist/MultilineTextInput.d.ts +11 -0
- package/dist/MultilineTextInput.js +97 -0
- package/dist/PasteAwareInput.d.ts +13 -0
- package/dist/PasteAwareInput.js +183 -0
- package/dist/SimpleMultilineInput.d.ts +11 -0
- package/dist/SimpleMultilineInput.js +125 -0
- package/dist/app.d.ts +1 -5
- package/dist/app.js +291 -186
- package/dist/cli.js +2 -5
- package/dist/commands.d.ts +15 -30
- package/dist/commands.js +308 -568
- package/dist/components/AsciiLogo.d.ts +2 -0
- package/dist/components/AsciiLogo.js +7 -0
- package/dist/components/Footer.d.ts +5 -0
- package/dist/components/Footer.js +19 -0
- package/dist/components/InputPrompt.d.ts +13 -0
- package/dist/components/InputPrompt.js +188 -0
- package/dist/components/Messages.d.ts +21 -0
- package/dist/components/Messages.js +80 -0
- package/dist/components/ServerStatus.d.ts +7 -0
- package/dist/components/ServerStatus.js +36 -0
- package/dist/components/Spinner.d.ts +16 -0
- package/dist/components/Spinner.js +63 -0
- package/dist/components/ToolStatus.d.ts +8 -0
- package/dist/components/ToolStatus.js +33 -0
- package/dist/components/textInput.d.ts +1 -0
- package/dist/components/textInput.js +1 -0
- package/dist/logger.d.ts +10 -0
- package/dist/logger.js +48 -0
- package/dist/mcp-service.d.ts +5 -4
- package/dist/mcp-service.js +98 -207
- package/dist/services/agent-service.d.ts +56 -0
- package/dist/services/agent-service.js +203 -0
- package/dist/services/cli-service.d.ts +132 -0
- package/dist/services/cli-service.js +591 -0
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.js +4 -0
- package/dist/services/llm-service.d.ts +174 -0
- package/dist/services/llm-service.js +567 -0
- package/dist/services/mcp-config-service.d.ts +69 -0
- package/dist/services/mcp-config-service.js +426 -0
- package/dist/services/mcp-service.d.ts +1 -0
- package/dist/services/mcp-service.js +1 -0
- package/dist/services/utility-service.d.ts +47 -0
- package/dist/services/utility-service.js +208 -0
- package/dist/storage.js +4 -4
- package/dist/types.d.ts +30 -0
- package/dist/types.js +1 -0
- package/package.json +22 -8
- package/readme.md +68 -39
package/dist/storage.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { scryptSync, randomBytes, createCipheriv, createDecipheriv } from 'node:crypto';
|
|
1
|
+
import { scryptSync, randomBytes, createCipheriv, createDecipheriv, } from 'node:crypto';
|
|
2
2
|
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'node:fs';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
5
|
const CONFIG_DIR = join(homedir(), '.mcp-use-cli');
|
|
6
6
|
const CONFIG_FILE = join(CONFIG_DIR, 'config.json');
|
|
7
|
-
const SALT = 'mcp-use-cli-salt';
|
|
7
|
+
const SALT = 'mcp-use-cli-salt';
|
|
8
8
|
export class SecureStorage {
|
|
9
9
|
static getKey() {
|
|
10
10
|
return scryptSync('mcp-use-cli-encryption-key', SALT, 32);
|
|
@@ -65,7 +65,7 @@ export class SecureStorage {
|
|
|
65
65
|
}
|
|
66
66
|
return {
|
|
67
67
|
...parsed,
|
|
68
|
-
apiKeys: decryptedApiKeys
|
|
68
|
+
apiKeys: decryptedApiKeys,
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
catch (error) {
|
|
@@ -83,7 +83,7 @@ export class SecureStorage {
|
|
|
83
83
|
}
|
|
84
84
|
const configToSave = {
|
|
85
85
|
...config,
|
|
86
|
-
apiKeys: encryptedApiKeys
|
|
86
|
+
apiKeys: encryptedApiKeys,
|
|
87
87
|
};
|
|
88
88
|
writeFileSync(CONFIG_FILE, JSON.stringify(configToSave, null, 2), 'utf8');
|
|
89
89
|
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type CommandMessage = {
|
|
2
|
+
id: string;
|
|
3
|
+
role: 'command';
|
|
4
|
+
content: string;
|
|
5
|
+
commandResult: CommandResult;
|
|
6
|
+
timestamp: Date;
|
|
7
|
+
};
|
|
8
|
+
export interface ServerStatus {
|
|
9
|
+
name: string;
|
|
10
|
+
isConnected: boolean;
|
|
11
|
+
config: any;
|
|
12
|
+
}
|
|
13
|
+
export interface CommandResult {
|
|
14
|
+
type: 'success' | 'error' | 'info' | 'prompt_key' | 'prompt_server_config' | 'list_servers' | 'list_tools';
|
|
15
|
+
message: string;
|
|
16
|
+
data?: any;
|
|
17
|
+
}
|
|
18
|
+
export interface Message {
|
|
19
|
+
id: string;
|
|
20
|
+
role: 'user' | 'assistant' | 'thought';
|
|
21
|
+
content: string;
|
|
22
|
+
timestamp: Date;
|
|
23
|
+
}
|
|
24
|
+
export interface ToolCall {
|
|
25
|
+
id: string;
|
|
26
|
+
role: 'tool';
|
|
27
|
+
tool_name: string;
|
|
28
|
+
tool_input: Record<string, any>;
|
|
29
|
+
tool_output: Record<string, any>;
|
|
30
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-use/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A CLI tool for interacting with Model Context Protocol (MCP) servers using natural language",
|
|
6
6
|
"keywords": [
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"author": "Pietro",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "https://github.com/
|
|
17
|
+
"url": "https://github.com/mcp-use/mcp-use-cli"
|
|
18
18
|
},
|
|
19
19
|
"bin": {
|
|
20
20
|
"mcp-use": "dist/cli.js"
|
|
@@ -26,23 +26,36 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "tsc",
|
|
28
28
|
"dev": "tsc --watch",
|
|
29
|
-
"test": "prettier --check . && xo && ava"
|
|
29
|
+
"test": "prettier --check . && xo && ava",
|
|
30
|
+
"release": "np"
|
|
30
31
|
},
|
|
31
32
|
"files": [
|
|
32
33
|
"dist"
|
|
33
34
|
],
|
|
34
35
|
"dependencies": {
|
|
35
36
|
"@hey-api/client-fetch": "^0.12.0",
|
|
37
|
+
"@huggingface/inference": "^4.1.0",
|
|
36
38
|
"@langchain/anthropic": "^0.3.23",
|
|
37
|
-
"@langchain/
|
|
38
|
-
"@langchain/
|
|
39
|
+
"@langchain/cohere": "^0.3.4",
|
|
40
|
+
"@langchain/community": "^0.3.47",
|
|
41
|
+
"@langchain/core": "0.3.58",
|
|
42
|
+
"@langchain/deepseek": "^0.0.2",
|
|
43
|
+
"@langchain/google-genai": "^0.2.14",
|
|
44
|
+
"@langchain/google-vertexai": "^0.2.14",
|
|
45
|
+
"@langchain/groq": "^0.2.3",
|
|
39
46
|
"@langchain/mistralai": "^0.2.1",
|
|
40
|
-
"@langchain/
|
|
47
|
+
"@langchain/ollama": "^0.2.3",
|
|
48
|
+
"@langchain/openai": "^0.5.15",
|
|
49
|
+
"@langchain/xai": "^0.0.3",
|
|
50
|
+
"@mcp-use/cli": "^1.0.0",
|
|
51
|
+
"@modelcontextprotocol/sdk": "^1.13.2",
|
|
52
|
+
"cli-spinners": "^3.2.0",
|
|
41
53
|
"dotenv": "^16.5.0",
|
|
42
54
|
"ink": "^5.2.1",
|
|
43
55
|
"ink-big-text": "^2.0.0",
|
|
56
|
+
"ink-spinner": "^5.0.0",
|
|
44
57
|
"ink-text-input": "^6.0.0",
|
|
45
|
-
"mcp-use": "
|
|
58
|
+
"mcp-use": "file:../mcp-use-ts",
|
|
46
59
|
"meow": "^11.0.0",
|
|
47
60
|
"react": "^18.2.0",
|
|
48
61
|
"zod": "^3.25.56"
|
|
@@ -57,6 +70,7 @@
|
|
|
57
70
|
"eslint-plugin-react": "^7.32.2",
|
|
58
71
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
59
72
|
"ink-testing-library": "^3.0.0",
|
|
73
|
+
"np": "^10.0.0",
|
|
60
74
|
"prettier": "^2.8.7",
|
|
61
75
|
"ts-node": "^10.9.1",
|
|
62
76
|
"typescript": "^5.0.3",
|
|
@@ -79,4 +93,4 @@
|
|
|
79
93
|
}
|
|
80
94
|
},
|
|
81
95
|
"prettier": "@vdemedes/prettier-config"
|
|
82
|
-
}
|
|
96
|
+
}
|
package/readme.md
CHANGED
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
<img src="static/terminal.png" alt="Terminal" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
|
-
A CLI tool for interacting with Model Context Protocol (MCP) servers using natural language. Built with [mcp-use](https://github.com/mcp-use/mcp-use-ts)
|
|
5
|
+
A CLI tool for interacting with Model Context Protocol (MCP) servers using natural language. Built with [mcp-use](https://github.com/mcp-use/mcp-use-ts).
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
9
|
- 🤖 Natural language interface for MCP servers
|
|
10
|
-
- 🔧 Built-in filesystem MCP server support
|
|
11
10
|
- 💬 Interactive chat interface with tool call visualization
|
|
12
11
|
- ⚡ Direct integration with mcp-use (no API layer needed)
|
|
13
12
|
- 🚀 Single command installation
|
|
14
|
-
- 🔄 **
|
|
13
|
+
- 🔄 **Over a dozen LLM providers** (OpenAI, Anthropic, Google, Mistral, Groq, Cohere, and more)
|
|
15
14
|
- ⚙️ **Slash commands** for configuration (like Claude Code)
|
|
16
15
|
- 🔑 **Smart API key prompting** - automatically asks for keys when needed
|
|
17
16
|
- 💾 **Persistent secure storage** - encrypted keys and settings saved across sessions
|
|
@@ -19,95 +18,118 @@ A CLI tool for interacting with Model Context Protocol (MCP) servers using natur
|
|
|
19
18
|
## Install
|
|
20
19
|
|
|
21
20
|
```bash
|
|
22
|
-
$ npm install --global mcp-use
|
|
21
|
+
$ npm install --global @mcp-use/cli
|
|
23
22
|
```
|
|
24
23
|
|
|
25
24
|
## Quick Start
|
|
26
25
|
|
|
27
26
|
1. **Install and run**:
|
|
27
|
+
|
|
28
28
|
```bash
|
|
29
|
-
$ npm install --global mcp-use
|
|
30
|
-
$ mcp-use
|
|
29
|
+
$ npm install --global @mcp-use/cli
|
|
30
|
+
$ mcp-use
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
2. **Choose your model** (CLI handles API key setup automatically):
|
|
34
|
+
|
|
34
35
|
```bash
|
|
35
36
|
# Just pick a model - that's it!
|
|
36
|
-
/model openai gpt-4o
|
|
37
|
-
/model anthropic claude-3-5-sonnet-
|
|
37
|
+
/model openai gpt-4o
|
|
38
|
+
/model anthropic claude-3-5-sonnet-20240620
|
|
38
39
|
/model google gemini-1.5-pro
|
|
39
|
-
|
|
40
|
+
/model groq llama-3.1-70b-versatile
|
|
41
|
+
/model ollama llama3
|
|
42
|
+
|
|
40
43
|
# CLI will prompt: "Please enter your OPENAI API key:"
|
|
41
44
|
# Paste your key and start chatting immediately!
|
|
42
45
|
```
|
|
43
46
|
|
|
44
|
-
3. **Get API keys** when prompted from:
|
|
47
|
+
3. **Get API keys** when prompted from providers like:
|
|
45
48
|
- [OpenAI](https://platform.openai.com/api-keys)
|
|
46
|
-
- [Anthropic](https://console.anthropic.com/)
|
|
49
|
+
- [Anthropic](https://console.anthropic.com/)
|
|
47
50
|
- [Google AI](https://aistudio.google.com/app/apikey)
|
|
48
51
|
- [Mistral](https://console.mistral.ai/)
|
|
52
|
+
- [Groq](https://console.groq.com/keys)
|
|
53
|
+
- [Cohere](https://dashboard.cohere.com/api-keys)
|
|
49
54
|
|
|
50
55
|
> **Keys are stored securely encrypted** in `~/.mcp-use-cli/config.json` and persist across sessions.
|
|
51
56
|
|
|
52
57
|
## Alternative Setup
|
|
53
58
|
|
|
54
59
|
If you prefer environment variables:
|
|
60
|
+
|
|
55
61
|
```bash
|
|
56
62
|
export OPENAI_API_KEY=your_key_here
|
|
57
63
|
export ANTHROPIC_API_KEY=your_key_here
|
|
58
|
-
# Then just run: mcp-use
|
|
64
|
+
# Then just run: mcp-use
|
|
59
65
|
```
|
|
60
66
|
|
|
61
67
|
## Usage
|
|
62
68
|
|
|
63
69
|
```
|
|
64
|
-
$ mcp-use
|
|
70
|
+
$ mcp-use --help
|
|
65
71
|
|
|
66
72
|
Usage
|
|
67
|
-
$ mcp-use
|
|
73
|
+
$ mcp-use
|
|
68
74
|
|
|
69
75
|
Options
|
|
70
76
|
--name Your name (optional)
|
|
71
77
|
--config Path to MCP configuration file (optional)
|
|
72
78
|
|
|
73
79
|
Examples
|
|
74
|
-
$ mcp-use
|
|
75
|
-
$ mcp-use
|
|
76
|
-
$ mcp-use-cli --config=./mcp-config.json
|
|
80
|
+
$ mcp-use
|
|
81
|
+
$ mcp-use --name=Jane
|
|
77
82
|
|
|
78
83
|
Environment Variables
|
|
79
|
-
|
|
84
|
+
<PROVIDER>_API_KEY Set API keys (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY)
|
|
80
85
|
|
|
81
86
|
Setup
|
|
82
|
-
1.
|
|
83
|
-
2.
|
|
84
|
-
3.
|
|
87
|
+
1. Run: mcp-use
|
|
88
|
+
2. Use /model or /setkey to configure an LLM.
|
|
89
|
+
3. Use /server commands to connect to your tools.
|
|
90
|
+
4. Start chatting!
|
|
85
91
|
```
|
|
86
92
|
|
|
87
|
-
##
|
|
93
|
+
## Connecting to Tools (MCP Servers)
|
|
94
|
+
|
|
95
|
+
This CLI is a client for [Model Context Protocol (MCP)](https://github.com/mcp-use/mcp-spec) servers. MCP servers act as tools that the AI can use. You need to connect the CLI to one or more servers to give it capabilities.
|
|
96
|
+
|
|
97
|
+
You can manage servers with the `/server` commands:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Interactively add a new server configuration
|
|
101
|
+
/server add
|
|
102
|
+
|
|
103
|
+
# List configured servers
|
|
104
|
+
/servers
|
|
88
105
|
|
|
89
|
-
|
|
106
|
+
# Connect to a configured server
|
|
107
|
+
/server connect <server-name>
|
|
108
|
+
|
|
109
|
+
# Disconnect from a server
|
|
110
|
+
/server disconnect <server-name>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
When you add a server, you'll be prompted for its configuration details, such as the command to run it. Here is an example of what a server configuration for a filesystem tool looks like:
|
|
90
114
|
|
|
91
115
|
```json
|
|
92
116
|
{
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"env": {}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
117
|
+
"filesystem-tool": {
|
|
118
|
+
"command": "npx",
|
|
119
|
+
"args": [
|
|
120
|
+
"-y",
|
|
121
|
+
"@modelcontextprotocol/server-filesystem",
|
|
122
|
+
"/path/to/your/project"
|
|
123
|
+
],
|
|
124
|
+
"env": {}
|
|
125
|
+
}
|
|
105
126
|
}
|
|
106
127
|
```
|
|
128
|
+
This configuration would be created interactively by running `/server add` and answering the prompts.
|
|
107
129
|
|
|
108
130
|
## Slash Commands
|
|
109
131
|
|
|
110
|
-
Switch LLM providers and configure settings using slash commands
|
|
132
|
+
Switch LLM providers and configure settings using slash commands:
|
|
111
133
|
|
|
112
134
|
```bash
|
|
113
135
|
# Set API keys (stored securely)
|
|
@@ -117,13 +139,19 @@ Switch LLM providers and configure settings using slash commands (similar to Cla
|
|
|
117
139
|
|
|
118
140
|
# Switch models
|
|
119
141
|
/model openai gpt-4o
|
|
120
|
-
/model anthropic claude-3-5-sonnet-
|
|
142
|
+
/model anthropic claude-3-5-sonnet-20240620
|
|
121
143
|
/model google gemini-1.5-pro
|
|
122
144
|
/model mistral mistral-large-latest
|
|
145
|
+
/model groq llama-3.1-70b-versatile
|
|
123
146
|
|
|
124
147
|
# List available models
|
|
125
148
|
/models
|
|
126
|
-
|
|
149
|
+
|
|
150
|
+
# Server Management
|
|
151
|
+
/server add
|
|
152
|
+
/servers
|
|
153
|
+
/server connect <name>
|
|
154
|
+
/server disconnect <name>
|
|
127
155
|
|
|
128
156
|
# Configuration
|
|
129
157
|
/config temp 0.5
|
|
@@ -144,9 +172,10 @@ Switch LLM providers and configure settings using slash commands (similar to Cla
|
|
|
144
172
|
## Architecture
|
|
145
173
|
|
|
146
174
|
This CLI uses:
|
|
175
|
+
|
|
147
176
|
- **Frontend**: React + Ink for the terminal UI
|
|
148
177
|
- **Agent**: mcp-use MCPAgent for LLM + MCP integration
|
|
149
|
-
- **LLM**:
|
|
178
|
+
- **LLM**: Your choice of 12+ providers
|
|
150
179
|
- **Transport**: Direct TypeScript integration (no API layer)
|
|
151
180
|
|
|
152
181
|
## License
|