universal-mcp 0.1.24rc6__tar.gz → 0.1.24rc7__tar.gz

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 (93) hide show
  1. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/PKG-INFO +4 -1
  2. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/pyproject.toml +4 -1
  3. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agentr/README.md +43 -34
  4. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agentr/agentr.py +7 -0
  5. universal_mcp-0.1.24rc7/src/universal_mcp/agentr/client.py +177 -0
  6. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agentr/registry.py +21 -25
  7. universal_mcp-0.1.24rc7/src/universal_mcp/agents/__init__.py +6 -0
  8. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agents/auto.py +8 -8
  9. universal_mcp-0.1.24rc7/src/universal_mcp/agents/autoagent/__init__.py +35 -0
  10. universal_mcp-0.1.24rc7/src/universal_mcp/agents/autoagent/__main__.py +21 -0
  11. universal_mcp-0.1.24rc7/src/universal_mcp/agents/autoagent/context.py +25 -0
  12. universal_mcp-0.1.24rc7/src/universal_mcp/agents/autoagent/graph.py +119 -0
  13. universal_mcp-0.1.24rc7/src/universal_mcp/agents/autoagent/prompts.py +5 -0
  14. universal_mcp-0.1.24rc7/src/universal_mcp/agents/autoagent/state.py +27 -0
  15. universal_mcp-0.1.24rc7/src/universal_mcp/agents/autoagent/studio.py +25 -0
  16. universal_mcp-0.1.24rc7/src/universal_mcp/agents/autoagent/utils.py +13 -0
  17. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agents/base.py +3 -2
  18. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agents/codeact/test.py +2 -2
  19. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agents/hil.py +2 -2
  20. universal_mcp-0.1.24rc7/src/universal_mcp/agents/llm.py +28 -0
  21. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agents/react.py +3 -1
  22. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agents/simple.py +3 -3
  23. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/tools/registry.py +13 -3
  24. universal_mcp-0.1.24rc6/src/universal_mcp/agentr/client.py +0 -123
  25. universal_mcp-0.1.24rc6/src/universal_mcp/agents/__init__.py +0 -6
  26. universal_mcp-0.1.24rc6/src/universal_mcp/agents/llm.py +0 -10
  27. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/.gitignore +0 -0
  28. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/LICENSE +0 -0
  29. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/README.md +0 -0
  30. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/tests/__init__.py +0 -0
  31. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/tests/conftest.py +0 -0
  32. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/tests/test_api_generator.py +0 -0
  33. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/tests/test_api_integration.py +0 -0
  34. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/tests/test_applications.py +0 -0
  35. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/tests/test_localserver.py +0 -0
  36. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/tests/test_stores.py +0 -0
  37. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/tests/test_tool.py +0 -0
  38. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/tests/test_tool_manager.py +0 -0
  39. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/tests/test_zenquotes.py +0 -0
  40. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/__init__.py +0 -0
  41. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agentr/__init__.py +0 -0
  42. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agentr/integration.py +0 -0
  43. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agentr/server.py +0 -0
  44. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agents/cli.py +0 -0
  45. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agents/codeact/__init__.py +0 -0
  46. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agents/codeact/sandbox.py +0 -0
  47. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agents/codeact/utils.py +0 -0
  48. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agents/tools.py +0 -0
  49. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/agents/utils.py +0 -0
  50. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/analytics.py +0 -0
  51. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/applications/__init__.py +0 -0
  52. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/applications/application.py +0 -0
  53. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/applications/sample/app.py +0 -0
  54. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/cli.py +0 -0
  55. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/client/oauth.py +0 -0
  56. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/client/token_store.py +0 -0
  57. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/client/transport.py +0 -0
  58. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/config.py +0 -0
  59. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/exceptions.py +0 -0
  60. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/integrations/__init__.py +0 -0
  61. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/integrations/integration.py +0 -0
  62. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/logger.py +0 -0
  63. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/py.typed +0 -0
  64. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/servers/__init__.py +0 -0
  65. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/servers/server.py +0 -0
  66. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/stores/__init__.py +0 -0
  67. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/stores/store.py +0 -0
  68. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/tools/__init__.py +0 -0
  69. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/tools/adapters.py +0 -0
  70. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/tools/docstring_parser.py +0 -0
  71. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/tools/func_metadata.py +0 -0
  72. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/tools/manager.py +0 -0
  73. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/tools/tools.py +0 -0
  74. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/types.py +0 -0
  75. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/__init__.py +0 -0
  76. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/common.py +0 -0
  77. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/installation.py +0 -0
  78. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/openapi/__inti__.py +0 -0
  79. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/openapi/api_generator.py +0 -0
  80. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/openapi/api_splitter.py +0 -0
  81. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/openapi/cli.py +0 -0
  82. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/openapi/docgen.py +0 -0
  83. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/openapi/filters.py +0 -0
  84. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/openapi/openapi.py +0 -0
  85. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/openapi/postprocessor.py +0 -0
  86. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/openapi/preprocessor.py +0 -0
  87. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/openapi/readme.py +0 -0
  88. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/openapi/test_generator.py +0 -0
  89. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/prompts.py +0 -0
  90. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/singleton.py +0 -0
  91. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/templates/README.md.j2 +0 -0
  92. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/templates/api_client.py.j2 +0 -0
  93. {universal_mcp-0.1.24rc6 → universal_mcp-0.1.24rc7}/src/universal_mcp/utils/testing.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: universal-mcp
