universal-mcp 0.1.6__py3-none-any.whl → 0.1.7rc1__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.
@@ -1,6 +1,6 @@
1
1
  from e2b_code_interpreter import Sandbox
2
2
  from loguru import logger
3
-
3
+ from typing import Annotated
4
4
  from universal_mcp.applications.application import APIApplication
5
5
  from universal_mcp.integrations import Integration
6
6
 
@@ -50,7 +50,9 @@ class E2BApp(APIApplication):
50
50
  return "Execution finished with no output (stdout/stderr)."
51
51
  return "\n\n".join(output_parts)
52
52
 
53
- def execute_python_code(self, code: str) -> str:
53
+ def execute_python_code(
54
+ self, code: Annotated[str, "The Python code to execute."]
55
+ ) -> str:
54
56
  """
55
57
  Executes Python code within a secure E2B cloud sandbox.
56
58
 
@@ -61,6 +63,9 @@ class E2BApp(APIApplication):
61
63
  A string containing the formatted standard output (stdout) and standard error (stderr)
62
64
  from the execution. If an error occurs during setup or execution, an
63
65
  error message string is returned.
66
+
67
+ Raises:
68
+ NotAuthorizedError: If the API key is not set.
64
69
  """
65
70
  self._set_api_key()
66
71
  with Sandbox(api_key=self.api_key) as sandbox:
@@ -2,6 +2,7 @@ from typing import Any, Literal
2
2
 
3
3
  from universal_mcp.applications.application import APIApplication
4
4
  from universal_mcp.integrations import Integration
5
+ from loguru import logger
5
6
 
6
7
 
7
8
  class PerplexityApp(APIApplication):
@@ -18,26 +19,40 @@ class PerplexityApp(APIApplication):
18
19
  raise ValueError("Integration is None. Cannot retrieve Perplexity API Key.")
19
20
 
20
21
  credentials = self.integration.get_credentials()
