universal-mcp 0.1.16__py3-none-any.whl → 0.1.18rc2__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/applications/application.py +1 -1
- universal_mcp/integrations/__init__.py +1 -1
- universal_mcp/integrations/integration.py +9 -9
- universal_mcp/servers/__init__.py +2 -2
- universal_mcp/tools/manager.py +24 -8
- {universal_mcp-0.1.16.dist-info → universal_mcp-0.1.18rc2.dist-info}/METADATA +2 -2
- {universal_mcp-0.1.16.dist-info → universal_mcp-0.1.18rc2.dist-info}/RECORD +10 -10
- {universal_mcp-0.1.16.dist-info → universal_mcp-0.1.18rc2.dist-info}/WHEEL +0 -0
- {universal_mcp-0.1.16.dist-info → universal_mcp-0.1.18rc2.dist-info}/entry_points.txt +0 -0
- {universal_mcp-0.1.16.dist-info → universal_mcp-0.1.18rc2.dist-info}/licenses/LICENSE +0 -0
@@ -81,7 +81,7 @@ class APIApplication(BaseApplication):
|
|
81
81
|
"""
|
82
82
|
super().__init__(name, **kwargs)
|
83
83
|
self.default_timeout: int = 180
|
84
|
-
self.integration
|
84
|
+
self.integration = integration
|
85
85
|
logger.debug(f"Initializing APIApplication '{name}' with integration: {integration}")
|
86
86
|
self._client: httpx.Client | None = client
|
87
87
|
self.base_url: str = ""
|
@@ -1,4 +1,3 @@
|
|
1
|
-
from abc import ABC, abstractmethod
|
2
1
|
from typing import Any
|
3
2
|
|
4
3
|
import httpx
|
@@ -18,7 +17,7 @@ def sanitize_api_key_name(name: str) -> str:
|
|
18
17
|
return f"{name.upper()}{suffix}"
|
19
18
|
|
20
19
|
|
21
|
-
class Integration
|
20
|
+
class Integration:
|
22
21
|
"""Abstract base class for handling application integrations and authentication.
|
23
22
|
|
24
23
|
This class defines the interface for different types of integrations that handle
|
@@ -35,9 +34,11 @@ class Integration(ABC):
|
|
35
34
|
|
36
35
|
def __init__(self, name: str, store: BaseStore | None = None):
|
37
36
|
self.name = name
|
38
|
-
|
37
|
+
if store is None:
|
38
|
+
self.store = MemoryStore()
|
39
|
+
else:
|
40
|
+
self.store = store
|
39
41
|
|
40
|
-
@abstractmethod
|
41
42
|
def authorize(self) -> str | dict[str, Any]:
|
42
43
|
"""Authorize the integration.
|
43
44
|
|
@@ -49,7 +50,6 @@ class Integration(ABC):
|
|
49
50
|
"""
|
50
51
|
pass
|
51
52
|
|
52
|
-
@abstractmethod
|
53
53
|
def get_credentials(self) -> dict[str, Any]:
|
54
54
|
"""Get credentials for the integration.
|
55
55
|
|
@@ -59,9 +59,9 @@ class Integration(ABC):
|
|
59
59
|
Raises:
|
60
60
|
NotAuthorizedError: If credentials are not found or invalid.
|
61
61
|
"""
|
62
|
-
|
62
|
+
credentials = self.store.get(self.name)
|
63
|
+
return credentials
|
63
64
|
|
64
|
-
@abstractmethod
|
65
65
|
def set_credentials(self, credentials: dict[str, Any]) -> None:
|
66
66
|
"""Set credentials for the integration.
|
67
67
|
|
@@ -71,7 +71,7 @@ class Integration(ABC):
|
|
71
71
|
Raises:
|
72
72
|
ValueError: If credentials are invalid or missing required fields.
|
73
73
|
"""
|
74
|
-
|
74
|
+
self.store.set(self.name, credentials)
|
75
75
|
|
76
76
|
|
77
77
|
class ApiKeyIntegration(Integration):
|
@@ -91,7 +91,7 @@ class ApiKeyIntegration(Integration):
|
|
91
91
|
store: Store instance for persisting credentials and other data
|
92
92
|
"""
|
93
93
|
|
94
|
-
def __init__(self, name: str, store: BaseStore =
|
94
|
+
def __init__(self, name: str, store: BaseStore | None = None, **kwargs):
|
95
95
|
self.type = "api_key"
|
96
96
|
sanitized_name = sanitize_api_key_name(name)
|
97
97
|
super().__init__(sanitized_name, store, **kwargs)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
from universal_mcp.config import ServerConfig
|
2
|
-
from universal_mcp.servers.server import AgentRServer, LocalServer, SingleMCPServer
|
2
|
+
from universal_mcp.servers.server import AgentRServer, BaseServer, LocalServer, SingleMCPServer
|
3
3
|
|
4
4
|
|
5
5
|
def server_from_config(config: ServerConfig):
|
@@ -12,4 +12,4 @@ def server_from_config(config: ServerConfig):
|
|
12
12
|
raise ValueError(f"Unsupported server type: {config.type}")
|
13
13
|
|
14
14
|
|
15
|
-
__all__ = [AgentRServer, LocalServer, SingleMCPServer, server_from_config]
|
15
|
+
__all__ = [AgentRServer, LocalServer, SingleMCPServer, BaseServer, server_from_config]
|
universal_mcp/tools/manager.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import re
|
1
2
|
from collections.abc import Callable
|
2
3
|
from typing import Any
|
3
4
|
|
@@ -19,14 +20,21 @@ DEFAULT_IMPORTANT_TAG = "important"
|
|
19
20
|
TOOL_NAME_SEPARATOR = "_"
|
20
21
|
|
21
22
|
|
22
|
-
def _filter_by_name(tools: list[Tool], tool_names: list[str]) -> list[Tool]:
|
23
|
+
def _filter_by_name(tools: list[Tool], tool_names: list[str] | None) -> list[Tool]:
|
23
24
|
if not tool_names:
|
24
25
|
return tools
|
25
|
-
|
26
|
+
logger.debug(f"Filtering tools by name: {tool_names}")
|
27
|
+
filtered_tools = []
|
28
|
+
for tool in tools:
|
29
|
+
for name in tool_names:
|
30
|
+
if re.search(name, tool.name):
|
31
|
+
filtered_tools.append(tool)
|
32
|
+
return filtered_tools
|
26
33
|
|
27
34
|
|
28
35
|
def _filter_by_tags(tools: list[Tool], tags: list[str] | None) -> list[Tool]:
|
29
|
-
|
36
|
+
if not tags:
|
37
|
+
return tools
|
30
38
|
return [tool for tool in tools if any(tag in tool.tags for tag in tags)]
|
31
39
|
|
32
40
|
|
@@ -148,14 +156,14 @@ class ToolManager:
|
|
148
156
|
def register_tools_from_app(
|
149
157
|
self,
|
150
158
|
app: BaseApplication,
|
151
|
-
tool_names: list[str] = None,
|
152
|
-
tags: list[str] = None,
|
159
|
+
tool_names: list[str] | None = None,
|
160
|
+
tags: list[str] | None = None,
|
153
161
|
) -> None:
|
154
162
|
"""Register tools from an application.
|
155
163
|
|
156
164
|
Args:
|
157
165
|
app: The application to register tools from.
|
158
|
-
|
166
|
+
tool_names: Optional list of specific tool names to register.
|
159
167
|
tags: Optional list of tags to filter tools by.
|
160
168
|
"""
|
161
169
|
try:
|
@@ -186,8 +194,16 @@ class ToolManager:
|
|
186
194
|
tool_name = getattr(function, "__name__", "unknown")
|
187
195
|
logger.error(f"Failed to create Tool from '{tool_name}' in {app.name}: {e}")
|
188
196
|
|
189
|
-
|
190
|
-
|
197
|
+
if tags:
|
198
|
+
tools = _filter_by_tags(tools, tags)
|
199
|
+
|
200
|
+
if tool_names:
|
201
|
+
tools = _filter_by_name(tools, tool_names)
|
202
|
+
|
203
|
+
# If no tool names or tags are provided, use the default important tag
|
204
|
+
if not tool_names and not tags:
|
205
|
+
tools = _filter_by_tags(tools, [DEFAULT_IMPORTANT_TAG])
|
206
|
+
|
191
207
|
self.register_tools(tools)
|
192
208
|
return
|
193
209
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: universal-mcp
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.18rc2
|
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
|
@@ -14,7 +14,7 @@ Requires-Dist: keyring>=25.6.0
|
|
14
14
|
Requires-Dist: langchain-mcp-adapters>=0.0.3
|
15
15
|
Requires-Dist: litellm>=1.30.7
|
16
16
|
Requires-Dist: loguru>=0.7.3
|
17
|
-
Requires-Dist: mcp>=1.
|
17
|
+
Requires-Dist: mcp>=1.8.1
|
18
18
|
Requires-Dist: posthog>=3.24.0
|
19
19
|
Requires-Dist: pydantic-settings>=2.8.1
|
20
20
|
Requires-Dist: pydantic>=2.11.1
|
@@ -7,12 +7,12 @@ universal_mcp/logger.py,sha256=VmH_83efpErLEDTJqz55Dp0dioTXfGvMBLZUx5smOLc,2116
|
|
7
7
|
universal_mcp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
8
|
universal_mcp/applications/README.md,sha256=eqbizxaTxKH2O1tyIJR2yI0Db5TQxtgPd_vbpWyCa2Y,3527
|
9
9
|
universal_mcp/applications/__init__.py,sha256=yDLrQhICcvoSf8KTLkKOdqcG1N7c4UOYL3tNIjAo2kk,3182
|
10
|
-
universal_mcp/applications/application.py,sha256=
|
10
|
+
universal_mcp/applications/application.py,sha256=ObxkufxEyvl7WBKneZdQOl5Wdmo9KSnujfIf7dsQKEI,13751
|
11
11
|
universal_mcp/integrations/README.md,sha256=lTAPXO2nivcBe1q7JT6PRa6v9Ns_ZersQMIdw-nmwEA,996
|
12
|
-
universal_mcp/integrations/__init__.py,sha256=
|
13
|
-
universal_mcp/integrations/integration.py,sha256=
|
12
|
+
universal_mcp/integrations/__init__.py,sha256=X8iEzs02IlXfeafp6GMm-cOkg70QdjnlTRuFo24KEfo,916
|
13
|
+
universal_mcp/integrations/integration.py,sha256=QvZlq3G5OU4tHPv9uq9Nv5NFe30NdUsJU-Av474n0_o,13154
|
14
14
|
universal_mcp/servers/README.md,sha256=ytFlgp8-LO0oogMrHkMOp8SvFTwgsKgv7XhBVZGNTbM,2284
|
15
|
-
universal_mcp/servers/__init__.py,sha256=
|
15
|
+
universal_mcp/servers/__init__.py,sha256=eBZCsaZjiEv6ZlRRslPKgurQxmpHLQyiXv2fTBygHnM,532
|
16
16
|
universal_mcp/servers/server.py,sha256=1UWvywUzgGVYyIGlaES9tgj_xP_f6EC4bK_vM0nE_tE,9237
|
17
17
|
universal_mcp/stores/README.md,sha256=jrPh_ow4ESH4BDGaSafilhOVaN8oQ9IFlFW-j5Z5hLA,2465
|
18
18
|
universal_mcp/stores/__init__.py,sha256=quvuwhZnpiSLuojf0NfmBx2xpaCulv3fbKtKaSCEmuM,603
|
@@ -21,7 +21,7 @@ universal_mcp/tools/README.md,sha256=RuxliOFqV1ZEyeBdj3m8UKfkxAsfrxXh-b6V4ZGAk8I
|
|
21
21
|
universal_mcp/tools/__init__.py,sha256=Fatza_R0qYWmNF1WQSfUZZKQFu5qf-16JhZzdmyx3KY,333
|
22
22
|
universal_mcp/tools/adapters.py,sha256=gz_sNDc_bseMHWmpQmqhOq65veE-DuK_kJYXGIx0Wi8,1427
|
23
23
|
universal_mcp/tools/func_metadata.py,sha256=zIDXgIBvu5Gh8aNlg-Q7cZZos9Iky75MS0Me0BraXeM,8086
|
24
|
-
universal_mcp/tools/manager.py,sha256=
|
24
|
+
universal_mcp/tools/manager.py,sha256=GMBKPl-W6zoyK6Hisiz-i9WROsV8W7VC9Vou8d55rXA,7983
|
25
25
|
universal_mcp/tools/tools.py,sha256=8YBTaJCM38Nhan9Al6Vlq4FtSULrKlxg1q_o8OL1_FM,3322
|
26
26
|
universal_mcp/utils/__init__.py,sha256=8wi4PGWu-SrFjNJ8U7fr2iFJ1ktqlDmSKj1xYd7KSDc,41
|
27
27
|
universal_mcp/utils/agentr.py,sha256=GlFK5_RJXP3XpIGKLzkIe5nu2rfT6bqSoT0h1hipy9g,3438
|
@@ -37,8 +37,8 @@ universal_mcp/utils/openapi/preprocessor.py,sha256=qLYv4ekors5B2OU_YUvXICYQ7XYhA
|
|
37
37
|
universal_mcp/utils/openapi/readme.py,sha256=R2Jp7DUXYNsXPDV6eFTkLiy7MXbSULUj1vHh4O_nB4c,2974
|
38
38
|
universal_mcp/utils/templates/README.md.j2,sha256=Mrm181YX-o_-WEfKs01Bi2RJy43rBiq2j6fTtbWgbTA,401
|
39
39
|
universal_mcp/utils/templates/api_client.py.j2,sha256=972Im7LNUAq3yZTfwDcgivnb-b8u6_JLKWXwoIwXXXQ,908
|
40
|
-
universal_mcp-0.1.
|
41
|
-
universal_mcp-0.1.
|
42
|
-
universal_mcp-0.1.
|
43
|
-
universal_mcp-0.1.
|
44
|
-
universal_mcp-0.1.
|
40
|
+
universal_mcp-0.1.18rc2.dist-info/METADATA,sha256=mUp7-GIgVvEJ0EXC-_E1ElgkBk37OjOtpF4baB8-gd8,12125
|
41
|
+
universal_mcp-0.1.18rc2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
42
|
+
universal_mcp-0.1.18rc2.dist-info/entry_points.txt,sha256=QlBrVKmA2jIM0q-C-3TQMNJTTWOsOFQvgedBq2rZTS8,56
|
43
|
+
universal_mcp-0.1.18rc2.dist-info/licenses/LICENSE,sha256=NweDZVPslBAZFzlgByF158b85GR0f5_tLQgq1NS48To,1063
|
44
|
+
universal_mcp-0.1.18rc2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|