mcp-sharepoint-us 2.0.5__py3-none-any.whl → 2.0.7__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 mcp-sharepoint-us might be problematic. Click here for more details.
- mcp_sharepoint/auth.py +24 -7
- {mcp_sharepoint_us-2.0.5.dist-info → mcp_sharepoint_us-2.0.7.dist-info}/METADATA +1 -1
- mcp_sharepoint_us-2.0.7.dist-info/RECORD +9 -0
- mcp_sharepoint_us-2.0.5.dist-info/RECORD +0 -9
- {mcp_sharepoint_us-2.0.5.dist-info → mcp_sharepoint_us-2.0.7.dist-info}/WHEEL +0 -0
- {mcp_sharepoint_us-2.0.5.dist-info → mcp_sharepoint_us-2.0.7.dist-info}/entry_points.txt +0 -0
- {mcp_sharepoint_us-2.0.5.dist-info → mcp_sharepoint_us-2.0.7.dist-info}/licenses/LICENSE +0 -0
- {mcp_sharepoint_us-2.0.5.dist-info → mcp_sharepoint_us-2.0.7.dist-info}/top_level.txt +0 -0
mcp_sharepoint/auth.py
CHANGED
|
@@ -7,6 +7,7 @@ import logging
|
|
|
7
7
|
import time
|
|
8
8
|
import random
|
|
9
9
|
from typing import Optional
|
|
10
|
+
from urllib.parse import urlparse
|
|
10
11
|
from office365.sharepoint.client_context import ClientContext
|
|
11
12
|
from office365.runtime.auth.client_credential import ClientCredential
|
|
12
13
|
import msal
|
|
@@ -69,12 +70,22 @@ class SharePointAuthenticator:
|
|
|
69
70
|
# Optional: enable MSAL token cache (in-memory). Helps reduce calls.
|
|
70
71
|
self._token_cache = getattr(self, "_token_cache", msal.SerializableTokenCache())
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
# For government cloud, disable instance discovery to prevent
|
|
74
|
+
# MSAL from trying to connect to commercial cloud endpoints
|
|
75
|
+
msal_params = {
|
|
76
|
+
"authority": authority_url,
|
|
77
|
+
"client_id": self.client_id,
|
|
78
|
+
"client_credential": self.client_secret,
|
|
79
|
+
"token_cache": self._token_cache,
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
# Disable instance discovery for sovereign clouds to avoid
|
|
83
|
+
# hitting login.microsoftonline.com endpoints
|
|
84
|
+
if self.cloud in ("government", "us"):
|
|
85
|
+
msal_params["validate_authority"] = False
|
|
86
|
+
logger.info("Disabled authority validation for government cloud")
|
|
87
|
+
|
|
88
|
+
self._msal_app = msal.ConfidentialClientApplication(**msal_params)
|
|
78
89
|
self._authority_url = authority_url
|
|
79
90
|
|
|
80
91
|
# Small in-memory access-token cache (avoid repeated acquire calls)
|
|
@@ -83,7 +94,13 @@ class SharePointAuthenticator:
|
|
|
83
94
|
self._access_token = None
|
|
84
95
|
self._access_token_exp = 0
|
|
85
96
|
|
|
86
|
-
|
|
97
|
+
# Extract root SharePoint URL for scope
|
|
98
|
+
# For https://tenant.sharepoint.us/sites/SiteName -> https://tenant.sharepoint.us
|
|
99
|
+
parsed = urlparse(self.site_url)
|
|
100
|
+
sharepoint_root = f"{parsed.scheme}://{parsed.netloc}"
|
|
101
|
+
scopes = [f"{sharepoint_root}/.default"]
|
|
102
|
+
|
|
103
|
+
logger.info(f"Using SharePoint root scope: {sharepoint_root}/.default")
|
|
87
104
|
|
|
88
105
|
def acquire_token() -> str:
|
|
89
106
|
"""
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
mcp_sharepoint/__init__.py,sha256=vnnELXIj7FdcW8KIYoeXlwq4FblG63RTrXGGSO8KdSU,19412
|
|
2
|
+
mcp_sharepoint/__main__.py,sha256=4iVDdDZx4rQ4Zo-x0RaCrT-NKeGObIz_ks3YF8di2nA,132
|
|
3
|
+
mcp_sharepoint/auth.py,sha256=Fnc0VhGCFWsiLNHzrH2DB1w2Tnz8U2gvSLOVO1tgE6E,12865
|
|
4
|
+
mcp_sharepoint_us-2.0.7.dist-info/licenses/LICENSE,sha256=SRM8juGH4GjIqnl5rrp-P-S5mW5h2mINOPx5-wOZG6s,1112
|
|
5
|
+
mcp_sharepoint_us-2.0.7.dist-info/METADATA,sha256=bQPSFe9whxi949ewDd3j_9w69_rz7c5Cg8M87YOz8hc,11379
|
|
6
|
+
mcp_sharepoint_us-2.0.7.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
7
|
+
mcp_sharepoint_us-2.0.7.dist-info/entry_points.txt,sha256=UZOa_7OLI41rmsErbvnSz9RahPMGQVcqZUFMphOcjbY,57
|
|
8
|
+
mcp_sharepoint_us-2.0.7.dist-info/top_level.txt,sha256=R6mRoWe61lz4kUSKGV6S2XVbE7825xfC_J-ouZIYpuo,15
|
|
9
|
+
mcp_sharepoint_us-2.0.7.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
mcp_sharepoint/__init__.py,sha256=vnnELXIj7FdcW8KIYoeXlwq4FblG63RTrXGGSO8KdSU,19412
|
|
2
|
-
mcp_sharepoint/__main__.py,sha256=4iVDdDZx4rQ4Zo-x0RaCrT-NKeGObIz_ks3YF8di2nA,132
|
|
3
|
-
mcp_sharepoint/auth.py,sha256=J_NV2XN-4qv8d-i-P6_btYDdExEWi4BSw0jO-2kCqlk,11984
|
|
4
|
-
mcp_sharepoint_us-2.0.5.dist-info/licenses/LICENSE,sha256=SRM8juGH4GjIqnl5rrp-P-S5mW5h2mINOPx5-wOZG6s,1112
|
|
5
|
-
mcp_sharepoint_us-2.0.5.dist-info/METADATA,sha256=-XkuUvhJAC2npnvlrv1PJzV9SOmlPPDiDTwNE6QB1qA,11379
|
|
6
|
-
mcp_sharepoint_us-2.0.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
7
|
-
mcp_sharepoint_us-2.0.5.dist-info/entry_points.txt,sha256=UZOa_7OLI41rmsErbvnSz9RahPMGQVcqZUFMphOcjbY,57
|
|
8
|
-
mcp_sharepoint_us-2.0.5.dist-info/top_level.txt,sha256=R6mRoWe61lz4kUSKGV6S2XVbE7825xfC_J-ouZIYpuo,15
|
|
9
|
-
mcp_sharepoint_us-2.0.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|