aixtools 0.2.9__py3-none-any.whl → 0.2.11__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 aixtools might be problematic. Click here for more details.

aixtools/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.2.9'
32
- __version_tuple__ = version_tuple = (0, 2, 9)
31
+ __version__ = version = '0.2.11'
32
+ __version_tuple__ = version_tuple = (0, 2, 11)
33
33
 
34
34
  __commit_id__ = commit_id = None
aixtools/auth/auth.py CHANGED
@@ -7,7 +7,11 @@ import logging
7
7
 
8
8
  import jwt
9
9
  from fastapi import HTTPException
10
+ from fastmcp.server.auth.auth import AuthProvider
10
11
  from jwt import ExpiredSignatureError, InvalidAudienceError, InvalidIssuerError, InvalidSignatureError, PyJWKClient
12
+ from mcp.server.auth.provider import (
13
+ AccessToken,
14
+ )
11
15
 
12
16
  from aixtools.utils import config
13
17
 
@@ -147,3 +151,29 @@ class AccessTokenVerifier:
147
151
  AuthTokenErrorCode.MISSING_GROUPS_ERROR,
148
152
  f"Could not find any group in JWT token, matching: {self.authorized_groups}",
149
153
  )
154
+
155
+
156
+ class AccessTokenAuthProvider(AuthProvider):
157
+ """Authentication provider for MCP servers for validating, authorizing and extracting access tokens."""
158
+
159
+ def __init__(self) -> None:
160
+ super().__init__()
161
+ self.token_verifier = AccessTokenVerifier()
162
+ self.app_scope = config.APP_DEFAULT_SCOPE
163
+
164
+ async def verify_token(self, token: str) -> AccessToken:
165
+ """Verify the access token and return an AccessToken object."""
166
+
167
+ logger.info("Received verify token request")
168
+ claims = self.token_verifier.verify(token)
169
+ scopes = claims.get("scp", "")
170
+ self.token_verifier.authorize_claims(claims, self.app_scope)
171
+
172
+ scopes_arr = []
173
+ if scopes:
174
+ scopes_arr = scopes.split(" ")
175
+
176
+ logger.info("Authorized the token")
177
+ return AccessToken(
178
+ token=token, client_id=self.token_verifier.api_id, scopes=scopes_arr, expires_at=claims.get("exp", None)
179
+ )
aixtools/utils/config.py CHANGED
@@ -138,3 +138,7 @@ APP_TENANT_ID = get_variable_env("APP_TENANT_ID")
138
138
 
139
139
  # used for token authorization check
140
140
  APP_AUTHORIZED_GROUPS = get_variable_env("APP_AUTHORIZED_GROUPS", allow_empty=True)
