alita-sdk 0.3.443__py3-none-any.whl → 0.3.444__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.

Potentially problematic release.


This version of alita-sdk might be problematic. Click here for more details.

@@ -558,6 +558,14 @@ class McpToolkit(BaseToolkit):
558
558
  metadata = {}
559
559
  metadata['authorization_servers'] = inferred_servers
560
560
  logger.info(f"Inferred authorization servers for {connection_config.url}: {inferred_servers}")
561
+
562
+ # Fetch OAuth authorization server metadata from the inferred server
563
+ # This avoids CORS issues in the frontend
564
+ from alita_sdk.runtime.utils.mcp_oauth import fetch_oauth_authorization_server_metadata
565
+ auth_server_metadata = fetch_oauth_authorization_server_metadata(inferred_servers[0], timeout=timeout)
566
+ if auth_server_metadata:
567
+ metadata['oauth_authorization_server'] = auth_server_metadata
568
+ logger.info(f"Fetched OAuth metadata for {inferred_servers[0]}")
561
569
 
562
570
  raise McpAuthorizationRequired(
563
571
  message=f"MCP server {connection_config.url} requires OAuth authorization",
@@ -140,6 +140,14 @@ class McpRemoteTool(McpServerTool):
140
140
  metadata = {}
141
141
  metadata['authorization_servers'] = inferred_servers
142
142
  logger.info(f"Inferred authorization servers for {self.server_url}: {inferred_servers}")
143
+
144
+ # Fetch OAuth authorization server metadata from the inferred server
145
+ # This avoids CORS issues in the frontend
146
+ from alita_sdk.runtime.utils.mcp_oauth import fetch_oauth_authorization_server_metadata
147
+ auth_server_metadata = fetch_oauth_authorization_server_metadata(inferred_servers[0], timeout=self.tool_timeout_sec)
148
+ if auth_server_metadata:
149
+ metadata['oauth_authorization_server'] = auth_server_metadata
150
+ logger.info(f"Fetched OAuth metadata for {inferred_servers[0]}")
143
151
 
144
152
  raise McpAuthorizationRequired(
145
153
  message=f"MCP server {self.server_url} requires OAuth authorization",
@@ -63,6 +63,28 @@ def extract_resource_metadata_url(www_authenticate: Optional[str], server_url: O
63
63
  return None
64
64
 
65
65
 
66
+ def fetch_oauth_authorization_server_metadata(base_url: str, timeout: int = 10) -> Optional[Dict[str, Any]]:
67
+ """
68
+ Fetch OAuth authorization server metadata from well-known endpoints.
69
+ Tries both oauth-authorization-server and openid-configuration discovery endpoints.
70
+ """
71
+ discovery_endpoints = [
72
+ f"{base_url}/.well-known/oauth-authorization-server",
73
+ f"{base_url}/.well-known/openid-configuration",
74
+ ]
75
+
76
+ for endpoint in discovery_endpoints:
77
+ try:
78
+ resp = requests.get(endpoint, timeout=timeout)
79
+ if resp.status_code == 200:
80
+ return resp.json()
81
+ except Exception as exc:
82
+ logger.debug(f"Failed to fetch OAuth metadata from {endpoint}: {exc}")
83
+ continue
84
+
85
+ return None
86
+
87
+
66
88
  def infer_authorization_servers_from_realm(www_authenticate: Optional[str], server_url: str) -> Optional[list]:
67
89
  """
68
90
  Infer authorization server URLs from WWW-Authenticate realm or server URL.
@@ -84,16 +106,9 @@ def infer_authorization_servers_from_realm(www_authenticate: Optional[str], serv
84
106
  parsed = urlparse(server_url)
85
107
  base_url = f"{parsed.scheme}://{parsed.netloc}"
86
108
 
87
- # For OAuth 2.1 / OpenID Connect, try standard well-known endpoints
88
- # These are the most common discovery endpoints
89
- if realm and realm.lower() == "oauth":
90
- # Standard OAuth 2.0 / 2.1 discovery endpoints
91
- authorization_servers.append(f"{base_url}/.well-known/oauth-authorization-server")
92
- authorization_servers.append(f"{base_url}/.well-known/openid-configuration")
93
- else:
94
- # If no realm or different realm, still try standard endpoints
95
- authorization_servers.append(f"{base_url}/.well-known/oauth-authorization-server")
96
- authorization_servers.append(f"{base_url}/.well-known/openid-configuration")
109
+ # Return the base authorization server URL (not the discovery endpoint)
110
+ # The client will append .well-known paths when fetching metadata
111
+ authorization_servers.append(base_url)
97
112
 
98
113
  return authorization_servers if authorization_servers else None
99
114
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alita_sdk
3
- Version: 0.3.443
3
+ Version: 0.3.444
4
4
  Summary: SDK for building langchain agents using resources from Alita
5
5
  Author-email: Artem Rozumenko <artyom.rozumenko@gmail.com>, Mikalai Biazruchka <mikalai_biazruchka@epam.com>, Roman Mitusov <roman_mitusov@epam.com>, Ivan Krakhmaliuk <lifedj27@gmail.com>, Artem Dubrovskiy <ad13box@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -103,7 +103,7 @@ alita_sdk/runtime/toolkits/application.py,sha256=HHAKgwKOckxc7EQG-AV7rz4POOzQJKF
103
103
  alita_sdk/runtime/toolkits/artifact.py,sha256=YChNCX4QhVpaQG7Jk4TS-Wl0Aruc4slQ2K21zh9nNO0,3176
104
104
  alita_sdk/runtime/toolkits/configurations.py,sha256=kIDAlnryPQfbZyFxV-9SzN2-Vefzx06TX1BBdIIpN90,141
105
105
  alita_sdk/runtime/toolkits/datasource.py,sha256=qk78OdPoReYPCWwahfkKLbKc4pfsu-061oXRryFLP6I,2498
106
- alita_sdk/runtime/toolkits/mcp.py,sha256=rzwEwW4LR-8aqVPsW-QvUSC0qMVM2MyOn0uH_m7VQjo,39797
106
+ alita_sdk/runtime/toolkits/mcp.py,sha256=4AHZoTb6J3_plIwxK8nQAK5tSTi_zhC3gTOzl0vdYBw,40452
107
107
  alita_sdk/runtime/toolkits/prompt.py,sha256=WIpTkkVYWqIqOWR_LlSWz3ug8uO9tm5jJ7aZYdiGRn0,1192
108
108
  alita_sdk/runtime/toolkits/subgraph.py,sha256=wwUK8JjPXkGzyVZ3tAukmvST6eGbqx_U11rpnmbrvtg,2105
109
109
  alita_sdk/runtime/toolkits/tools.py,sha256=F93TOPQWmULpslyJh-lCEdkQ3OD4RbEvfe84g8wBzb0,11639
@@ -122,7 +122,7 @@ alita_sdk/runtime/tools/llm.py,sha256=iRG_wU4T01LRsjEMPZe5Uah7LiMqDc-vspwkMuQtlt
122
122
  alita_sdk/runtime/tools/loop.py,sha256=uds0WhZvwMxDVFI6MZHrcmMle637cQfBNg682iLxoJA,8335
123
123
  alita_sdk/runtime/tools/loop_output.py,sha256=U4hO9PCQgWlXwOq6jdmCGbegtAxGAPXObSxZQ3z38uk,8069
124
124
  alita_sdk/runtime/tools/mcp_inspect_tool.py,sha256=38X8euaxDbEGjcfp6ElvExZalpZun6QEr6ZEW4nU5pQ,11496
125
- alita_sdk/runtime/tools/mcp_remote_tool.py,sha256=odt6j54SjeP0vaVo0cZkV2GHoZtPSTRh6owtVcqFytk,10396
125
+ alita_sdk/runtime/tools/mcp_remote_tool.py,sha256=Rbzkp-uOZ8dXnOgkk0LU4p0Tyo_KmGbeDRfTB-FdEP4,11129
126
126
  alita_sdk/runtime/tools/mcp_server_tool.py,sha256=-xO3H6BM63KaIV1CdcQKPVE0WPigiqOgFZDX7m2_yGs,4419
127
127
  alita_sdk/runtime/tools/pgvector_search.py,sha256=NN2BGAnq4SsDHIhUcFZ8d_dbEOM8QwB0UwpsWCYruXU,11692
128
128
  alita_sdk/runtime/tools/prompt.py,sha256=nJafb_e5aOM1Rr3qGFCR-SKziU9uCsiP2okIMs9PppM,741
@@ -136,7 +136,7 @@ alita_sdk/runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
136
136
  alita_sdk/runtime/utils/constants.py,sha256=Xntx1b_uxUzT4clwqHA_U6K8y5bBqf_4lSQwXdcWrp4,13586
137
137
  alita_sdk/runtime/utils/evaluate.py,sha256=iM1P8gzBLHTuSCe85_Ng_h30m52hFuGuhNXJ7kB1tgI,1872
138
138
  alita_sdk/runtime/utils/logging.py,sha256=svPyiW8ztDfhqHFITv5FBCj8UhLxz6hWcqGIY6wpJJE,3331
139
- alita_sdk/runtime/utils/mcp_oauth.py,sha256=icGG2j3mzKS2ARVmq0r_MPhHBiHrXMJ0DtIcU7y7TLQ,5826
139
+ alita_sdk/runtime/utils/mcp_oauth.py,sha256=Ynoa_C_G5WXL_tlcdol2wBLgQauyvIPX0isCJKsvWMs,6151
140
140
  alita_sdk/runtime/utils/save_dataframe.py,sha256=i-E1wp-t4wb17Zq3nA3xYwgSILjoXNizaQAA9opWvxY,1576
141
141
  alita_sdk/runtime/utils/streamlit.py,sha256=yIb4YIGH8HRAXZtZlywjxI07Xdcb5eUt7rMA-elFTdc,107261
142
142
  alita_sdk/runtime/utils/toolkit_runtime.py,sha256=MU63Fpxj0b5_r1IUUc0Q3-PN9VwL7rUxp2MRR4tmYR8,5136
@@ -360,8 +360,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=kT0TbmMvuKhDUZc0i7KO18O38JM9S
360
360
  alita_sdk/tools/zephyr_squad/__init__.py,sha256=0ne8XLJEQSLOWfzd2HdnqOYmQlUliKHbBED5kW_Vias,2895
361
361
  alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
362
362
  alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
363
- alita_sdk-0.3.443.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
364
- alita_sdk-0.3.443.dist-info/METADATA,sha256=cepzPrDlxn1tJo2xZwFUGT-y8nw5lZCT_9gzHVLwWkI,19071
365
- alita_sdk-0.3.443.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
366
- alita_sdk-0.3.443.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
367
- alita_sdk-0.3.443.dist-info/RECORD,,
363
+ alita_sdk-0.3.444.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
364
+ alita_sdk-0.3.444.dist-info/METADATA,sha256=umIbGNVs1zB3QuPT3WTWNI31mdOJHTPQR6trqqNmCJY,19071
365
+ alita_sdk-0.3.444.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
366
+ alita_sdk-0.3.444.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
367
+ alita_sdk-0.3.444.dist-info/RECORD,,