File tree Expand file tree Collapse file tree 4 files changed +16
-0
lines changed
src/fastmcp/server/auth/providers Expand file tree Collapse file tree 4 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -160,6 +160,7 @@ def __init__(
160160 redirect_path : str | NotSetT = NotSet ,
161161 required_scopes : list [str ] | None | NotSetT = NotSet ,
162162 timeout_seconds : int | NotSetT = NotSet ,
163+ allowed_client_redirect_uris : list [str ] | None = None ,
163164 ):
164165 """Initialize Azure OAuth provider.
165166
@@ -171,6 +172,8 @@ def __init__(
171172 redirect_path: Redirect path configured in Azure (defaults to "/auth/callback")
172173 required_scopes: Required scopes (defaults to ["User.Read", "email", "openid", "profile"])
173174 timeout_seconds: HTTP request timeout for Azure API calls
175+ allowed_client_redirect_uris: List of allowed redirect URI patterns for MCP clients.
176+ If None (default), all URIs are allowed. If empty list, no URIs are allowed.
174177 """
175178 settings = AzureProviderSettings .model_validate (
176179 {
@@ -247,6 +250,7 @@ def __init__(
247250 base_url = base_url_final ,
248251 redirect_path = redirect_path_final ,
249252 issuer_url = base_url_final ,
253+ allowed_client_redirect_uris = allowed_client_redirect_uris ,
250254 )
251255
252256 logger .info (
Original file line number Diff line number Diff line change @@ -201,6 +201,7 @@ def __init__(
201201 redirect_path : str | NotSetT = NotSet ,
202202 required_scopes : list [str ] | None | NotSetT = NotSet ,
203203 timeout_seconds : int | NotSetT = NotSet ,
204+ allowed_client_redirect_uris : list [str ] | None = None ,
204205 ):
205206 """Initialize GitHub OAuth provider.
206207
@@ -211,6 +212,8 @@ def __init__(
211212 redirect_path: Redirect path configured in GitHub OAuth app (defaults to "/auth/callback")
212213 required_scopes: Required GitHub scopes (defaults to ["user"])
213214 timeout_seconds: HTTP request timeout for GitHub API calls
215+ allowed_client_redirect_uris: List of allowed redirect URI patterns for MCP clients.
216+ If None (default), all URIs are allowed. If empty list, no URIs are allowed.
214217 """
215218 settings = GitHubProviderSettings .model_validate (
216219 {
@@ -264,6 +267,7 @@ def __init__(
264267 base_url = base_url_final ,
265268 redirect_path = redirect_path_final ,
266269 issuer_url = base_url_final , # We act as the issuer for client registration
270+ allowed_client_redirect_uris = allowed_client_redirect_uris ,
267271 )
268272
269273 logger .info (
Original file line number Diff line number Diff line change @@ -217,6 +217,7 @@ def __init__(
217217 redirect_path : str | NotSetT = NotSet ,
218218 required_scopes : list [str ] | None | NotSetT = NotSet ,
219219 timeout_seconds : int | NotSetT = NotSet ,
220+ allowed_client_redirect_uris : list [str ] | None = None ,
220221 ):
221222 """Initialize Google OAuth provider.
222223
@@ -230,6 +231,8 @@ def __init__(
230231 - "https://www.googleapis.com/auth/userinfo.email" for email access
231232 - "https://www.googleapis.com/auth/userinfo.profile" for profile info
232233 timeout_seconds: HTTP request timeout for Google API calls
234+ allowed_client_redirect_uris: List of allowed redirect URI patterns for MCP clients.
235+ If None (default), all URIs are allowed. If empty list, no URIs are allowed.
233236 """
234237 settings = GoogleProviderSettings .model_validate (
235238 {
@@ -284,6 +287,7 @@ def __init__(
284287 base_url = base_url_final ,
285288 redirect_path = redirect_path_final ,
286289 issuer_url = base_url_final , # We act as the issuer for client registration
290+ allowed_client_redirect_uris = allowed_client_redirect_uris ,
287291 )
288292
289293 logger .info (
Original file line number Diff line number Diff line change @@ -167,6 +167,7 @@ def __init__(
167167 redirect_path : str | NotSetT = NotSet ,
168168 required_scopes : list [str ] | None | NotSetT = NotSet ,
169169 timeout_seconds : int | NotSetT = NotSet ,
170+ allowed_client_redirect_uris : list [str ] | None = None ,
170171 ):
171172 """Initialize WorkOS OAuth provider.
172173
@@ -178,6 +179,8 @@ def __init__(
178179 redirect_path: Redirect path configured in WorkOS (defaults to "/auth/callback")
179180 required_scopes: Required OAuth scopes (no default)
180181 timeout_seconds: HTTP request timeout for WorkOS API calls
182+ allowed_client_redirect_uris: List of allowed redirect URI patterns for MCP clients.
183+ If None (default), all URIs are allowed. If empty list, no URIs are allowed.
181184 """
182185 settings = WorkOSProviderSettings .model_validate (
183186 {
@@ -241,6 +244,7 @@ def __init__(
241244 base_url = base_url_final ,
242245 redirect_path = redirect_path_final ,
243246 issuer_url = base_url_final ,
247+ allowed_client_redirect_uris = allowed_client_redirect_uris ,
244248 )
245249
246250 logger .info (
You can’t perform that action at this time.
0 commit comments