mcp-sharepoint-us 2.0.6__tar.gz → 2.0.9__tar.gz
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_us-2.0.6 → mcp_sharepoint_us-2.0.9}/PKG-INFO +1 -1
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/pyproject.toml +1 -1
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint/auth.py +18 -4
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint_us.egg-info/PKG-INFO +1 -1
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/LICENSE +0 -0
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/README.md +0 -0
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/setup.cfg +0 -0
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint/__init__.py +0 -0
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint/__main__.py +0 -0
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint_us.egg-info/SOURCES.txt +0 -0
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint_us.egg-info/dependency_links.txt +0 -0
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint_us.egg-info/entry_points.txt +0 -0
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint_us.egg-info/requires.txt +0 -0
- {mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint_us.egg-info/top_level.txt +0 -0
|
@@ -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
|
|
@@ -93,16 +94,26 @@ class SharePointAuthenticator:
|
|
|
93
94
|
self._access_token = None
|
|
94
95
|
self._access_token_exp = 0
|
|
95
96
|
|
|
96
|
-
|
|
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"]
|
|
97
102
|
|
|
98
|
-
|
|
103
|
+
logger.info(f"Using SharePoint root scope: {sharepoint_root}/.default")
|
|
104
|
+
|
|
105
|
+
def acquire_token() -> dict:
|
|
99
106
|
"""
|
|
100
107
|
Token callback used by office365 ClientContext.
|
|
101
108
|
Retries transient network errors like ConnectionResetError(104).
|
|
109
|
+
Returns a dict with tokenType and accessToken as expected by the library.
|
|
102
110
|
"""
|
|
103
111
|
now = int(time.time())
|
|
104
112
|
if self._access_token and now < (self._access_token_exp - 60):
|
|
105
|
-
return
|
|
113
|
+
return {
|
|
114
|
+
"tokenType": "Bearer",
|
|
115
|
+
"accessToken": self._access_token
|
|
116
|
+
}
|
|
106
117
|
|
|
107
118
|
last_err = None
|
|
108
119
|
for attempt in range(1, 6): # 5 attempts
|
|
@@ -126,7 +137,10 @@ class SharePointAuthenticator:
|
|
|
126
137
|
self._access_token_exp = int(time.time()) + expires_in
|
|
127
138
|
|
|
128
139
|
logger.info(f"Successfully acquired token for {self.site_url}")
|
|
129
|
-
return
|
|
140
|
+
return {
|
|
141
|
+
"tokenType": "Bearer",
|
|
142
|
+
"accessToken": token
|
|
143
|
+
}
|
|
130
144
|
|
|
131
145
|
except Exception as e:
|
|
132
146
|
last_err = e
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint_us.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint_us.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint_us.egg-info/requires.txt
RENAMED
|
File without changes
|
{mcp_sharepoint_us-2.0.6 → mcp_sharepoint_us-2.0.9}/src/mcp_sharepoint_us.egg-info/top_level.txt
RENAMED
|
File without changes
|