3
- Version: 0.1.24rc6
3
+ Version: 0.1.24rc7
4
4
  Summary: Universal MCP acts as a middle ware for your API applications. It can store your credentials, authorize, enable disable apps on the fly and much more.
5
5
  Author-email: Manoj Bajaj <manojbajaj95@gmail.com>
6
6
  License: MIT
@@ -9,9 +9,12 @@ Requires-Python: >=3.11
9
9
  Requires-Dist: black>=25.1.0
10
10
  Requires-Dist: cookiecutter>=2.6.0
11
11
  Requires-Dist: gql>=4.0.0
12
+ Requires-Dist: httpx-aiohttp>=0.1.8
12
13
  Requires-Dist: jinja2>=3.1.3
13
14
  Requires-Dist: jsonref>=1.1.0
14
15
  Requires-Dist: keyring>=25.6.0
16
+ Requires-Dist: langchain-anthropic>=0.3.19
17
+ Requires-Dist: langchain-google-vertexai>=2.0.28
15
18
  Requires-Dist: langchain-mcp-adapters>=0.1.9
16
19
  Requires-Dist: langchain-openai>=0.3.27
17
20
  Requires-Dist: langgraph-cli[inmem]>=0.3.4
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "universal-mcp"
7
- version = "0.1.24-rc6"
7
+ version = "0.1.24-rc7"
8
8
  description = "Universal MCP acts as a middle ware for your API applications. It can store your credentials, authorize, enable disable apps on the fly and much more."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -17,8 +17,11 @@ dependencies = [
17
17
  "black>=25.1.0",
18
18
  "cookiecutter>=2.6.0",
19
19
  "gql>=4.0.0",
20
+ "httpx-aiohttp>=0.1.8",
20
21
  "jsonref>=1.1.0",
21
22
  "keyring>=25.6.0",
23
+ "langchain-anthropic>=0.3.19",
24
+ "langchain-google-vertexai>=2.0.28",
22
25
  "langchain-mcp-adapters>=0.1.9",
23
26
  "langchain-openai>=0.3.27",
24
27
  "langgraph>=0.5.2",
@@ -1,20 +1,23 @@
1
1
  # AgentR Python SDK
2
2
 
3
3
  The official Python SDK for the AgentR platform, a component of the Universal MCP framework.
4
- Currently in beta, breaking changes are expected.
5
4
 
6
- The AgentR Python SDK provides convenient access to the AgentR REST API from any Python 3.10+
7
- application, allowing for dynamic loading and management of tools and integrations.
5
+ *Currently in beta, breaking changes are expected.*
6
+
7
+ The AgentR Python SDK provides convenient access to the AgentR REST API from any Python 3.10+ application, allowing for dynamic loading and management of tools and integrations.
8
8
 
9
9
  ## Installation
10
+
10
11
  ```bash
11
12
  pip install universal-mcp
12
13
  ```
13
14
 
14
15
  ## Usage
16
+
15
17
  The AgentR platform is designed to seamlessly integrate a wide array of tools into your agentic applications. The primary entry point for this is the `Agentr` class, which provides a high-level interface for loading and listing tools.
16
18
 
17
19
  ### High-Level Client (`Agentr`)
20
+
18
21
  This is the recommended way to get started. It abstracts away the details of the registry and tool management.
19
22
 
20
23
  ```python
@@ -29,7 +32,7 @@ agentr = Agentr(
29
32
  )
30
33
 
31
34
  # Load specific tools from the AgentR server into the tool manager
32
- agentr.load_tools(["reddit_search_subreddits", "google_drive_list_files"])
35
+ agentr.load_tools(["reddit__search_subreddits", "google-drive__list_files"])
33
36
 
34
37
  # List the tools that are now loaded and ready to be used
35
38
  # You can specify a format compatible with your LLM (e.g., OPENAI)
@@ -41,10 +44,10 @@ print(tools)
41
44
 
42
45
  For more granular control over the AgentR platform, you can use the lower-level components directly.
43
46
 
44
- ### AgentrClient
45
- The `AgentrClient` provides direct access to the AgentR REST API endpoints.
47
+ #### AgentrClient
48
+
49
+ The `AgentrClient` provides direct, one-to-one access to the AgentR REST API endpoints. The following examples have been updated to reflect the latest API structure.
46
50
 
47
- #### Methods
48
51
  ```python
49
52
  import os
50
53
  from universal_mcp.agentr import AgentrClient
@@ -55,39 +58,43 @@ client = AgentrClient(
55
58
  api_key=os.environ.get("AGENTR_API_KEY")
56
59
  )
57
60
 
58
- # Fetch all available applications from the AgentR server
59
- apps = client.fetch_apps()
60
- print(apps)
61
+ # Fetch a list of available applications from the AgentR server
62
+ apps = client.list_apps()
63
+ print("Available Apps:", apps)
61
64
 
62
- # Get credentials for a specific integration
63
- # This will raise a NotAuthorizedError if the user needs to authenticate
65
+ # Get credentials for a specific app by its ID (e.g., 'reddit')
66
+ # This will raise a NotAuthorizedError if the user needs to authenticate.
64
67
  try:
65
- credentials = client.get_credentials("reddit")
68
+ credentials = client.get_credentials(app_id="reddit")
66
69
  print("Reddit credentials found.")
67
70
  except NotAuthorizedError as e:
68
- print(e) # "Please ask the user to visit the following url to authorize..."
69
-
70
- # Example of fetching a single app and its actions
71
- if apps:
72
- app_id = apps[0].id # Assuming AppConfig has an 'id' attribute
71
+ print(e) # "Please ask the user to visit the following url to authorize..."
73
72
 
74
- # Fetch a single app's configuration
75
- app_config = client.fetch_app(app_id)
76
- print(f"Fetched config for app {app_id}:", app_config)
73
+ # List all available tools globally
74
+ all_tools = client.list_tools()
75
+ print("All Available Tools:", all_tools)
77
76
 
78
- # List all actions for that app
79
- actions = client.list_actions(app_id)
80
- print(f"Actions for app {app_id}:", actions)
81
-
82
- # List all apps (returns raw JSON data)
83
- all_apps = client.list_all_apps()
84
- print("All available apps:", all_apps)
77
+ # Example of fetching a single app and a single tool
78
+ if apps:
79
+ # Note: We access dictionary keys, not attributes
80
+ app_id = apps[0]['id']
81
+
82
+ # Fetch a single app's details
83
+ app_details = client.get_app(app_id)
84
+ print(f"Fetched details for app '{app_id}':", app_details)
85
+
86
+ if all_tools:
87
+ tool_id = all_tools[0]['id']
88
+
89
+ # Fetch a single tool's details
90
+ tool_details = client.get_tool(tool_id)
91
+ print(f"Fetched details for tool '{tool_id}':", tool_details)
85
92
  ```
86
93
 
87
- ### AgentrIntegration
94
+ #### AgentrIntegration
95
+
88
96
  This class handles the authentication and authorization flow for a single integration (e.g., "reddit"). It's used under the hood by applications to acquire credentials.
89
97
 
90
- #### Methods
91
98
  ```python
92
99
  from universal_mcp.agentr import AgentrIntegration, AgentrClient
93
100
  from universal_mcp.exceptions import NotAuthorizedError
@@ -114,10 +121,10 @@ except NotAuthorizedError:
114
121
  print("Still not authorized.")
115
122
  ```
116
123
 
117
- ### AgentrRegistry
124
+ #### AgentrRegistry
125
+
118
126
  The registry is responsible for discovering which tools are available on the AgentR platform.
119
127
 
120
- #### Methods
121
128
  ```python
122
129
  import asyncio
123
130
  from universal_mcp.agentr import AgentrRegistry, AgentrClient
@@ -148,7 +155,8 @@ if __name__ == "__main__":
148
155
  asyncio.run(main())
149
156
  ```
150
157
 
151
- ### AgentrServer
158
+ #### AgentrServer
159
+
152
160
  For server-side deployments, `AgentrServer` can be used to load all configured applications and their tools from an AgentR instance on startup.
153
161
 
154
162
  ```python
@@ -170,6 +178,7 @@ print(tool_manager.list_tools())
170
178
  ```
171
179
 
172
180
  ## Executing Tools
181
+
173
182
  Once tools are loaded, you can execute them using the `call_tool` method on the `ToolManager` instance, which is available via `agentr.manager`.
174
183
 
175
184
  ```python
@@ -182,7 +191,7 @@ async def main():
182
191
  agentr = Agentr(api_key=os.environ.get("AGENTR_API_KEY"))
183
192
 
184
193
  # 2. Load the tool(s) you want to use
185
- tool_name = "reddit_search_subreddits"
194
+ tool_name = "reddit__search_subreddits"
186
195
  agentr.load_tools([tool_name])
187
196
 
188
197
  # 3. Execute the tool using the tool manager
@@ -28,3 +28,10 @@ class Agentr:
28
28
 
29
29
  def list_tools(self, format: ToolFormat | None = None) -> list[Tool]:
30
30
  return self.manager.list_tools(format=format or self.format)
31
+
32
+ def search_tools(
33
+ self,
34
+ query: str,
35
+ ) -> list[str]:
36
+ """Retrieve a tool to use, given a search query."""
37
+ return self.registry.search_tools(query)
@@ -0,0 +1,177 @@
1
+ import os
2
+ from typing import Any
3
+
4
+ import httpx
5
+ from loguru import logger
6
+
7
+ from universal_mcp.exceptions import NotAuthorizedError
8
+
9
+
10
+ class AgentrClient:
11
+ """Helper class for AgentR API operations.
12
+
13
+ This class provides utility methods for interacting with the AgentR API,
14
+ including authentication, authorization, and credential management.
15
+
16
+ Args:
17
+ api_key (str, optional): AgentR API key. If not provided, will look for AGENTR_API_KEY env var.
18
+ base_url (str, optional): Base URL for AgentR API. Defaults to https://api.agentr.dev.
19
+ """
20
+
21
+ def __init__(self, api_key: str | None = None, base_url: str | None = None):
22
+ base_url = base_url or os.getenv("AGENTR_BASE_URL", "https://api.agentr.dev")
23
+ self.base_url = f"{base_url.rstrip('/')}/v1"
24
+ self.api_key = api_key or os.getenv("AGENTR_API_KEY")
25
+ if not self.api_key:
26
+ raise ValueError("No API key provided and AGENTR_API_KEY not found in environment variables")
27
+ self.client = httpx.Client(
28
+ base_url=self.base_url,
29
+ headers={"X-API-KEY": self.api_key},
30
+ timeout=30,
31
+ follow_redirects=True,
32
+ verify=False,
33
+ )
34
+
35
+ def get_credentials(self, app_id: str) -> dict[str, Any]:
36
+ """Get credentials for an integration from the AgentR API.
37
+
38
+ Args:
39
+ app_id (str): The ID of the app (e.g., 'asana', 'google-drive').
40
+
41
+ Returns:
42
+ dict: Credentials data from API response.
43
+
44
+ Raises:
45
+ NotAuthorizedError: If credentials are not found (404 response).
46
+ HTTPError: For other API errors.
47
+ """
48
+ response = self.client.get(
49
+ "/credentials/",
50
+ params={"app_id": app_id},
51
+ )
52
+ if response.status_code == 404:
53
+ logger.warning(f"No credentials found for app '{app_id}'. Requesting authorization...")
54
+ action_url = self.get_authorization_url(app_id)
55
+ raise NotAuthorizedError(action_url)
56
+ response.raise_for_status()
57
+ return response.json()
58
+
59
+ def get_authorization_url(self, app_id: str) -> str:
60
+ """Get the authorization URL to connect an app.
61
+
62
+ Args:
63
+ app_id (str): The ID of the app to authorize.
64
+
65
+ Returns:
66
+ str: A message containing the authorization URL.
67
+
68
+ Raises:
69
+ HTTPError: If the API request fails.
70
+ """
71
+ response = self.client.post("/connections/authorize", json={"app_id": app_id})
72
+ response.raise_for_status()
73
+ url = response.json().get("authorize_url")
74
+ return f"Please ask the user to visit the following url to authorize the application: {url}. Render the url in proper markdown format with a clickable link."
75
+
76
+ def list_all_apps(self) -> list[dict[str, Any]]:
77
+ """Fetch available apps from AgentR API.
78
+
79
+ Returns:
80
+ List[Dict[str, Any]]: A list of application data dictionaries.
81
+
82
+ Raises:
83
+ httpx.HTTPError: If the API request fails.
84
+ """
85
+ response = self.client.get("/apps/")
86
+ response.raise_for_status()
87
+ return response.json().get("items", [])
88
+
89
+ def list_my_apps(self) -> list[dict[str, Any]]:
90
+ """Fetch user apps from AgentR API.
91
+
92
+ Returns:
93
+ List[Dict[str, Any]]: A list of user app data dictionaries.
94
+ """
95
+ response = self.client.get("/apps/me/")
96
+ response.raise_for_status()
97
+ return response.json().get("items", [])
98
+
99
+ def list_my_connections(self) -> list[dict[str, Any]]:
100
+ """Fetch user connections from AgentR API.
101
+
102
+ Returns:
103
+ List[Dict[str, Any]]: A list of user connection data dictionaries.
104
+ """
105
+ response = self.client.get("/connections/")
106
+ response.raise_for_status()
107
+ return response.json().get("items", [])
108
+
109
+ def get_app_details(self, app_id: str) -> dict[str, Any]:
110
+ """Fetch a specific app from AgentR API.
111
+
112
+ Args:
113
+ app_id (str): ID of the app to fetch.
114
+
115
+ Returns:
116
+ dict: App configuration data.
117
+
118
+ Raises:
119
+ httpx.HTTPError: If the API request fails.
120
+ """
121
+ response = self.client.get(f"/apps/{app_id}")
122
+ response.raise_for_status()
123
+ return response.json()
124
+
125
+ def list_all_tools(self) -> list[dict[str, Any]]:
126
+ """List all available tools from the AgentR API.
127
+
128
+ Note: In the backend, tools are globally listed and not tied to a
129
+ specific app at this endpoint.
130
+
131
+ Returns:
132
+ List[Dict[str, Any]]: A list of tool configurations.
133
+ """
134
+ response = self.client.get("/tools/")
135
+ response.raise_for_status()
136
+ return response.json().get("items", [])
137
+
138
+ def get_tool_details(self, tool_id: str) -> dict[str, Any]:
139
+ """Fetch a specific tool configuration from the AgentR API.
140
+
141
+ Args:
142
+ tool_id (str): ID of the tool to fetch.
143
+
144
+ Returns:
145
+ dict: Tool configuration data.
146
+
147
+ Raises:
148
+ httpx.HTTPError: If the API request fails.
149
+ """
150
+ response = self.client.get(f"/tools/{tool_id}")
151
+ response.raise_for_status()
152
+ return response.json()
153
+
154
+ def search_all_apps(self, query: str, limit: int = 2) -> list[dict[str, Any]]:
155
+ """Search for apps from the AgentR API.
156
+
157
+ Args:
158
+ query (str): The query to search for.
159
+ limit (int, optional): The number of apps to return. Defaults to 2.
160
+
161
+ Returns:
162
+ List[Dict[str, Any]]: A list of app data dictionaries.
163
+ """
164
+ response = self.client.get("/apps/", params={"search": query, "limit": limit})
165
+ response.raise_for_status()
166
+ return response.json().get("items", [])
167
+
168
+ def search_all_tools(self, query: str, limit: int = 2) -> list[dict[str, Any]]:
169
+ """Search for tools from the AgentR API.
170
+
171
+ Args:
172
+ query (str): The query to search for.
173
+ limit (int, optional): The number of tools to return. Defaults to 2.
174
+ """
175
+ response = self.client.get("/tools/", params={"search": query, "limit": limit})
176
+ response.raise_for_status()
177
+ return response.json().get("items", [])
@@ -17,26 +17,22 @@ class AgentrRegistry(ToolRegistry):
17
17
  self.client = client or AgentrClient(**kwargs)
18
18
  logger.debug("AgentrRegistry initialized successfully")
19
19
 
20
- async def list_apps(self) -> list[dict[str, str]]:
20
+ def list_apps(self) -> list[dict[str, str]]:
21
21
  """Get list of available apps from AgentR.
22
22
 
23
23
  Returns:
24
24
  List of app dictionaries with id, name, description, and available fields
25
25
  """
26
+ if self.client is None:
27
+ raise ValueError("Client is not initialized")
26
28
  try:
27
- all_apps = await self.client.list_all_apps()
28
- available_apps = [
29
- {"id": app["id"], "name": app["name"], "description": app.get("description", "")}
30
- for app in all_apps
31
- if app.get("available", False)
32
- ]
33
- logger.info(f"Found {len(available_apps)} available apps from AgentR")
34
- return available_apps
29
+ all_apps = self.client.list_all_apps()
30
+ return all_apps
35
31
  except Exception as e:
36
32
  logger.error(f"Error fetching apps from AgentR: {e}")
37
33
  return []
38
34
 
39
- async def get_app_details(self, app_id: str) -> dict[str, str]:
35
+ def get_app_details(self, app_id: str) -> dict[str, str]:
40
36
  """Get detailed information about a specific app from AgentR.
41
37
 
42
38
  Args:
@@ -46,23 +42,11 @@ class AgentrRegistry(ToolRegistry):
46
42
  Dictionary containing app details
47
43
  """
48
44
  try:
49
- app_info = await self.client.fetch_app(app_id)
50
- return {
51
- "id": app_info.get("id"),
52
- "name": app_info.get("name"),
53
- "description": app_info.get("description"),
54
- "category": app_info.get("category"),
55
- "available": app_info.get("available", True),
56
- }
45
+ app_info = self.client.get_app_details(app_id)
46
+ return app_info
57
47
  except Exception as e:
58
48
  logger.error(f"Error getting details for app {app_id}: {e}")
59
- return {
60
- "id": app_id,
61
- "name": app_id,
62
- "description": "Error loading details",
63
- "category": "Unknown",
64
- "available": True,
65
- }
49
+ return {}
66
50
 
67
51
  def load_tools(self, tools: list[str] | None, tool_manager: ToolManager) -> None:
68
52
  """Load tools from AgentR and register them as tools.
@@ -89,3 +73,15 @@ class AgentrRegistry(ToolRegistry):
89
73
  app_instance = app(integration=integration)
90
74
  tool_manager.register_tools_from_app(app_instance, tool_names=tool_names)
91
75
  return
76
+
77
+ def search_tools(self, query: str, limit: int = 20) -> list[str]:
78
+ """Search for tools in AgentR.
79
+
80
+ Args:
81
+ query: The query to search for
82
+
83
+ Returns:
84
+ List of tool names
85
+ """
86
+ return self.client.search_all_tools(query, limit)
87
+
@@ -0,0 +1,6 @@
1
+ from universal_mcp.agents.auto import AutoAgent
2
+ from universal_mcp.agents.base import BaseAgent
3
+ from universal_mcp.agents.react import ReactAgent
4
+ from universal_mcp.agents.simple import SimpleAgent
5
+
6
+ __all__ = ["BaseAgent", "ReactAgent", "SimpleAgent", "AutoAgent"]
@@ -16,8 +16,8 @@ from universal_mcp.tools import ToolManager
16
16
  from universal_mcp.tools.adapters import ToolFormat
17
17
  from universal_mcp.tools.registry import ToolRegistry
18
18
 
19
- from .base import BaseAgent
20
- from .llm import get_llm
19
+ from universal_mcp.agents.base import BaseAgent
20
+ from universal_mcp.agents.llm import load_chat_model
21
21
 
22
22
  # Auto Agent
23
23
  # Working
@@ -61,9 +61,9 @@ class AutoAgent(BaseAgent):
61
61
  def __init__(self, name: str, instructions: str, model: str, app_registry: ToolRegistry):
62
62
  super().__init__(name, instructions, model)
63
63
  self.app_registry = app_registry
64
- self.llm_tools = get_llm(model, tags=["tools"])
65
- self.llm_choice = get_llm(model, tags=["choice"])
66
- self.llm_quiet = get_llm(model, tags=["quiet"])
64
+ self.llm_tools = load_chat_model(model, tags=["tools"])
65
+ self.llm_choice = load_chat_model(model, tags=["choice"])
66
+ self.llm_quiet = load_chat_model(model, tags=["quiet"])
67
67
  self.tool_manager = ToolManager()
68
68
 
69
69
  self.task_analysis_prompt = """You are a task analysis expert. Given a task description and available apps, determine:
@@ -522,7 +522,7 @@ Be friendly and concise, but list each set of apps clearly. Do not return any ot
522
522
  return result
523
523
 
524
524
  # Get all available apps from platform manager
525
- available_apps = await self.app_registry.list_apps()
525
+ available_apps = self.app_registry.list_apps()
526
526
 
527
527
  logger.info(f"Found {len(available_apps)} available apps")
528
528
 
@@ -563,10 +563,10 @@ if __name__ == "__main__":
563
563
 
564
564
  # Create platform manager
565
565
  app_registry = AgentrRegistry(api_key=agentr_api_key)
566
- want_instructions = input("Do you want to add a system prompt/instructions? (Y/N)")
566
+ want_instructions = input("Do you want to add a system prompt/instructions? (Y/N): ")
567
567
  instructions = "" if want_instructions.upper() == "N" else input("Enter your instructions/system prompt: ")
568
568
 
569
- agent = AutoAgent("Auto Agent", instructions, "gpt-4.1", app_registry=app_registry)
569
+ agent = AutoAgent("Auto Agent", instructions, "azure/gpt-4.1", app_registry=app_registry)
570
570
 
571
571
  print("AutoAgent created successfully!")
572
572
  print(f"Agent name: {agent.name}")
@@ -0,0 +1,35 @@
1
+ from universal_mcp.agentr.registry import AgentrRegistry
2
+ from universal_mcp.agents.base import BaseAgent
3
+ from universal_mcp.tools.manager import ToolManager
4
+ from universal_mcp.tools.registry import ToolRegistry
5
+
6
+ from universal_mcp.agents.autoagent.graph import create_agent
7
+
8
+
9
+ class AutoAgent(BaseAgent):
10
+ def __init__(
11
+ self,
12
+ name: str,
13
+ instructions: str,
14
+ model: str,
15
+ tool_registry: ToolRegistry | None = None,
16
+ tool_manager: ToolManager | None = None,
17
+ ):
18
+ super().__init__(name, instructions, model, tool_registry)
19
+ self.tool_registry = tool_registry or AgentrRegistry()
20
+ self.tool_manager = tool_manager or ToolManager()
21
+ self.model = model
22
+ self.name = name
23
+ self.instructions = instructions
24
+ self._graph = self._build_graph()
25
+
26
+ def _build_graph(self):
27
+ builder = create_agent(self.tool_registry, self.tool_manager, self.instructions)
28
+ return builder.compile()
29
+
30
+ @property
31
+ def graph(self):
32
+ return self._graph
33
+
34
+
35
+ __all__ = ["AutoAgent"]
@@ -0,0 +1,21 @@
1
+ import asyncio
2
+
3
+ from universal_mcp.agentr.registry import AgentrRegistry
4
+ from universal_mcp.agents.autoagent import AutoAgent
5
+
6
+
7
+ async def main():
8
+ agent = AutoAgent(
9
+ name="autoagent",
10
+ instructions="You are a helpful assistant that can use tools to help the user.",
11
+ model="azure/gpt-4o",
12
+ tool_registry=AgentrRegistry(),
13
+ )
14
+ result = await agent.run(
15
+ user_input="Send an email to Manoj from my google mail account, manoj@agentr.dev, with the subject 'Hello from auto agent' and the body 'testing'"
16
+ )
17
+ print(result)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ asyncio.run(main())
@@ -0,0 +1,25 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import Annotated
3
+
4
+ from universal_mcp.agents.autoagent.prompts import SYSTEM_PROMPT
5
+
6
+
7
+ @dataclass(kw_only=True)
8
+ class Context:
9
+ """The context for the agent."""
10
+
11
+ system_prompt: str = field(
12
+ default=SYSTEM_PROMPT,
13
+ metadata={
14
+ "description": "The system prompt to use for the agent's interactions. "
15
+ "This prompt sets the context and behavior for the agent."
16
+ },
17
+ )
18
+
19
+ model: Annotated[str, {"__template_metadata__": {"kind": "llm"}}] = field(
20
+ default="anthropic/claude-4-sonnet-20250514",
21
+ metadata={
22
+ "description": "The name of the language model to use for the agent's main interactions. "
23
+ "Should be in the form: provider/model-name."
24
+ },
25
+ )