Skip to content

Commit 2bbbc02

Browse files
committed
raise when mcp_authorization_server used with requests_pathname_prefix
1 parent 3f724ef commit 2bbbc02

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

dash/mcp/_server.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ def _setup_mcp_oauth(app: Dash, mcp_path: str, mcp_authorization_server: str) ->
7474
server. Auth enforcement is the responsibility of the hosting platform
7575
(e.g. Plotly Cloud gateway, Dash Embedded, or a reverse proxy).
7676
"""
77+
if app.config.requests_pathname_prefix != "/":
78+
raise ValueError(
79+
"`mcp_authorization_server` cannot be used in conjunction with "
80+
"`requests_pathname_prefix`. "
81+
"Authorization must be implemented at the platform level "
82+
"(see https://www.rfc-editor.org/rfc/rfc9728#section-3). "
83+
"Remove the mcp_authorization_server parameter."
84+
)
85+
7786
well_known_path = urljoin("/.well-known/oauth-protected-resource/", mcp_path)
7887

7988
def _serve_resource_metadata():

0 commit comments

Comments
 (0)