Skip to content

Commit 41a240a

Browse files
authored
Remove lstrip in each oauth endpoint
`lstrip` strips left `/` which results in `ISSUER_URLauthorize`
1 parent 2ca2de7 commit 41a240a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/mcp/server/auth/routes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ def build_metadata(
167167
revocation_options: RevocationOptions,
168168
) -> OAuthMetadata:
169169
authorization_url = modify_url_path(
170-
issuer_url, lambda path: path.rstrip("/") + AUTHORIZATION_PATH.lstrip("/")
170+
issuer_url, lambda path: path.rstrip("/") + AUTHORIZATION_PATH
171171
)
172172
token_url = modify_url_path(
173-
issuer_url, lambda path: path.rstrip("/") + TOKEN_PATH.lstrip("/")
173+
issuer_url, lambda path: path.rstrip("/") + TOKEN_PATH
174174
)
175175
# Create metadata
176176
metadata = OAuthMetadata(
@@ -194,13 +194,13 @@ def build_metadata(
194194
# Add registration endpoint if supported
195195
if client_registration_options.enabled:
196196
metadata.registration_endpoint = modify_url_path(
197-
issuer_url, lambda path: path.rstrip("/") + REGISTRATION_PATH.lstrip("/")
197+
issuer_url, lambda path: path.rstrip("/") + REGISTRATION_PATH
198198
)
199199

200200
# Add revocation endpoint if supported
201201
if revocation_options.enabled:
202202
metadata.revocation_endpoint = modify_url_path(
203-
issuer_url, lambda path: path.rstrip("/") + REVOCATION_PATH.lstrip("/")
203+
issuer_url, lambda path: path.rstrip("/") + REVOCATION_PATH
204204
)
205205
metadata.revocation_endpoint_auth_methods_supported = ["client_secret_post"]
206206

0 commit comments

Comments
 (0)