Skip to content

Commit 395c3ac

Browse files
committed
clean up
1 parent e087e30 commit 395c3ac

File tree

1 file changed

+20
-26
lines changed

1 file changed

+20
-26
lines changed

src/mcp/server/auth/routes.py

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -93,28 +93,22 @@ def create_auth_routes(
9393
),
9494
methods=["GET", "OPTIONS"],
9595
),
96-
]
97-
98-
# Add remaining auth routes
99-
routes.extend(
100-
[
101-
Route(
102-
AUTHORIZATION_PATH,
103-
# do not allow CORS for authorization endpoint;
104-
# clients should just redirect to this
105-
endpoint=AuthorizationHandler(provider).handle,
106-
methods=["GET", "POST"],
107-
),
108-
Route(
109-
TOKEN_PATH,
110-
endpoint=cors_middleware(
111-
TokenHandler(provider, client_authenticator).handle,
112-
["POST", "OPTIONS"],
113-
),
114-
methods=["POST", "OPTIONS"],
96+
Route(
97+
AUTHORIZATION_PATH,
98+
# do not allow CORS for authorization endpoint;
99+
# clients should just redirect to this
100+
endpoint=AuthorizationHandler(provider).handle,
101+
methods=["GET", "POST"],
102+
),
103+
Route(
104+
TOKEN_PATH,
105+
endpoint=cors_middleware(
106+
TokenHandler(provider, client_authenticator).handle,
107+
["POST", "OPTIONS"],
115108
),
116-
]
117-
)
109+
methods=["POST", "OPTIONS"],
110+
),
111+
]
118112

119113
if client_registration_options.enabled:
120114
registration_handler = RegistrationHandler(
@@ -195,27 +189,27 @@ def create_protected_resource_routes(
195189
) -> list[Route]:
196190
"""
197191
Create routes for OAuth 2.0 Protected Resource Metadata (RFC 9728).
198-
192+
199193
Args:
200194
resource_url: The URL of this resource server
201195
authorization_servers: List of authorization servers that can issue tokens
202196
scopes_supported: Optional list of scopes supported by this resource
203-
197+
204198
Returns:
205199
List of Starlette routes for protected resource metadata
206200
"""
207201
from mcp.server.auth.handlers.metadata import ProtectedResourceMetadataHandler
208202
from mcp.shared.auth import ProtectedResourceMetadata
209-
203+
210204
metadata = ProtectedResourceMetadata(
211205
resource=resource_url,
212206
authorization_servers=authorization_servers,
213207
scopes_supported=scopes_supported,
214208
# bearer_methods_supported defaults to ["header"] in the model
215209
)
216-
210+
217211
handler = ProtectedResourceMetadataHandler(metadata)
218-
212+
219213
return [
220214
Route(
221215
"/.well-known/oauth-protected-resource",

0 commit comments

Comments
 (0)