universal-mcp 0.1.23rc1__py3-none-any.whl → 0.1.24rc2__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/analytics.py +43 -11
- universal_mcp/applications/application.py +186 -239
- universal_mcp/applications/sample_tool_app.py +80 -0
- universal_mcp/cli.py +5 -228
- universal_mcp/client/agents/__init__.py +4 -0
- universal_mcp/client/agents/base.py +38 -0
- universal_mcp/client/agents/llm.py +115 -0
- universal_mcp/client/agents/react.py +67 -0
- universal_mcp/client/cli.py +181 -0
- universal_mcp/client/oauth.py +218 -0
- universal_mcp/client/token_store.py +91 -0
- universal_mcp/client/transport.py +277 -0
- universal_mcp/config.py +201 -28
- universal_mcp/exceptions.py +50 -6
- universal_mcp/integrations/__init__.py +1 -4
- universal_mcp/integrations/integration.py +220 -121
- universal_mcp/servers/__init__.py +1 -1
- universal_mcp/servers/server.py +114 -247
- universal_mcp/stores/store.py +126 -93
- universal_mcp/tools/adapters.py +16 -0
- universal_mcp/tools/func_metadata.py +1 -1
- universal_mcp/tools/manager.py +15 -3
- universal_mcp/tools/tools.py +2 -2
- universal_mcp/utils/agentr.py +3 -4
- universal_mcp/utils/installation.py +3 -4
- universal_mcp/utils/openapi/api_generator.py +28 -2
- universal_mcp/utils/openapi/api_splitter.py +8 -19
- universal_mcp/utils/openapi/cli.py +243 -0
- universal_mcp/utils/openapi/filters.py +114 -0
- universal_mcp/utils/openapi/openapi.py +45 -12
- universal_mcp/utils/openapi/preprocessor.py +62 -7
- universal_mcp/utils/prompts.py +787 -0
- universal_mcp/utils/singleton.py +4 -1
- universal_mcp/utils/testing.py +6 -6
- universal_mcp-0.1.24rc2.dist-info/METADATA +54 -0
- universal_mcp-0.1.24rc2.dist-info/RECORD +53 -0
- universal_mcp/applications/README.md +0 -122
- universal_mcp/integrations/README.md +0 -25
- universal_mcp/servers/README.md +0 -79
- universal_mcp/stores/README.md +0 -74
- universal_mcp/tools/README.md +0 -86
- universal_mcp-0.1.23rc1.dist-info/METADATA +0 -283
- universal_mcp-0.1.23rc1.dist-info/RECORD +0 -46
- /universal_mcp/{utils → tools}/docstring_parser.py +0 -0
- {universal_mcp-0.1.23rc1.dist-info → universal_mcp-0.1.24rc2.dist-info}/WHEEL +0 -0
- {universal_mcp-0.1.23rc1.dist-info → universal_mcp-0.1.24rc2.dist-info}/entry_points.txt +0 -0
- {universal_mcp-0.1.23rc1.dist-info → universal_mcp-0.1.24rc2.dist-info}/licenses/LICENSE +0 -0
universal_mcp/analytics.py
CHANGED
@@ -8,6 +8,14 @@ from loguru import logger
|
|
8
8
|
|
9
9
|
|
10
10
|
class Analytics:
|
11
|
+
"""A singleton class for tracking analytics events using PostHog.
|
12
|
+
|
13
|
+
This class handles the initialization of the PostHog client and provides
|
14
|
+
methods to track key events such as application loading and tool execution.
|
15
|
+
Telemetry can be disabled by setting the TELEMETRY_DISABLED environment
|
16
|
+
variable to "true".
|
17
|
+
"""
|
18
|
+
|
11
19
|
_instance = None
|
12
20
|
|
13
21
|
def __new__(cls):
|
@@ -17,7 +25,13 @@ class Analytics:
|
|
17
25
|
return cls._instance
|
18
26
|
|
19
27
|
def _initialize(self):
|
20
|
-
"""
|
28
|
+
"""Initializes the PostHog client and sets up analytics properties.
|
29
|
+
|
30
|
+
This internal method configures the PostHog API key and host.
|
31
|
+
It also determines if analytics should be enabled based on the
|
32
|
+
TELEMETRY_DISABLED environment variable and generates a unique
|
33
|
+
user ID.
|
34
|
+
"""
|
21
35
|
posthog.host = "https://us.i.posthog.com"
|
22
36
|
posthog.api_key = "phc_6HXMDi8CjfIW0l04l34L7IDkpCDeOVz9cOz1KLAHXh8"
|
23
37
|
self.enabled = os.getenv("TELEMETRY_DISABLED", "false").lower() != "true"
|
@@ -26,16 +40,27 @@ class Analytics:
|
|
26
40
|
@staticmethod
|
27
41
|
@lru_cache(maxsize=1)
|
28
42
|
def get_version():
|
29
|
-
"""
|
30
|
-
|
43
|
+
"""Retrieves the installed version of the universal_mcp package.
|
44
|
+
|
45
|
+
Uses importlib.metadata to get the package version.
|
46
|
+
Caches the result for efficiency.
|
47
|
+
|
48
|
+
Returns:
|
49
|
+
str: The package version string, or "unknown" if not found.
|
31
50
|
"""
|
32
51
|
try:
|
33
52
|
return version("universal_mcp")
|
34
|
-
except ImportError:
|
53
|
+
except ImportError: # Should be PackageNotFoundError, but matching existing code
|
35
54
|
return "unknown"
|
36
55
|
|
37
56
|
def track_app_loaded(self, app_name: str):
|
38
|
-
"""
|
57
|
+
"""Tracks an event when an application is successfully loaded.
|
58
|
+
|
59
|
+
This event helps understand which applications are being utilized.
|
60
|
+
|
61
|
+
Args:
|
62
|
+
app_name (str): The name of the application that was loaded.
|
63
|
+
"""
|
39
64
|
if not self.enabled:
|
40
65
|
return
|
41
66
|
try:
|
@@ -53,15 +78,22 @@ class Analytics:
|
|
53
78
|
app_name: str,
|
54
79
|
status: str,
|
55
80
|
error: str = None,
|
56
|
-
user_id=None,
|
81
|
+
user_id=None, # Note: user_id is captured in PostHog but not used from this param
|
57
82
|
):
|
58
|
-
"""
|
83
|
+
"""Tracks an event when a tool is called within an application.
|
84
|
+
|
85
|
+
This event provides insights into tool usage patterns, success rates,
|
86
|
+
and potential errors.
|
59
87
|
|
60
88
|
Args:
|
61
|
-
tool_name:
|
62
|
-
|
63
|
-
|
64
|
-
|
89
|
+
tool_name (str): The name of the tool that was called.
|
90
|
+
app_name (str): The name of the application the tool belongs to.
|
91
|
+
status (str): The status of the tool call (e.g., "success", "error").
|
92
|
+
error (str, optional): The error message if the tool call failed.
|
93
|
+
Defaults to None.
|
94
|
+
user_id (str, optional): An optional user identifier.
|
95
|
+
Note: Currently, the class uses an internally
|
96
|
+
generated user_id for PostHog events.
|
65
97
|
"""
|
66
98
|
if not self.enabled:
|
67
99
|
return
|