21
- if not credentials:
22
- raise ValueError(
22
+ if not credentials or "apiKey" not in credentials:
23
+ raise ValueError(
23
24
  f"Failed to retrieve Perplexity API Key using integration '{self.integration.name}'. "
24
- )
25
-
26
- if not isinstance(credentials, str) or not credentials.strip():
27
- raise ValueError(
28
- f"Invalid credential format received for Perplexity API Key via integration '{self.integration.name}'. "
29
25
  )
30
- self.api_key = credentials
26
+
27
+ # if not isinstance(credentials, str) or not credentials.strip():
28
+ # raise ValueError(
29
+ # f"Invalid credential format received for Perplexity API Key via integration '{self.integration.name}'. "
30
+ # )
31
+ self.api_key = credentials["apiKey"]
31
32
 
32
33
  def _get_headers(self) -> dict[str, str]:
33
34
  self._set_api_key()
35
+ logger.info(f"Perplexity API Key: {self.api_key}")
34
36
  return {
35
37
  "Authorization": f"Bearer {self.api_key}",
36
38
  "Content-Type": "application/json",
37
39
  "Accept": "application/json",
38
40
  }
39
41
 
40
- def chat(self, query: str, model: Literal["r1-1776","sonar","sonar-pro","sonar-reasoning","sonar-reasoning-pro", "sonar-deep-research"] = "sonar" , temperature: float = 1, system_prompt: str = "Be precise and concise.") -> dict[str, Any] | str:
42
+ def chat(
43
+ self,
44
+ query: str,
45
+ model: Literal[
46
+ "r1-1776",
47
+ "sonar",
48
+ "sonar-pro",
49
+ "sonar-reasoning",
50
+ "sonar-reasoning-pro",
51
+ "sonar-deep-research",
52
+ ] = "sonar",
53
+ temperature: float = 1,
54
+ system_prompt: str = "Be precise and concise.",
55
+ ) -> dict[str, Any] | str:
41
56
  """
42
57
  Sends a query to a Perplexity Sonar online model and returns the response.
43
58
 
@@ -69,11 +84,11 @@ class PerplexityApp(APIApplication):
69
84
 
70
85
  data = self._post(endpoint, data=payload)
71
86
  response = data.json()
72
- content = response['choices'][0]['message']['content']
73
- citations = response.get('citations', [])
87
+ content = response["choices"][0]["message"]["content"]
88
+ citations = response.get("citations", [])
74
89
  return {"content": content, "citations": citations}
75
90
 
76
91
  def list_tools(self):
77
92
  return [
78
93
  self.chat,
79
- ]
94
+ ]
universal_mcp/config.py CHANGED
@@ -10,7 +10,7 @@ class StoreConfig(BaseModel):
10
10
 
11
11
  class IntegrationConfig(BaseModel):
12
12
  name: str
13
- type: Literal["api_key", "oauth", "agentr"]
13
+ type: Literal["api_key", "oauth", "agentr", "oauth2"]
14
14
  credentials: dict | None = None
15
15
  store: StoreConfig | None = None
16
16
 
@@ -115,7 +115,11 @@ class LocalServer(Server):
115
115
  tool_name = tool.__name__
116
116
  name = app.name + "_" + tool_name
117
117
  description = tool.__doc__
118
- if app_config.actions is None or tool_name in app_config.actions:
118
+ if (
119
+ app_config.actions is None
120
+ or len(app_config.actions) == 0
121
+ or name in app_config.actions
122
+ ):
119
123
  self.add_tool(tool, name=name, description=description)
120
124
  except Exception as e:
121
125
  logger.error(f"Error loading app {app_config.name}: {e}")
@@ -167,7 +171,11 @@ class AgentRServer(Server):
167
171
  tool_name = tool.__name__
168
172
  name = app.name + "_" + tool_name
169
173
  description = tool.__doc__
170
- if app_config.actions is None or tool_name in app_config.actions:
174
+ if (
175
+ app_config.actions is None
176
+ or len(app_config.actions) == 0
177
+ or name in app_config.actions
178
+ ):
171
179
  self.add_tool(tool, name=name, description=description)
172
180
  except Exception as e:
173
181
  logger.error(f"Error loading app {app_config.name}: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: universal-mcp
3
- Version: 0.1.6
3
+ Version: 0.1.7rc1
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
  Requires-Python: >=3.11
@@ -1,13 +1,13 @@
1
1
  universal_mcp/__init__.py,sha256=2gdHpHaDDcsRjZjJ01FLN-1iidN_wbDAolNpxhGoFB4,59
2
2
  universal_mcp/cli.py,sha256=DG-Qxc5vQIdbhAIQuU7bKKJuRGzwyOigjfCKSWBRhBI,5258
3
- universal_mcp/config.py,sha256=9eb3DDg4PBBr1MlGeBrA4bja3Y6howOH-UKpo7JIbs8,828
3
+ universal_mcp/config.py,sha256=sJaPI4q51CDPPG0z32rMJiE7a64eaa9nxbjJgYnaFA4,838
4
4
  universal_mcp/exceptions.py,sha256=Zp2_v_m3L7GDAmD1ZyuwFtY6ngapdhxuIygrvpZAQtM,271
5
5
  universal_mcp/logger.py,sha256=W6A868vyvpdkEQ4Dd0rWdC_7ErSxSQ1z2uxCb77IM8Y,2015
6
6
  universal_mcp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  universal_mcp/applications/__init__.py,sha256=qeWnbdIudyMR7ST4XTc0gpEM9o6TsM1ZnZ92dMAPSBA,754
8
8
  universal_mcp/applications/application.py,sha256=dqp8lgIi2xhY62imwo7C6769URQtNmqd6Ok6PiTr6wc,3399
9
9
  universal_mcp/applications/e2b/README.md,sha256=S4lTp-vEZ8VTCKPXqjUXu5nYlUMAF8lw8CQyBGPgxjs,700
10
- universal_mcp/applications/e2b/app.py,sha256=5piCipi1TC_KuKLFP17do1Y1r28fqApvRsZy76equ9w,2573
10
+ universal_mcp/applications/e2b/app.py,sha256=dC6TFhN9NYzZqmJno47ZCU01Un7M3HlqNxuXx7UEOso,2733
11
11
  universal_mcp/applications/firecrawl/README.md,sha256=KAWe_TQbrc9eA6bSyde5dapMP1CNvarVItV_YJH3d_0,1430
12
12
  universal_mcp/applications/firecrawl/app.py,sha256=RSy8zRn4k1A1tIpJNqrUnPI8ctEv1nKWuOuJQcp9mGo,9264
13
13
  universal_mcp/applications/github/README.md,sha256=6ID-__gUJ5ZxzAS_OjzmoUAag1LamSvEB75DHcj3m-g,1294
@@ -26,7 +26,7 @@ universal_mcp/applications/notion/README.md,sha256=45NmPOmSQv99qBvWdwmnV5vbaYc9_
26
26
  universal_mcp/applications/notion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  universal_mcp/applications/notion/app.py,sha256=XpLnmeXj0Gnf_RYHlbAFnwtSCTYsrNzk6MSMSyDmHGQ,17283
28
28
  universal_mcp/applications/perplexity/README.md,sha256=QGV1iReH5p-Np7vvkZsVHxxDKQ0YaitHEwomNmGEyQs,732
29
- universal_mcp/applications/perplexity/app.py,sha256=J27IDcz9pRC_uW4wABpn-EcI4RvKIzoh_o2hzysM5wA,3187
29
+ universal_mcp/applications/perplexity/app.py,sha256=81cR_UUyBlAzonq0GsSuV6w2XxLsKIiMelJDc8h5Fxw,3444
30
30
  universal_mcp/applications/reddit/README.md,sha256=YVbJ1RN6NWlB-P6w2LxCk_DuUWl7mwaKZScY-mIMnNc,1271
31
31
  universal_mcp/applications/reddit/app.py,sha256=leU__w5VxX1vMK-kfuy-dvY97Pn8Mn80X2payVshirU,13562
32
32
  universal_mcp/applications/resend/README.md,sha256=k-sb2UwbFvDPEz6qQPLWd2cJj8hDx5f3NW7dz2jAfjI,719
@@ -42,7 +42,7 @@ universal_mcp/integrations/__init__.py,sha256=8e11JZyctaR9CmlNkfEZ6HhGDvhlvf9iug
42
42
  universal_mcp/integrations/agentr.py,sha256=l0mo79oeDML19udFfoCo9lyhbDAf0X94_lnpOgbTrb0,3331
43
43
  universal_mcp/integrations/integration.py,sha256=8TYr7N1F6oV8PPOSLo0eA_6nD-vrwIWbuplqwD03uuQ,5819
44
44
  universal_mcp/servers/__init__.py,sha256=dgRW_khG537GeLKC5_U5jhxCuu1L_1YeTujeDg0601E,654
45
- universal_mcp/servers/server.py,sha256=uHArnw_kYIhvlE-Zp5GharGqapGy4jaOlxRQGsOafPM,6431
45
+ universal_mcp/servers/server.py,sha256=9GazpAzNiMgCMg4Vb4VeyoviddEt6pQzi7vLli8vC5A,6677
46
46
  universal_mcp/stores/__init__.py,sha256=Sc4AWtee_qtK5hpEVUAH2XM_6EBhcfikQXWiGXdNfes,560
47
47
  universal_mcp/stores/store.py,sha256=CNOnmKeOCkSU2ZA9t12AIWJcmqZZX_LSyZaV8FQf8Xk,4545
48
48
  universal_mcp/utils/__init__.py,sha256=8wi4PGWu-SrFjNJ8U7fr2iFJ1ktqlDmSKj1xYd7KSDc,41
@@ -52,7 +52,7 @@ universal_mcp/utils/docgen.py,sha256=yK6Ijo8G-wHPU3E1AnFpnXS9vXt2j9FM77w0etTaNOA
52
52
  universal_mcp/utils/dump_app_tools.py,sha256=cLB9SumKsbs-rXJ_02lpMyyNkOmKZ57gekhCjhAlcHg,2009
53
53
  universal_mcp/utils/installation.py,sha256=uSL_H76fG_7yN4QNxkfp1mEF_00iAPyiXqtdWEMVJe8,3747
54
54
  universal_mcp/utils/openapi.py,sha256=ud_ZB7_60BcS1Vao7ESKDqo0gry9JN5wzy-CFssrjm8,13140
55
- universal_mcp-0.1.6.dist-info/METADATA,sha256=8R7LIzbEuCr2cB6yaLxZG8HD9ISZz_H0jJqquPXSiaw,10852
56
- universal_mcp-0.1.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
57
- universal_mcp-0.1.6.dist-info/entry_points.txt,sha256=QlBrVKmA2jIM0q-C-3TQMNJTTWOsOFQvgedBq2rZTS8,56
58
- universal_mcp-0.1.6.dist-info/RECORD,,
55
+ universal_mcp-0.1.7rc1.dist-info/METADATA,sha256=mwq5fSI-AWh4t7sJXfgooEnhI19wmVeD75uPjutsboI,10855
56
+ universal_mcp-0.1.7rc1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
57
+ universal_mcp-0.1.7rc1.dist-info/entry_points.txt,sha256=QlBrVKmA2jIM0q-C-3TQMNJTTWOsOFQvgedBq2rZTS8,56
58
+ universal_mcp-0.1.7rc1.dist-info/RECORD,,