universal-mcp 0.1.24rc2__py3-none-any.whl → 0.1.24rc4__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.
- universal_mcp/agentr/README.md +201 -0
- universal_mcp/agentr/__init__.py +6 -0
- universal_mcp/agentr/agentr.py +30 -0
- universal_mcp/{utils/agentr.py → agentr/client.py} +19 -3
- universal_mcp/agentr/integration.py +104 -0
- universal_mcp/agentr/registry.py +91 -0
- universal_mcp/agentr/server.py +51 -0
- universal_mcp/agents/__init__.py +6 -0
- universal_mcp/agents/auto.py +576 -0
- universal_mcp/agents/base.py +88 -0
- universal_mcp/agents/cli.py +27 -0
- universal_mcp/agents/codeact/__init__.py +243 -0
- universal_mcp/agents/codeact/sandbox.py +27 -0
- universal_mcp/agents/codeact/test.py +15 -0
- universal_mcp/agents/codeact/utils.py +61 -0
- universal_mcp/agents/hil.py +104 -0
- universal_mcp/agents/llm.py +10 -0
- universal_mcp/agents/react.py +58 -0
- universal_mcp/agents/simple.py +40 -0
- universal_mcp/agents/utils.py +111 -0
- universal_mcp/analytics.py +5 -7
- universal_mcp/applications/__init__.py +42 -75
- universal_mcp/applications/application.py +1 -1
- universal_mcp/applications/sample/app.py +245 -0
- universal_mcp/cli.py +10 -3
- universal_mcp/config.py +33 -7
- universal_mcp/exceptions.py +4 -0
- universal_mcp/integrations/__init__.py +0 -15
- universal_mcp/integrations/integration.py +9 -91
- universal_mcp/servers/__init__.py +2 -14
- universal_mcp/servers/server.py +10 -51
- universal_mcp/tools/__init__.py +3 -0
- universal_mcp/tools/adapters.py +20 -11
- universal_mcp/tools/manager.py +29 -56
- universal_mcp/tools/registry.py +41 -0
- universal_mcp/tools/tools.py +22 -1
- universal_mcp/types.py +10 -0
- universal_mcp/utils/common.py +245 -0
- universal_mcp/utils/openapi/api_generator.py +46 -18
- universal_mcp/utils/openapi/cli.py +445 -19
- universal_mcp/utils/openapi/openapi.py +284 -21
- universal_mcp/utils/openapi/postprocessor.py +275 -0
- universal_mcp/utils/openapi/preprocessor.py +1 -1
- universal_mcp/utils/openapi/test_generator.py +287 -0
- universal_mcp/utils/prompts.py +188 -341
- universal_mcp/utils/testing.py +190 -2
- {universal_mcp-0.1.24rc2.dist-info → universal_mcp-0.1.24rc4.dist-info}/METADATA +17 -3
- universal_mcp-0.1.24rc4.dist-info/RECORD +71 -0
- universal_mcp/applications/sample_tool_app.py +0 -80
- universal_mcp/client/agents/__init__.py +0 -4
- universal_mcp/client/agents/base.py +0 -38
- universal_mcp/client/agents/llm.py +0 -115
- universal_mcp/client/agents/react.py +0 -67
- universal_mcp/client/cli.py +0 -181
- universal_mcp-0.1.24rc2.dist-info/RECORD +0 -53
- {universal_mcp-0.1.24rc2.dist-info → universal_mcp-0.1.24rc4.dist-info}/WHEEL +0 -0
- {universal_mcp-0.1.24rc2.dist-info → universal_mcp-0.1.24rc4.dist-info}/entry_points.txt +0 -0
- {universal_mcp-0.1.24rc2.dist-info → universal_mcp-0.1.24rc4.dist-info}/licenses/LICENSE +0 -0
universal_mcp/client/cli.py
DELETED
@@ -1,181 +0,0 @@
|
|
1
|
-
from typing import Any
|
2
|
-
|
3
|
-
from rich.console import Console
|
4
|
-
from rich.markdown import Markdown
|
5
|
-
from rich.panel import Panel
|
6
|
-
from rich.prompt import Prompt
|
7
|
-
from rich.table import Table
|
8
|
-
from typer import Typer
|
9
|
-
|
10
|
-
from universal_mcp.client.agents import AgentType, ReActAgent
|
11
|
-
from universal_mcp.logger import setup_logger
|
12
|
-
from universal_mcp.tools.adapters import ToolFormat
|
13
|
-
from universal_mcp.tools.manager import ToolManager
|
14
|
-
|
15
|
-
app = Typer(name="client")
|
16
|
-
|
17
|
-
|
18
|
-
class RichCLI:
|
19
|
-
def __init__(self):
|
20
|
-
self.console = Console()
|
21
|
-
|
22
|
-
def display_welcome(self, agent_name: str):
|
23
|
-
"""Display welcome message"""
|
24
|
-
welcome_text = f"""
|
25
|
-
# Welcome to {agent_name}!
|
26
|
-
|
27
|
-
Available commands:
|
28
|
-
- Type your questions naturally
|
29
|
-
- `/help` - Show help
|
30
|
-
- `/tools` - List available tools
|
31
|
-
- `/switch <agent_type>` - Switch agent type (react/codeact)
|
32
|
-
- `/exit` - Exit the application
|
33
|
-
"""
|
34
|
-
|
35
|
-
self.console.print(Panel(Markdown(welcome_text), title="🤖 AI Agent CLI", border_style="blue"))
|
36
|
-
|
37
|
-
def display_agent_response(self, response: str, agent_name: str):
|
38
|
-
"""Display agent response with formatting"""
|
39
|
-
self.console.print(Panel(Markdown(response), title=f"🤖 {agent_name}", border_style="green", padding=(1, 2)))
|
40
|
-
|
41
|
-
def display_thinking(self, thought: str):
|
42
|
-
"""Display agent's thinking process"""
|
43
|
-
if thought:
|
44
|
-
self.console.print(Panel(thought, title="💭 Thinking", border_style="yellow", padding=(1, 2)))
|
45
|
-
|
46
|
-
def display_tools(self, tools: list):
|
47
|
-
"""Display available tools in a table"""
|
48
|
-
table = Table(title="🛠️ Available Tools")
|
49
|
-
table.add_column("Tool Name", style="cyan")
|
50
|
-
table.add_column("Description", style="white")
|
51
|
-
|
52
|
-
for tool in tools:
|
53
|
-
func_info = tool["function"]
|
54
|
-
table.add_row(func_info["name"], func_info["description"])
|
55
|
-
|
56
|
-
self.console.print(table)
|
57
|
-
|
58
|
-
def display_error(self, error: str):
|
59
|
-
"""Display error message"""
|
60
|
-
self.console.print(Panel(error, title="❌ Error", border_style="red"))
|
61
|
-
|
62
|
-
def get_user_input(self) -> str:
|
63
|
-
"""Get user input with rich prompt"""
|
64
|
-
return Prompt.ask("[bold blue]You[/bold blue]", console=self.console)
|
65
|
-
|
66
|
-
def display_info(self, message: str):
|
67
|
-
"""Display info message"""
|
68
|
-
self.console.print(f"[bold cyan]ℹ️ {message}[/bold cyan]")
|
69
|
-
|
70
|
-
|
71
|
-
class AgentCLI:
|
72
|
-
def __init__(self):
|
73
|
-
self.cli = RichCLI()
|
74
|
-
self.tool_manager = ToolManager(default_format=ToolFormat.OPENAI)
|
75
|
-
self.current_agent = None
|
76
|
-
self.agent_type = AgentType.REACT
|
77
|
-
# self.tool_manager.register_tools_from_app(SampleToolApp(), tags=["all"])
|
78
|
-
|
79
|
-
def create_agent(self, agent_type: AgentType, model: str = "gpt-4o") -> Any:
|
80
|
-
"""Create an agent based on type"""
|
81
|
-
instructions = """You are a helpful AI assistant. Use the available tools to help users with their requests.
|
82
|
-
Think step by step and provide clear explanations of your reasoning."""
|
83
|
-
|
84
|
-
if agent_type == AgentType.REACT:
|
85
|
-
return ReActAgent("ReAct Agent", instructions, model)
|
86
|
-
else:
|
87
|
-
raise ValueError("Unknown agent type")
|
88
|
-
|
89
|
-
def switch_agent(self, agent_type: str):
|
90
|
-
"""Switch to a different agent type"""
|
91
|
-
try:
|
92
|
-
self.agent_type = AgentType(agent_type.lower())
|
93
|
-
self.current_agent = self.create_agent(self.agent_type)
|
94
|
-
self.cli.display_info(f"Switched to {self.agent_type.value} agent")
|
95
|
-
except ValueError:
|
96
|
-
self.cli.display_error(f"Unknown agent type: {agent_type}")
|
97
|
-
|
98
|
-
async def process_command(self, user_input: str) -> bool | None:
|
99
|
-
"""Process special commands, return True if command was processed"""
|
100
|
-
if user_input.startswith("/"):
|
101
|
-
command_parts = user_input[1:].split()
|
102
|
-
command = command_parts[0].lower()
|
103
|
-
|
104
|
-
if command == "help":
|
105
|
-
self.show_help()
|
106
|
-
return True
|
107
|
-
elif command == "tools":
|
108
|
-
self.cli.display_tools(self.tool_manager.list_tools())
|
109
|
-
return True
|
110
|
-
elif command == "switch" and len(command_parts) > 1:
|
111
|
-
self.switch_agent(command_parts[1])
|
112
|
-
return True
|
113
|
-
elif command == "exit" or command == "quit" or command == "q":
|
114
|
-
self.cli.display_info("Goodbye! 👋")
|
115
|
-
return False
|
116
|
-
else:
|
117
|
-
self.cli.display_error(f"Unknown command: {command}")
|
118
|
-
return True
|
119
|
-
|
120
|
-
return None # Not a command
|
121
|
-
|
122
|
-
def show_help(self):
|
123
|
-
"""Show help information"""
|
124
|
-
help_text = """
|
125
|
-
# Available Commands
|
126
|
-
|
127
|
-
- `/help` - Show this help message
|
128
|
-
- `/tools` - List all available tools
|
129
|
-
- `/exit` - Exit the application
|
130
|
-
"
|
131
|
-
"""
|
132
|
-
self.cli.console.print(help_text)
|
133
|
-
|
134
|
-
async def run(self, model):
|
135
|
-
"""Main application loop"""
|
136
|
-
|
137
|
-
# Initialize agent
|
138
|
-
self.current_agent = self.create_agent(self.agent_type, model)
|
139
|
-
|
140
|
-
# Display welcome
|
141
|
-
self.cli.display_welcome(self.current_agent.name)
|
142
|
-
|
143
|
-
# Main loop
|
144
|
-
while True:
|
145
|
-
try:
|
146
|
-
user_input = self.cli.get_user_input()
|
147
|
-
|
148
|
-
if not user_input.strip():
|
149
|
-
continue
|
150
|
-
|
151
|
-
# Process commands
|
152
|
-
command_result = await self.process_command(user_input)
|
153
|
-
if command_result is False: # Exit command
|
154
|
-
break
|
155
|
-
elif command_result is True: # Command processed
|
156
|
-
continue
|
157
|
-
|
158
|
-
# Process with agent
|
159
|
-
response = await self.current_agent.process_step(user_input, self.tool_manager)
|
160
|
-
|
161
|
-
self.cli.display_agent_response(response, self.current_agent.name)
|
162
|
-
|
163
|
-
except KeyboardInterrupt:
|
164
|
-
self.cli.display_info("\nGoodbye! 👋")
|
165
|
-
break
|
166
|
-
except Exception as e:
|
167
|
-
self.cli.display_error(f"An error occurred: {str(e)}")
|
168
|
-
|
169
|
-
|
170
|
-
@app.command()
|
171
|
-
def run(model: str = "openrouter/auto"):
|
172
|
-
"""Run the agent CLI"""
|
173
|
-
import asyncio
|
174
|
-
|
175
|
-
setup_logger(log_file=None, level="WARNING")
|
176
|
-
agent_cli = AgentCLI()
|
177
|
-
asyncio.run(agent_cli.run(model=model))
|
178
|
-
|
179
|
-
|
180
|
-
if __name__ == "__main__":
|
181
|
-
app()
|
@@ -1,53 +0,0 @@
|
|
1
|
-
universal_mcp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
universal_mcp/analytics.py,sha256=8AjqAnqacos-1R9D6gf_eMbKFlBBIFSM9yv12AAnxlE,3961
|
3
|
-
universal_mcp/cli.py,sha256=aVTUGImHpEklW0OpLBLCYyvjv3M2Prf1ntkwmlG-Jxg,2238
|
4
|
-
universal_mcp/config.py,sha256=3CGLbwyhr4zq1kQ7vHIO4f6PyfmANFa9RVZEMVgSJ8U,10651
|
5
|
-
universal_mcp/exceptions.py,sha256=bf45HkNY-RVYzv8l_nPaxS5P2UCFww_oZmq508TMKgY,2070
|
6
|
-
universal_mcp/logger.py,sha256=VmH_83efpErLEDTJqz55Dp0dioTXfGvMBLZUx5smOLc,2116
|
7
|
-
universal_mcp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
universal_mcp/applications/__init__.py,sha256=l19_sMs5766VFWU_7O2niamvvvfQOteysqylbqvjjGQ,3500
|
9
|
-
universal_mcp/applications/application.py,sha256=di4vuvAiOgVophzlvLiyVILdR8hPuSLS46YLQDEVq-c,23823
|
10
|
-
universal_mcp/applications/sample_tool_app.py,sha256=YfZGE6F-cqqJGLU3TxOk4fYlAuf-kCOdBw03S-5VcpE,2760
|
11
|
-
universal_mcp/client/cli.py,sha256=dZ_Uwp9grRN2UWOuE2PQ9eUAyGelNGI4GQkkliD_6Vs,6242
|
12
|
-
universal_mcp/client/oauth.py,sha256=O00zOUfQxINaruFU2zt-64DIR1_mAqrY8ykLQo-teJU,8679
|
13
|
-
universal_mcp/client/token_store.py,sha256=6VAzjzJG49wYvmEDqksFvb-fVqdjHIKWv7yYyh_AuF8,3912
|
14
|
-
universal_mcp/client/transport.py,sha256=xgAKBJ1-yCcTtl9cxzJgRn6to5Y9EvCwLc_WpDck3Dg,11838
|
15
|
-
universal_mcp/client/agents/__init__.py,sha256=ZeoMWi6C6ZaP28EzPhjTFlreZUP-FGo__VPgnKnU4uw,121
|
16
|
-
universal_mcp/client/agents/base.py,sha256=i8oAILtVoW4kHAx95fd8IaioqYrD1aqoWSRjUl05TaY,953
|
17
|
-
universal_mcp/client/agents/llm.py,sha256=O1cVPlXPhXb-x7GFIZ4dYFdB_Wd1eWHTTEV9FoBl_OE,5062
|
18
|
-
universal_mcp/client/agents/react.py,sha256=lI654OT-3gXwrTjbt0DTbB-tuim4ahqZ7vAFta_A6NY,2719
|
19
|
-
universal_mcp/integrations/__init__.py,sha256=UHno85kYa9nCjep31WpJlLu6ObNQxHzp4T57Q5eNILE,770
|
20
|
-
universal_mcp/integrations/integration.py,sha256=E-pC_VioPoJwyw5d_RquE7k2ygvXrAnphNzNt4NrOS0,19823
|
21
|
-
universal_mcp/servers/__init__.py,sha256=BbtZxl69EQcs9PpxBCkwa-vJKcfESgBfXQ5UYlkRQTo,542
|
22
|
-
universal_mcp/servers/server.py,sha256=CNLlVxNosqBipk1_WD0zQJz-MZDiK5k7d_tZMH3NpAQ,7542
|
23
|
-
universal_mcp/stores/__init__.py,sha256=quvuwhZnpiSLuojf0NfmBx2xpaCulv3fbKtKaSCEmuM,603
|
24
|
-
universal_mcp/stores/store.py,sha256=yWbEGZb53z3fpVyqGWbes63z1CtIzC_IuM49OXy__UY,10137
|
25
|
-
universal_mcp/tools/__init__.py,sha256=Fatza_R0qYWmNF1WQSfUZZKQFu5qf-16JhZzdmyx3KY,333
|
26
|
-
universal_mcp/tools/adapters.py,sha256=rnicV_WBgNe0WqVG60ms0o92BoRTRqd_C9jMMndx47c,3461
|
27
|
-
universal_mcp/tools/docstring_parser.py,sha256=efEOE-ME7G5Jbbzpn7pN2xNuyu2M5zfZ1Tqu1lRB0Gk,8392
|
28
|
-
universal_mcp/tools/func_metadata.py,sha256=F4jd--hoZWKPBbZihVtluYKUsIdXdq4a0VWRgMl5k-Q,10838
|
29
|
-
universal_mcp/tools/manager.py,sha256=Zpwr95rj4CvCRMkdX3_q3kZ9fYm8SkuLa-UkURG3WZQ,11740
|
30
|
-
universal_mcp/tools/tools.py,sha256=pHehD4dqaTSnMBNhsj0Gpb4_L8OIy1rlZOITIDt7cnU,3730
|
31
|
-
universal_mcp/utils/__init__.py,sha256=8wi4PGWu-SrFjNJ8U7fr2iFJ1ktqlDmSKj1xYd7KSDc,41
|
32
|
-
universal_mcp/utils/agentr.py,sha256=8G9ZGQEA_Od2O9C6p439UclbzBgjvWB09Xej71NoAVk,3727
|
33
|
-
universal_mcp/utils/common.py,sha256=HEZC2Mhilb8DrGXQG2tboAIw1r4veGilGWjfnPF1lyA,888
|
34
|
-
universal_mcp/utils/installation.py,sha256=PU_GfHPqzkumKk-xG4L9CkBzSmABxmchwblZkx-zY-I,7204
|
35
|
-
universal_mcp/utils/prompts.py,sha256=g6esB47Z5BNZxubQtZ21faJUcpH8-wRfS4xgk-2vECs,33284
|
36
|
-
universal_mcp/utils/singleton.py,sha256=RoOiKxBOAhp0TK1QaMDYi-8GjRcy2Vh-bAOuIAcYan0,775
|
37
|
-
universal_mcp/utils/testing.py,sha256=Crk1OqHjXSHIMfPquIuzL4NBq7x1RxL4roTpJobDoY4,1464
|
38
|
-
universal_mcp/utils/openapi/__inti__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
39
|
-
universal_mcp/utils/openapi/api_generator.py,sha256=bX4nAZCZLh4cOO5deLh7MqJ3p3ZWOzggQsCwhUaFMb4,5696
|
40
|
-
universal_mcp/utils/openapi/api_splitter.py,sha256=io7fV-E8hUIR4NxFlakqydbgrQF6aBAnZHPMlpxw-wc,20967
|
41
|
-
universal_mcp/utils/openapi/cli.py,sha256=oQe8KzVa7OEe-ruJRaDlmKmhppEMb15qHyqbDc0QAAM,8715
|
42
|
-
universal_mcp/utils/openapi/docgen.py,sha256=DNmwlhg_-TRrHa74epyErMTRjV2nutfCQ7seb_Rq5hE,21366
|
43
|
-
universal_mcp/utils/openapi/filters.py,sha256=96FajO5nLbvjNPy2A1HvSS9jqpzMDHd4q_QTP-DIsPI,3842
|
44
|
-
universal_mcp/utils/openapi/openapi.py,sha256=xAzr7V1PHBPbRhGrjNoBxT1clvTL7y_9BghvYgEvBqw,52406
|
45
|
-
universal_mcp/utils/openapi/preprocessor.py,sha256=OYlJX9BOn-lBFmBEOii3S2_Vdp3EGXVu3Qc3vLXtGRI,63087
|
46
|
-
universal_mcp/utils/openapi/readme.py,sha256=R2Jp7DUXYNsXPDV6eFTkLiy7MXbSULUj1vHh4O_nB4c,2974
|
47
|
-
universal_mcp/utils/templates/README.md.j2,sha256=Mrm181YX-o_-WEfKs01Bi2RJy43rBiq2j6fTtbWgbTA,401
|
48
|
-
universal_mcp/utils/templates/api_client.py.j2,sha256=972Im7LNUAq3yZTfwDcgivnb-b8u6_JLKWXwoIwXXXQ,908
|
49
|
-
universal_mcp-0.1.24rc2.dist-info/METADATA,sha256=YiW1lPdirDqFJDTvpi5Ah-INW9p0_btzqiSKE2kQrxA,2546
|
50
|
-
universal_mcp-0.1.24rc2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
51
|
-
universal_mcp-0.1.24rc2.dist-info/entry_points.txt,sha256=QlBrVKmA2jIM0q-C-3TQMNJTTWOsOFQvgedBq2rZTS8,56
|
52
|
-
universal_mcp-0.1.24rc2.dist-info/licenses/LICENSE,sha256=NweDZVPslBAZFzlgByF158b85GR0f5_tLQgq1NS48To,1063
|
53
|
-
universal_mcp-0.1.24rc2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|