mcp-use 1.3.12__py3-none-any.whl → 1.4.0__py3-none-any.whl
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.
Potentially problematic release.
This version of mcp-use might be problematic. Click here for more details.
- mcp_use/__init__.py +1 -1
- mcp_use/adapters/.deprecated +0 -0
- mcp_use/adapters/__init__.py +18 -7
- mcp_use/adapters/base.py +12 -185
- mcp_use/adapters/langchain_adapter.py +12 -219
- mcp_use/agents/adapters/__init__.py +17 -0
- mcp_use/agents/adapters/anthropic.py +93 -0
- mcp_use/agents/adapters/base.py +316 -0
- mcp_use/agents/adapters/google.py +103 -0
- mcp_use/agents/adapters/langchain_adapter.py +212 -0
- mcp_use/agents/adapters/openai.py +111 -0
- mcp_use/agents/base.py +1 -1
- mcp_use/agents/managers/__init__.py +19 -0
- mcp_use/agents/managers/base.py +36 -0
- mcp_use/agents/managers/server_manager.py +131 -0
- mcp_use/agents/managers/tools/__init__.py +15 -0
- mcp_use/agents/managers/tools/base_tool.py +19 -0
- mcp_use/agents/managers/tools/connect_server.py +69 -0
- mcp_use/agents/managers/tools/disconnect_server.py +43 -0
- mcp_use/agents/managers/tools/get_active_server.py +29 -0
- mcp_use/agents/managers/tools/list_servers_tool.py +53 -0
- mcp_use/agents/managers/tools/search_tools.py +328 -0
- mcp_use/agents/mcpagent.py +386 -485
- mcp_use/agents/prompts/system_prompt_builder.py +1 -1
- mcp_use/agents/remote.py +15 -2
- mcp_use/auth/.deprecated +0 -0
- mcp_use/auth/__init__.py +19 -4
- mcp_use/auth/bearer.py +11 -12
- mcp_use/auth/oauth.py +11 -620
- mcp_use/auth/oauth_callback.py +16 -207
- mcp_use/client/__init__.py +1 -0
- mcp_use/client/auth/__init__.py +6 -0
- mcp_use/client/auth/bearer.py +23 -0
- mcp_use/client/auth/oauth.py +629 -0
- mcp_use/client/auth/oauth_callback.py +215 -0
- mcp_use/client/client.py +356 -0
- mcp_use/client/config.py +106 -0
- mcp_use/client/connectors/__init__.py +20 -0
- mcp_use/client/connectors/base.py +470 -0
- mcp_use/client/connectors/http.py +304 -0
- mcp_use/client/connectors/sandbox.py +332 -0
- mcp_use/client/connectors/stdio.py +109 -0
- mcp_use/client/connectors/utils.py +13 -0
- mcp_use/client/connectors/websocket.py +257 -0
- mcp_use/client/exceptions.py +31 -0
- mcp_use/client/middleware/__init__.py +50 -0
- mcp_use/client/middleware/logging.py +31 -0
- mcp_use/client/middleware/metrics.py +314 -0
- mcp_use/client/middleware/middleware.py +266 -0
- mcp_use/client/session.py +162 -0
- mcp_use/client/task_managers/__init__.py +20 -0
- mcp_use/client/task_managers/base.py +145 -0
- mcp_use/client/task_managers/sse.py +84 -0
- mcp_use/client/task_managers/stdio.py +69 -0
- mcp_use/client/task_managers/streamable_http.py +86 -0
- mcp_use/client/task_managers/websocket.py +68 -0
- mcp_use/client.py +12 -344
- mcp_use/config.py +20 -97
- mcp_use/connectors/.deprecated +0 -0
- mcp_use/connectors/__init__.py +46 -20
- mcp_use/connectors/base.py +12 -455
- mcp_use/connectors/http.py +13 -300
- mcp_use/connectors/sandbox.py +13 -306
- mcp_use/connectors/stdio.py +13 -104
- mcp_use/connectors/utils.py +15 -8
- mcp_use/connectors/websocket.py +13 -252
- mcp_use/exceptions.py +33 -18
- mcp_use/logging.py +1 -1
- mcp_use/managers/.deprecated +0 -0
- mcp_use/managers/__init__.py +56 -17
- mcp_use/managers/base.py +13 -31
- mcp_use/managers/server_manager.py +13 -119
- mcp_use/managers/tools/__init__.py +45 -15
- mcp_use/managers/tools/base_tool.py +5 -16
- mcp_use/managers/tools/connect_server.py +5 -67
- mcp_use/managers/tools/disconnect_server.py +5 -41
- mcp_use/managers/tools/get_active_server.py +5 -26
- mcp_use/managers/tools/list_servers_tool.py +5 -51
- mcp_use/managers/tools/search_tools.py +17 -321
- mcp_use/middleware/.deprecated +0 -0
- mcp_use/middleware/__init__.py +89 -50
- mcp_use/middleware/logging.py +14 -26
- mcp_use/middleware/metrics.py +30 -303
- mcp_use/middleware/middleware.py +39 -246
- mcp_use/session.py +13 -149
- mcp_use/task_managers/.deprecated +0 -0
- mcp_use/task_managers/__init__.py +48 -20
- mcp_use/task_managers/base.py +13 -140
- mcp_use/task_managers/sse.py +13 -79
- mcp_use/task_managers/stdio.py +13 -64
- mcp_use/task_managers/streamable_http.py +15 -81
- mcp_use/task_managers/websocket.py +13 -63
- mcp_use/telemetry/events.py +58 -0
- mcp_use/telemetry/telemetry.py +71 -1
- mcp_use/telemetry/utils.py +1 -1
- mcp_use/types/.deprecated +0 -0
- mcp_use/types/sandbox.py +13 -18
- {mcp_use-1.3.12.dist-info → mcp_use-1.4.0.dist-info}/METADATA +68 -43
- mcp_use-1.4.0.dist-info/RECORD +111 -0
- mcp_use/cli.py +0 -581
- mcp_use-1.3.12.dist-info/RECORD +0 -64
- mcp_use-1.3.12.dist-info/licenses/LICENSE +0 -21
- /mcp_use/{observability → agents/observability}/__init__.py +0 -0
- /mcp_use/{observability → agents/observability}/callbacks_manager.py +0 -0
- /mcp_use/{observability → agents/observability}/laminar.py +0 -0
- /mcp_use/{observability → agents/observability}/langfuse.py +0 -0
- {mcp_use-1.3.12.dist-info → mcp_use-1.4.0.dist-info}/WHEEL +0 -0
- {mcp_use-1.3.12.dist-info → mcp_use-1.4.0.dist-info}/entry_points.txt +0 -0
mcp_use/cli.py
DELETED
|
@@ -1,581 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
"""
|
|
3
|
-
MCP-Use CLI Tool - All-in-one CLI for creating and deploying MCP projects.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
import argparse
|
|
7
|
-
import sys
|
|
8
|
-
import threading
|
|
9
|
-
import time
|
|
10
|
-
from pathlib import Path
|
|
11
|
-
|
|
12
|
-
from mcp_use import __version__
|
|
13
|
-
|
|
14
|
-
# ============= SPINNER CLASS =============
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class Spinner:
|
|
18
|
-
"""Simple loading spinner similar to UV's style."""
|
|
19
|
-
|
|
20
|
-
def __init__(self, message: str = "Loading"):
|
|
21
|
-
self.message = message
|
|
22
|
-
self.running = False
|
|
23
|
-
self.thread = None
|
|
24
|
-
self.frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
|
|
25
|
-
self.current = 0
|
|
26
|
-
|
|
27
|
-
def start(self):
|
|
28
|
-
"""Start the spinner."""
|
|
29
|
-
self.running = True
|
|
30
|
-
self.thread = threading.Thread(target=self._spin)
|
|
31
|
-
self.thread.daemon = True
|
|
32
|
-
self.thread.start()
|
|
33
|
-
|
|
34
|
-
def _spin(self):
|
|
35
|
-
"""Spin animation loop."""
|
|
36
|
-
while self.running:
|
|
37
|
-
frame = self.frames[self.current % len(self.frames)]
|
|
38
|
-
print(f"\r{frame} {self.message}...", end="", flush=True)
|
|
39
|
-
self.current += 1
|
|
40
|
-
time.sleep(0.1)
|
|
41
|
-
|
|
42
|
-
def stop(self, success_message=None):
|
|
43
|
-
"""Stop the spinner and optionally print success message."""
|
|
44
|
-
self.running = False
|
|
45
|
-
if self.thread:
|
|
46
|
-
self.thread.join()
|
|
47
|
-
if success_message:
|
|
48
|
-
print(f"\r✓ {success_message} ")
|
|
49
|
-
else:
|
|
50
|
-
print("\r" + " " * (len(self.message) + 10), end="\r")
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
# ============= PROJECT CREATION FUNCTIONS =============
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def print_header():
|
|
57
|
-
"""Print the CLI header."""
|
|
58
|
-
print("\n mcp-use create")
|
|
59
|
-
print("━" * 50)
|
|
60
|
-
print()
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def get_project_name() -> str:
|
|
64
|
-
"""Get project name from user."""
|
|
65
|
-
while True:
|
|
66
|
-
name = input("📝 Project name: ").strip().replace("-", "_")
|
|
67
|
-
if not name:
|
|
68
|
-
print(" ⚠️ Project name cannot be empty")
|
|
69
|
-
continue
|
|
70
|
-
if " " in name:
|
|
71
|
-
print(" ⚠️ Project name cannot contain spaces")
|
|
72
|
-
continue
|
|
73
|
-
if Path(name).exists():
|
|
74
|
-
print(f" ⚠️ Directory '{name}' already exists")
|
|
75
|
-
continue
|
|
76
|
-
return name
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
def get_project_type() -> str:
|
|
80
|
-
"""Get project type from user."""
|
|
81
|
-
print("\n📦 What would you like to create?")
|
|
82
|
-
print(" 1) Server + Agent")
|
|
83
|
-
print(" 2) Server only")
|
|
84
|
-
print(" 3) Agent only")
|
|
85
|
-
|
|
86
|
-
while True:
|
|
87
|
-
choice = input("\n Choice (1-3): ").strip()
|
|
88
|
-
if choice == "1":
|
|
89
|
-
return "server_agent"
|
|
90
|
-
elif choice == "2":
|
|
91
|
-
return "server"
|
|
92
|
-
elif choice == "3":
|
|
93
|
-
return "agent"
|
|
94
|
-
else:
|
|
95
|
-
print(" ⚠️ Please enter 1, 2, or 3")
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def create_server_structure(project_dir: Path, project_name: str):
|
|
99
|
-
"""Create server file in nested project folder."""
|
|
100
|
-
# Create nested project folder
|
|
101
|
-
nested_dir = project_dir / project_name
|
|
102
|
-
nested_dir.mkdir(parents=True)
|
|
103
|
-
|
|
104
|
-
# Create server.py
|
|
105
|
-
server_content = f'''"""
|
|
106
|
-
MCP Server for {project_name}
|
|
107
|
-
"""
|
|
108
|
-
|
|
109
|
-
from mcp.server import FastMCP
|
|
110
|
-
|
|
111
|
-
# Create server instance
|
|
112
|
-
server = FastMCP("{project_name}-server")
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
# ============= TOOLS =============
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@server.tool()
|
|
119
|
-
async def add_numbers(a: float, b: float) -> str:
|
|
120
|
-
"""Add two numbers together."""
|
|
121
|
-
result = a + b
|
|
122
|
-
return f"{{result}}"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
# ============= RESOURCES =============
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
@server.resource("config://app")
|
|
129
|
-
async def get_app_config() -> str:
|
|
130
|
-
"""Get the application configuration."""
|
|
131
|
-
return "App: {project_name}, Version: 0.1.0, Status: Active"
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
# ============= PROMPTS =============
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
@server.prompt()
|
|
138
|
-
async def assistant_prompt() -> str:
|
|
139
|
-
"""Generate a helpful assistant prompt."""
|
|
140
|
-
return "You are a helpful assistant for {project_name}. Be concise and friendly."
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
# ============= MAIN =============
|
|
144
|
-
|
|
145
|
-
if __name__ == "__main__":
|
|
146
|
-
server.run("stdio")
|
|
147
|
-
'''
|
|
148
|
-
(nested_dir / "server.py").write_text(server_content)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
def create_agent_structure(project_dir: Path, project_name: str, project_type: str):
|
|
152
|
-
"""Create agent file in nested project folder."""
|
|
153
|
-
# Create nested project folder if it doesn't exist
|
|
154
|
-
nested_dir = project_dir / project_name
|
|
155
|
-
if not nested_dir.exists():
|
|
156
|
-
nested_dir.mkdir(parents=True)
|
|
157
|
-
|
|
158
|
-
if project_type == "server_agent":
|
|
159
|
-
# For server_agent mode, embed config directly in agent.py
|
|
160
|
-
agent_content = f'''"""
|
|
161
|
-
MCP Agent implementation for {project_name}
|
|
162
|
-
"""
|
|
163
|
-
|
|
164
|
-
from langchain_openai import ChatOpenAI
|
|
165
|
-
|
|
166
|
-
from mcp_use import MCPAgent, MCPClient
|
|
167
|
-
|
|
168
|
-
config = {{
|
|
169
|
-
"mcpServers": {{
|
|
170
|
-
"{project_name}": {{
|
|
171
|
-
"command": "python",
|
|
172
|
-
"args": ["{project_name}/server.py"],
|
|
173
|
-
}}
|
|
174
|
-
}}
|
|
175
|
-
}}
|
|
176
|
-
|
|
177
|
-
client = MCPClient(config=config)
|
|
178
|
-
agent = MCPAgent(llm=ChatOpenAI(model="gpt-4o"), client=client, max_steps=10, memory_enabled=True)
|
|
179
|
-
'''
|
|
180
|
-
else:
|
|
181
|
-
# For agent-only mode, use external JSON config file
|
|
182
|
-
agent_content = f'''"""
|
|
183
|
-
MCP Agent implementation for {project_name}
|
|
184
|
-
"""
|
|
185
|
-
|
|
186
|
-
from langchain_openai import ChatOpenAI
|
|
187
|
-
|
|
188
|
-
from mcp_use import MCPAgent, MCPClient
|
|
189
|
-
|
|
190
|
-
client = MCPClient.from_config_file("{project_name}/mcp_servers.json")
|
|
191
|
-
agent = MCPAgent(llm=ChatOpenAI(model="gpt-4o"), client=client, max_steps=10, memory_enabled=True)
|
|
192
|
-
'''
|
|
193
|
-
# Create mcp_servers.json for agent-only mode
|
|
194
|
-
mcp_servers_json = (
|
|
195
|
-
'''{
|
|
196
|
-
"mcpServers": {
|
|
197
|
-
"'''
|
|
198
|
-
+ project_name
|
|
199
|
-
+ """": {
|
|
200
|
-
"command": "npx",
|
|
201
|
-
"args": ["-y", "@modelcontextprotocol/server-everything"]
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}"""
|
|
205
|
-
)
|
|
206
|
-
(nested_dir / "mcp_servers.json").write_text(mcp_servers_json)
|
|
207
|
-
|
|
208
|
-
(nested_dir / "agent.py").write_text(agent_content)
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
def create_common_files(project_dir: Path, project_name: str, project_type: str):
|
|
212
|
-
"""Create common project files."""
|
|
213
|
-
|
|
214
|
-
# pyproject.toml
|
|
215
|
-
pyproject = f"""[project]
|
|
216
|
-
name = "{project_name}"
|
|
217
|
-
version = "0.1.0"
|
|
218
|
-
description = "An MCP project"
|
|
219
|
-
requires-python = ">=3.10"
|
|
220
|
-
dependencies = [
|
|
221
|
-
"mcp>=1.0.0",
|
|
222
|
-
"mcp-use>=0.1.0",
|
|
223
|
-
"langchain-openai>=0.1.0",
|
|
224
|
-
"python-dotenv>=1.0.0",
|
|
225
|
-
]
|
|
226
|
-
"""
|
|
227
|
-
(project_dir / "pyproject.toml").write_text(pyproject)
|
|
228
|
-
|
|
229
|
-
# requirements.txt
|
|
230
|
-
requirements = """mcp>=1.0.0
|
|
231
|
-
mcp-use>=0.1.0
|
|
232
|
-
langchain-openai>=0.1.0
|
|
233
|
-
python-dotenv>=1.0.0
|
|
234
|
-
"""
|
|
235
|
-
(project_dir / "requirements.txt").write_text(requirements)
|
|
236
|
-
|
|
237
|
-
# .gitignore
|
|
238
|
-
gitignore = """__pycache__/
|
|
239
|
-
*.py[cod]
|
|
240
|
-
.env
|
|
241
|
-
venv/
|
|
242
|
-
.venv/
|
|
243
|
-
*.egg-info/
|
|
244
|
-
dist/
|
|
245
|
-
build/
|
|
246
|
-
.pytest_cache/
|
|
247
|
-
.coverage
|
|
248
|
-
"""
|
|
249
|
-
(project_dir / ".gitignore").write_text(gitignore)
|
|
250
|
-
|
|
251
|
-
# README.md
|
|
252
|
-
readme = f"""# {project_name}
|
|
253
|
-
|
|
254
|
-
An MCP project created with mcp-use.
|
|
255
|
-
|
|
256
|
-
## Project Structure
|
|
257
|
-
|
|
258
|
-
```
|
|
259
|
-
{project_name}/
|
|
260
|
-
"""
|
|
261
|
-
|
|
262
|
-
if project_type in ["server_agent", "server"]:
|
|
263
|
-
readme += f"""├── {project_name}/
|
|
264
|
-
│ ├── server.py # MCP server with all components
|
|
265
|
-
"""
|
|
266
|
-
|
|
267
|
-
if project_type in ["server_agent", "agent"]:
|
|
268
|
-
if project_type == "agent":
|
|
269
|
-
readme += f"""├── {project_name}/
|
|
270
|
-
│ ├── agent.py # MCP agent implementation
|
|
271
|
-
│ └── mcp_servers.json # Server configuration
|
|
272
|
-
"""
|
|
273
|
-
else:
|
|
274
|
-
readme += """│ └── agent.py # MCP agent implementation
|
|
275
|
-
"""
|
|
276
|
-
|
|
277
|
-
if project_type in ["server_agent", "agent"]:
|
|
278
|
-
readme += """├── run.py # Simple example
|
|
279
|
-
├── chat.py # Interactive chat
|
|
280
|
-
"""
|
|
281
|
-
|
|
282
|
-
readme += """├── pyproject.toml
|
|
283
|
-
├── requirements.txt
|
|
284
|
-
├── .gitignore
|
|
285
|
-
└── README.md
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
## Setup
|
|
289
|
-
|
|
290
|
-
1. Install dependencies:
|
|
291
|
-
```bash
|
|
292
|
-
pip install -r requirements.txt
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
2. Configure environment:
|
|
296
|
-
```bash
|
|
297
|
-
export OPENAI_API_KEY=your-api-key-here
|
|
298
|
-
```
|
|
299
|
-
"""
|
|
300
|
-
|
|
301
|
-
if project_type in ["server_agent", "server"]:
|
|
302
|
-
readme += f"""
|
|
303
|
-
## Running the Server
|
|
304
|
-
|
|
305
|
-
```bash
|
|
306
|
-
python {project_name}/server.py
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
The server uses FastMCP and includes:
|
|
310
|
-
- **Tools**: Simple tool functions (e.g., add_numbers)
|
|
311
|
-
- **Resources**: Data resources (e.g., config)
|
|
312
|
-
- **Prompts**: Prompt templates for the LLM
|
|
313
|
-
"""
|
|
314
|
-
|
|
315
|
-
if project_type in ["server_agent", "agent"]:
|
|
316
|
-
readme += f"""
|
|
317
|
-
## Using the Agent
|
|
318
|
-
|
|
319
|
-
```python
|
|
320
|
-
from {project_name}.agent import agent
|
|
321
|
-
|
|
322
|
-
result = await agent.run("Your prompt")
|
|
323
|
-
```
|
|
324
|
-
"""
|
|
325
|
-
|
|
326
|
-
(project_dir / "README.md").write_text(readme)
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
def create_example_files(project_dir: Path, project_name: str):
|
|
330
|
-
"""Create example files."""
|
|
331
|
-
|
|
332
|
-
# run.py
|
|
333
|
-
run_content = f'''"""
|
|
334
|
-
Example usage of {project_name}.
|
|
335
|
-
"""
|
|
336
|
-
|
|
337
|
-
import asyncio
|
|
338
|
-
import os
|
|
339
|
-
|
|
340
|
-
from dotenv import load_dotenv
|
|
341
|
-
|
|
342
|
-
from {project_name}.agent import agent
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
async def main():
|
|
346
|
-
load_dotenv()
|
|
347
|
-
|
|
348
|
-
if not os.getenv("OPENAI_API_KEY"):
|
|
349
|
-
print("Error: OPENAI_API_KEY not found")
|
|
350
|
-
return
|
|
351
|
-
|
|
352
|
-
result = await agent.run("What tools are available?")
|
|
353
|
-
print(f"Result: {{result}}")
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
if __name__ == "__main__":
|
|
357
|
-
asyncio.run(main())
|
|
358
|
-
'''
|
|
359
|
-
(project_dir / "run.py").write_text(run_content)
|
|
360
|
-
|
|
361
|
-
# chat.py
|
|
362
|
-
chat_content = f'''"""
|
|
363
|
-
Interactive chat for {project_name}.
|
|
364
|
-
"""
|
|
365
|
-
|
|
366
|
-
import asyncio
|
|
367
|
-
import os
|
|
368
|
-
|
|
369
|
-
from dotenv import load_dotenv
|
|
370
|
-
|
|
371
|
-
from {project_name}.agent import agent
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
async def chat():
|
|
375
|
-
load_dotenv()
|
|
376
|
-
|
|
377
|
-
if not os.getenv("OPENAI_API_KEY"):
|
|
378
|
-
print("Error: OPENAI_API_KEY not found")
|
|
379
|
-
return
|
|
380
|
-
|
|
381
|
-
print("Chat started (type 'exit' to quit)")
|
|
382
|
-
|
|
383
|
-
while True:
|
|
384
|
-
user_input = input("\\nYou: ")
|
|
385
|
-
if user_input.lower() == "exit":
|
|
386
|
-
break
|
|
387
|
-
|
|
388
|
-
print("Assistant: ", end="", flush=True)
|
|
389
|
-
response = await agent.run(user_input)
|
|
390
|
-
print(response)
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if __name__ == "__main__":
|
|
394
|
-
asyncio.run(chat())
|
|
395
|
-
'''
|
|
396
|
-
(project_dir / "chat.py").write_text(chat_content)
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
def create_project(project_name: str, project_type: str) -> bool:
|
|
400
|
-
"""Create the project structure."""
|
|
401
|
-
project_dir = Path.cwd() / project_name
|
|
402
|
-
|
|
403
|
-
try:
|
|
404
|
-
# Create main directory
|
|
405
|
-
spinner = Spinner("Creating project directory")
|
|
406
|
-
spinner.start()
|
|
407
|
-
time.sleep(0.5) # Simulate work
|
|
408
|
-
project_dir.mkdir(parents=True)
|
|
409
|
-
spinner.stop("Created project directory")
|
|
410
|
-
|
|
411
|
-
# Create server if needed
|
|
412
|
-
if project_type in ["server_agent", "server"]:
|
|
413
|
-
spinner = Spinner("Creating server")
|
|
414
|
-
spinner.start()
|
|
415
|
-
time.sleep(0.3)
|
|
416
|
-
create_server_structure(project_dir, project_name)
|
|
417
|
-
spinner.stop("Created server structure")
|
|
418
|
-
|
|
419
|
-
# Create agent if needed
|
|
420
|
-
if project_type in ["server_agent", "agent"]:
|
|
421
|
-
spinner = Spinner("Creating agent")
|
|
422
|
-
spinner.start()
|
|
423
|
-
time.sleep(0.3)
|
|
424
|
-
create_agent_structure(project_dir, project_name, project_type)
|
|
425
|
-
spinner.stop("Created agent structure")
|
|
426
|
-
|
|
427
|
-
# Create common files
|
|
428
|
-
spinner = Spinner("Creating configuration files")
|
|
429
|
-
spinner.start()
|
|
430
|
-
time.sleep(0.3)
|
|
431
|
-
create_common_files(project_dir, project_name, project_type)
|
|
432
|
-
spinner.stop("Created configuration files")
|
|
433
|
-
|
|
434
|
-
# Create examples for server_agent and agent
|
|
435
|
-
if project_type in ["server_agent", "agent"]:
|
|
436
|
-
spinner = Spinner("Creating example files")
|
|
437
|
-
spinner.start()
|
|
438
|
-
time.sleep(0.3)
|
|
439
|
-
create_example_files(project_dir, project_name)
|
|
440
|
-
spinner.stop("Created example files")
|
|
441
|
-
|
|
442
|
-
return True
|
|
443
|
-
|
|
444
|
-
except Exception as e:
|
|
445
|
-
print(f"\n❌ Error: {str(e)}")
|
|
446
|
-
return False
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
# ============= MAIN CLI FUNCTIONS =============
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
def show_help():
|
|
453
|
-
"""Show the main help message."""
|
|
454
|
-
help_text = """
|
|
455
|
-
╔══════════════════════════════════════════════════════════════════╗
|
|
456
|
-
║ MCP-Use CLI Tool ║
|
|
457
|
-
║ ║
|
|
458
|
-
║ Create and deploy MCP servers and agents with ease ║
|
|
459
|
-
╚══════════════════════════════════════════════════════════════════╝
|
|
460
|
-
|
|
461
|
-
Usage: uvx mcp-use <command> [options]
|
|
462
|
-
|
|
463
|
-
Available Commands:
|
|
464
|
-
create 🚀 Create a new MCP project (server, agent, or both)
|
|
465
|
-
Interactive wizard to scaffold your MCP project
|
|
466
|
-
|
|
467
|
-
deploy ☁️ Deploy your MCP project to the cloud
|
|
468
|
-
(Coming soon - Cloud deployment from CLI)
|
|
469
|
-
|
|
470
|
-
Examples:
|
|
471
|
-
uvx mcp-use create # Start interactive project creation
|
|
472
|
-
uvx mcp-use deploy # Deploy to cloud (coming soon)
|
|
473
|
-
uvx mcp-use --help # Show this help message
|
|
474
|
-
uvx mcp-use --version # Show version information
|
|
475
|
-
|
|
476
|
-
For more information, visit: https://mcp-use.com
|
|
477
|
-
"""
|
|
478
|
-
print(help_text)
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
def handle_create():
|
|
482
|
-
"""Handle the create command."""
|
|
483
|
-
print_header()
|
|
484
|
-
|
|
485
|
-
# Get project configuration
|
|
486
|
-
project_name = get_project_name()
|
|
487
|
-
project_type = get_project_type()
|
|
488
|
-
|
|
489
|
-
print(f"\n⚙️ Creating {project_type.replace('_', ' + ')} project: {project_name}")
|
|
490
|
-
print()
|
|
491
|
-
|
|
492
|
-
# Create the project
|
|
493
|
-
if create_project(project_name, project_type):
|
|
494
|
-
print(f"\n✨ Successfully created '{project_name}'!")
|
|
495
|
-
print("\n📋 Next steps:")
|
|
496
|
-
print(f" cd {project_name}")
|
|
497
|
-
print(" pip install -r requirements.txt")
|
|
498
|
-
print(" export OPENAI_API_KEY=your-api-key-here")
|
|
499
|
-
|
|
500
|
-
if project_type in ["server_agent", "server"]:
|
|
501
|
-
print("\n # Test the server:")
|
|
502
|
-
print(f" python {project_name}/server.py")
|
|
503
|
-
|
|
504
|
-
if project_type in ["server_agent", "agent"]:
|
|
505
|
-
print("\n # Run examples:")
|
|
506
|
-
print(" python run.py # Simple example")
|
|
507
|
-
print(" python chat.py # Interactive chat")
|
|
508
|
-
|
|
509
|
-
print()
|
|
510
|
-
else:
|
|
511
|
-
sys.exit(1)
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
def handle_deploy():
|
|
515
|
-
"""Handle the deploy command (placeholder for future implementation)."""
|
|
516
|
-
print("\n" + "=" * 60)
|
|
517
|
-
print("🚀 MCP Cloud Deployment")
|
|
518
|
-
print("=" * 60)
|
|
519
|
-
|
|
520
|
-
print("\n📝 Please login to MCP Cloud to continue...")
|
|
521
|
-
print(" Visit: https://cloud.mcp-use.com/login")
|
|
522
|
-
print()
|
|
523
|
-
|
|
524
|
-
# Simulate login prompt
|
|
525
|
-
print("Enter your MCP Cloud credentials:")
|
|
526
|
-
email = input("Email: ")
|
|
527
|
-
|
|
528
|
-
if email:
|
|
529
|
-
print(f"\n✨ Welcome {email}!")
|
|
530
|
-
print()
|
|
531
|
-
print("ℹ️ Deployment from CLI is coming soon!")
|
|
532
|
-
print(" For now, please use the web interface at:")
|
|
533
|
-
print(" https://cloud.mcp-use.com/deploy")
|
|
534
|
-
print()
|
|
535
|
-
print("Stay tuned for updates! 🎉")
|
|
536
|
-
else:
|
|
537
|
-
print("\n❌ Login cancelled")
|
|
538
|
-
|
|
539
|
-
print("=" * 60)
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
def main(args=None):
|
|
543
|
-
"""Main entry point for the CLI."""
|
|
544
|
-
parser = argparse.ArgumentParser(
|
|
545
|
-
prog="mcp-use",
|
|
546
|
-
description="MCP-Use CLI Tool - Create and deploy MCP projects",
|
|
547
|
-
add_help=False, # We'll handle help ourselves
|
|
548
|
-
)
|
|
549
|
-
|
|
550
|
-
# Add version argument
|
|
551
|
-
parser.add_argument(
|
|
552
|
-
"--version", "-v", action="version", version=f"mcp-use {__version__}", help="Show version information"
|
|
553
|
-
)
|
|
554
|
-
|
|
555
|
-
# Add help argument
|
|
556
|
-
parser.add_argument("--help", "-h", action="store_true", help="Show help message")
|
|
557
|
-
|
|
558
|
-
# Add subcommand as positional argument
|
|
559
|
-
parser.add_argument("command", nargs="?", choices=["create", "deploy"], help="Command to execute")
|
|
560
|
-
|
|
561
|
-
# Parse arguments
|
|
562
|
-
parsed_args = parser.parse_args(args)
|
|
563
|
-
|
|
564
|
-
# Handle help flag or no command
|
|
565
|
-
if parsed_args.help or not parsed_args.command:
|
|
566
|
-
show_help()
|
|
567
|
-
sys.exit(0)
|
|
568
|
-
|
|
569
|
-
# Handle commands
|
|
570
|
-
if parsed_args.command == "create":
|
|
571
|
-
handle_create()
|
|
572
|
-
elif parsed_args.command == "deploy":
|
|
573
|
-
handle_deploy()
|
|
574
|
-
else:
|
|
575
|
-
print(f"Unknown command: {parsed_args.command}")
|
|
576
|
-
show_help()
|
|
577
|
-
sys.exit(1)
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
if __name__ == "__main__":
|
|
581
|
-
main()
|
mcp_use-1.3.12.dist-info/RECORD
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
mcp_use/__init__.py,sha256=AEo6p1F4mSHLO3yKVWZbkr3OFuQwTxSYLGrFQkYb4io,1271
|
|
2
|
-
mcp_use/cli.py,sha256=d3_RqN-lca7igS-aZQIdNQidBOILVihyldywcf8GR-c,15602
|
|
3
|
-
mcp_use/client.py,sha256=SNkHAVknh01pGJZkISuGtGnFKQWjIM11ArJycBA6afA,12719
|
|
4
|
-
mcp_use/config.py,sha256=feW2Qxb7Ppz1N0PeQHr4GdEDAiNLmsMlSJS88HgdUns,3647
|
|
5
|
-
mcp_use/exceptions.py,sha256=PuzPj_Ov4oYJ8ny8BC6S1b9RRy39gtRotDhIaMulxQE,468
|
|
6
|
-
mcp_use/logging.py,sha256=bwZEDM3DZDVDVWmFlHCHEDAODix4_y8VSreRk-nRWuo,4971
|
|
7
|
-
mcp_use/session.py,sha256=DpH_z0a3xYemV9yWzlrf-IPZtpR27CI2S-gAm2jbCAc,4700
|
|
8
|
-
mcp_use/utils.py,sha256=QavJcVq2WxUUUCCpPCUeOB5bqIS0FFmpK-RAZkGc6aA,720
|
|
9
|
-
mcp_use/adapters/__init__.py,sha256=-xCrgPThuX7x0PHGFDdjb7M-mgw6QV3sKu5PM7ShnRg,275
|
|
10
|
-
mcp_use/adapters/base.py,sha256=8XB3xWZ6nJPhhmHwVtHT8-HO0D_9nnxzOkbVDP-fI3k,6940
|
|
11
|
-
mcp_use/adapters/langchain_adapter.py,sha256=vyrrhZpW9ISTXg7uaYPRBT_LkOAmbevuLXD8Bwk7xE8,9232
|
|
12
|
-
mcp_use/agents/__init__.py,sha256=FzkntihbAqzixWdWe99zIrrcIfd4N3YWltNniutG9VA,267
|
|
13
|
-
mcp_use/agents/base.py,sha256=EN-dRbwOi9vIqofFg3jmi5yT2VKlwEr9Cwi1DZgB3eE,1591
|
|
14
|
-
mcp_use/agents/mcpagent.py,sha256=jB9D-Pk-LtfDqEF7Me4eken8tCurRMkCkjwUeqM5Vxw,53212
|
|
15
|
-
mcp_use/agents/remote.py,sha256=eaosBxw6BxXXr9vnCwuNsSby64tVWHLdpw0FHr9edVc,15750
|
|
16
|
-
mcp_use/agents/prompts/system_prompt_builder.py,sha256=E86STmxcl2Ic763_114awNqFB2RyLrQlbvgRmJajQjI,4116
|
|
17
|
-
mcp_use/agents/prompts/templates.py,sha256=Yd-3NILgHXTrBUw9WE11gt0-QrlvN1pykeEpg3LY4HU,1545
|
|
18
|
-
mcp_use/auth/__init__.py,sha256=TBNMvgRDp-lC3n2f0UB6kZUZlJ35SYRBVDt3hadpvXI,138
|
|
19
|
-
mcp_use/auth/bearer.py,sha256=TmeXFlmOC86tvJna2fEvfW4JjfRicUciKVBfPJzDcWs,531
|
|
20
|
-
mcp_use/auth/oauth.py,sha256=JPYQmKNkLRhd53i5iHyFkhA8JzqSylXpvF66zIqpcIk,27584
|
|
21
|
-
mcp_use/auth/oauth_callback.py,sha256=hgdtTVC8LfvxQymnB4DUWN0-kfwqNpTb9vufiByWi9M,7514
|
|
22
|
-
mcp_use/connectors/__init__.py,sha256=cUF4yT0bNr8qeLkSzg28SHueiV5qDaHEB1l1GZ2K0dc,536
|
|
23
|
-
mcp_use/connectors/base.py,sha256=23mCgyQopU2U1ZxHCfiW_L1aV_8CH1Ek0gr9ROdf_nY,18250
|
|
24
|
-
mcp_use/connectors/http.py,sha256=ucmAn5P4R0ecm6MQGnFV2atgGsaksJrjDImOXfLTtTU,13708
|
|
25
|
-
mcp_use/connectors/sandbox.py,sha256=0915L6CjTYB4kXnuQsMhJm9bVi4V8676lFRhv1ZYnn4,12185
|
|
26
|
-
mcp_use/connectors/stdio.py,sha256=u_IPhglQpKQolDh-M9lEz_fhHECDYyLsmRqhxPR_AJE,4072
|
|
27
|
-
mcp_use/connectors/utils.py,sha256=zQ8GdNQx0Twz3by90BoU1RsWPf9wODGof4K3-NxPXeA,366
|
|
28
|
-
mcp_use/connectors/websocket.py,sha256=BBtX0xrfv9B-GTrDnQbasR0gsw3rSCCTQZp9HNuVxqI,10125
|
|
29
|
-
mcp_use/errors/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
30
|
-
mcp_use/errors/error_formatting.py,sha256=17lhj5goGHuTbJ5oLCUXyJ2SuIbzsuSM1Wk8LPeqY9k,911
|
|
31
|
-
mcp_use/managers/__init__.py,sha256=FRTuJw5kYtY1Eo7wN9Aeqeqo1euiR5slvrx5Fl_SGvk,383
|
|
32
|
-
mcp_use/managers/base.py,sha256=fJA4ct6GIcACOzmCSQGga1HoHYjsauaMHZsXehCPQNA,1138
|
|
33
|
-
mcp_use/managers/server_manager.py,sha256=uO18wHUKFq3-YVg_S_SlQDbNF2H978BR28C2YU4X86A,5308
|
|
34
|
-
mcp_use/managers/tools/__init__.py,sha256=zcpm4HXsp8NUMRJeyT6DdB8cgIMDs46pBfoTD-odhGU,437
|
|
35
|
-
mcp_use/managers/tools/base_tool.py,sha256=Jbbp7SwmHKDk8jT_6yVIv7iNsn6KaV_PljWuhhLcbXg,509
|
|
36
|
-
mcp_use/managers/tools/connect_server.py,sha256=-PlqgJDSMzairK90aDg1WTDjpqrFMoTiyekwoPDWNrw,2964
|
|
37
|
-
mcp_use/managers/tools/disconnect_server.py,sha256=dLa5PH-QZ30Dw3n5lzqilyHA8PuQ6xvMkXd-T5EwpU8,1622
|
|
38
|
-
mcp_use/managers/tools/get_active_server.py,sha256=tCaib76gYU3L5G82tEOTq4Io2cuCXWjOjPselb-92i8,964
|
|
39
|
-
mcp_use/managers/tools/list_servers_tool.py,sha256=P_Z96Ab8ELLyo3GQfTMfyemTPJwt0VR1s_iMnWE1GCg,2037
|
|
40
|
-
mcp_use/managers/tools/search_tools.py,sha256=4vso7ln-AfG6lQAMq9FA_CyeVtSEDYEWlHtdHtfnLps,12911
|
|
41
|
-
mcp_use/middleware/__init__.py,sha256=p9cTU5ZdeHys7RnhRh-y2-kc5OjPj3cL_Yk3kbl5Vqw,1354
|
|
42
|
-
mcp_use/middleware/logging.py,sha256=5UvEte9zHUA4zCTUmqY6-5YpDUSaNSX4rmfaRsxUJqk,1153
|
|
43
|
-
mcp_use/middleware/metrics.py,sha256=qp_HzfzswVZt3ZMVLwMw73LE4MLEwUw3m2MX_RCOpfY,13178
|
|
44
|
-
mcp_use/middleware/middleware.py,sha256=oWyt9c_JiKf-p992zvrJv25ZbPBo1Kq6fO4RASTTRSk,9641
|
|
45
|
-
mcp_use/observability/__init__.py,sha256=qJR51lpW6lVvhgNnUHBXYN6FKn4kDKbGVHUhPzrx324,348
|
|
46
|
-
mcp_use/observability/callbacks_manager.py,sha256=6jIcE6ofiLRxoi4fECaTlpnllTEFQdwB0IZ0ZkY0WAQ,5324
|
|
47
|
-
mcp_use/observability/laminar.py,sha256=eBY23B8rxQOW5ggHeGB0ZCpCSMnK4rC8fBOvDdbuoq4,1613
|
|
48
|
-
mcp_use/observability/langfuse.py,sha256=kOF05cbSEir7r3fibx_q6TfKzqmbjKLV7uNxBote9XY,2677
|
|
49
|
-
mcp_use/task_managers/__init__.py,sha256=LkXOjiDq5JcyB2tNJuSzyjbxZTl1Ordr_NKKD77Nb7g,557
|
|
50
|
-
mcp_use/task_managers/base.py,sha256=YzJqwwFRXZRFXDz9wkWz24Rowti4f8IwCLiVD-YzCVs,4648
|
|
51
|
-
mcp_use/task_managers/sse.py,sha256=L_PFQup3XFQl4LZhmOyqnfzXgFzTwrobkzdZK7DXrgE,2563
|
|
52
|
-
mcp_use/task_managers/stdio.py,sha256=MJcW03lUZUs_HEUxwFPaqy7m8QLbmdn6LagpcfZdjc8,2130
|
|
53
|
-
mcp_use/task_managers/streamable_http.py,sha256=dLMzMxfco4HNIk6Fo-c4SdA-iMVw2ZccSeP_NBr-mcQ,2855
|
|
54
|
-
mcp_use/task_managers/websocket.py,sha256=9JTw705rhYbP6x2xAPF6PwtNgF5yEWTQhx-dYSPMoaI,2154
|
|
55
|
-
mcp_use/telemetry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
|
-
mcp_use/telemetry/events.py,sha256=K5xqbmkum30r4gM2PWtTiUWGF8oZzGZw2DYwco1RfOQ,3113
|
|
57
|
-
mcp_use/telemetry/telemetry.py,sha256=oM_QAbZwOStKkeccvEfKmJLKhL2neFkPn5yM5rL2qHc,11711
|
|
58
|
-
mcp_use/telemetry/utils.py,sha256=kDVTqt2oSeWNJbnTOlXOehr2yFO0PMyx2UGkrWkfJiw,1769
|
|
59
|
-
mcp_use/types/sandbox.py,sha256=opJ9r56F1FvaqVvPovfAj5jZbsOexgwYx5wLgSlN8_U,712
|
|
60
|
-
mcp_use-1.3.12.dist-info/METADATA,sha256=bC17rV6FEzhW_pFTtfCOaLN5dNcJmDQ7cyTO5ITttOc,33925
|
|
61
|
-
mcp_use-1.3.12.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
62
|
-
mcp_use-1.3.12.dist-info/entry_points.txt,sha256=3jzEN6xbVsMErm_cxlHpCzvM97gFgjvtOEEspUp1vK8,45
|
|
63
|
-
mcp_use-1.3.12.dist-info/licenses/LICENSE,sha256=7Pw7dbwJSBw8zH-WE03JnR5uXvitRtaGTP9QWPcexcs,1068
|
|
64
|
-
mcp_use-1.3.12.dist-info/RECORD,,
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 pietrozullo
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|