141
+
142
+ # used to skip authorization in local tests if required.
143
+ SKIP_MCP_AUTHORIZATION = str2bool(get_variable_env("SKIP_MCP_AUTHORIZATION", True, False))
144
+ APP_DEFAULT_SCOPE = get_variable_env("APP_DEFAULT_SCOPE", allow_empty=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aixtools
3
- Version: 0.2.9
3
+ Version: 0.2.11
4
4
  Summary: Tools for AI exploration and debugging
5
5
  Requires-Python: >=3.11.2
6
6
  Description-Content-Type: text/markdown
@@ -9,7 +9,7 @@ Requires-Dist: cachebox>=5.0.1
9
9
  Requires-Dist: chainlit>=2.5.5
10
10
  Requires-Dist: colorlog>=6.9.0
11
11
  Requires-Dist: fasta2a>=0.5.0
12
- Requires-Dist: fastmcp>=2.10.2
12
+ Requires-Dist: fastmcp>=2.11.0
13
13
  Requires-Dist: hvac>=2.3.0
14
14
  Requires-Dist: ipykernel>=6.29.5
15
15
  Requires-Dist: langchain-chroma>=0.2.3
@@ -1,5 +1,5 @@
1
1
  aixtools/__init__.py,sha256=9NGHm7LjsQmsvjTZvw6QFJexSvAU4bCoN_KBk9SCa00,260
2
- aixtools/_version.py,sha256=051on7ZmwGNyKvbO1AXKoElw7RjLuRmeJqVOApytNd4,704
2
+ aixtools/_version.py,sha256=ctqLY7UIopjEtEtkMewUbTAH-exVquX9ojG1BE5gJ1s,706
3
3
  aixtools/app.py,sha256=JzQ0nrv_bjDQokllIlGHOV0HEb-V8N6k_nGQH-TEsVU,5227
4
4
  aixtools/chainlit.md,sha256=yC37Ly57vjKyiIvK4oUvf4DYxZCwH7iocTlx7bLeGLU,761
5
5
  aixtools/context.py,sha256=I_MD40ZnvRm5WPKAKqBUAdXIf8YaurkYUUHSVVy-QvU,598
@@ -30,7 +30,7 @@ aixtools/agents/agent_batch.py,sha256=0Zu9yNCRPAQZPjXQ-dIUAmP1uGTVbxVt7xvnMpoJMj
30
30
  aixtools/agents/print_nodes.py,sha256=wVTngNfqM0As845WTRz6G3Rei_Gr3HuBlvu-G_eXuig,1665
31
31
  aixtools/agents/prompt.py,sha256=p9OYnyJ4-MyGXwHPrQeJBhZ2a3RV2HqhtdUUCrTMsAQ,3361
32
32
  aixtools/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- aixtools/auth/auth.py,sha256=4vNcljdpFzvIBXqjK7i3xAy-CC8Hc7ii11t-11z6ofY,6041
33
+ aixtools/auth/auth.py,sha256=aCcFTHjTO-ieA5Xo7913-9OCDowRAoCYG_b_gmtsXsU,7100
34
34
  aixtools/compliance/__init__.py,sha256=vnw0zEdySIJWvDAJ8DCRRaWmY_agEOz1qlpAdhmtiuo,191
35
35
  aixtools/compliance/private_data.py,sha256=OOM9mIp3_w0fNgj3VAEWBl7-jrPc19_Ls1pC5dfF5UY,5323
36
36
  aixtools/db/__init__.py,sha256=b8vRhme3egV-aUZbAntnOaDkSXB8UT0Xy5oqQhU_z0Q,399
@@ -78,7 +78,7 @@ aixtools/tools/doctor/mcp_tool_doctor.py,sha256=sX2q5GfNkmUYxnXrqMpeGIwGfeL1LpYJ
78
78
  aixtools/tools/doctor/tool_doctor.py,sha256=EY1pshjLGLD0j6cc1ZFtbc0G19I5IbOZwHFDqypE49Q,2661
79
79
  aixtools/tools/doctor/tool_recommendation.py,sha256=LYyVOSXdAorWiY4P-ucSA1vLlV5BTEfX4GzBXNE_X0M,1569
80
80
  aixtools/utils/__init__.py,sha256=xT6almZBQYMfj4h7Hq9QXDHyVXbOOTxqLsmJsxYYnSw,757
81
- aixtools/utils/config.py,sha256=fCATakEfeASo6eFMh5Me_idwMQgiITS3LMYc2Z1bGzU,5187
81
+ aixtools/utils/config.py,sha256=fd7BWDqxzMnHke2M4tjKvkhrxwdkUsuZXDTOShiID24,5412
82
82
  aixtools/utils/config_util.py,sha256=3Ya4Qqhj1RJ1qtTTykQ6iayf5uxlpigPXgEJlTi1wn4,2229
83
83
  aixtools/utils/enum_with_description.py,sha256=zjSzWxG74eR4x7dpmb74pLTYCWNSMvauHd7_9LpDYIw,1088
84
84
  aixtools/utils/files.py,sha256=8JnxwHJRJcjWCdFpjzWmo0po2fRg8esj4H7sOxElYXU,517
@@ -88,8 +88,8 @@ aixtools/utils/chainlit/cl_agent_show.py,sha256=vaRuowp4BRvhxEr5hw0zHEJ7iaSF_5bo
88
88
  aixtools/utils/chainlit/cl_utils.py,sha256=fxaxdkcZg6uHdM8uztxdPowg3a2f7VR7B26VPY4t-3c,5738
89
89
  aixtools/vault/__init__.py,sha256=fsr_NuX3GZ9WZ7dGfe0gp_5-z3URxAfwVRXw7Xyc0dU,141
90
90
  aixtools/vault/vault.py,sha256=9dZLWdZQk9qN_Q9Djkofw9LUKnJqnrX5H0fGusVLBhA,6037
91
- aixtools-0.2.9.dist-info/METADATA,sha256=jWcF3SX9eos7TLkvD4UaurdbD4x9JEcQApycD2u_kB8,27229
92
- aixtools-0.2.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
93
- aixtools-0.2.9.dist-info/entry_points.txt,sha256=q8412TG4T0S8K0SKeWp2vkVPIDYQs0jNoHqcQ7qxOiA,155
94
- aixtools-0.2.9.dist-info/top_level.txt,sha256=wBn-rw9bCtxrR4AYEYgjilNCUVmKY0LWby9Zan2PRJM,9
95
- aixtools-0.2.9.dist-info/RECORD,,
91
+ aixtools-0.2.11.dist-info/METADATA,sha256=E5GS2Ov0M2EdWvwzzxHduZJvSMepJo_0P5j_uEn95-g,27230
92
+ aixtools-0.2.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
93
+ aixtools-0.2.11.dist-info/entry_points.txt,sha256=q8412TG4T0S8K0SKeWp2vkVPIDYQs0jNoHqcQ7qxOiA,155
94
+ aixtools-0.2.11.dist-info/top_level.txt,sha256=wBn-rw9bCtxrR4AYEYgjilNCUVmKY0LWby9Zan2PRJM,9
95
+ aixtools-0.2.11.dist-info/RECORD,,