Skip to content

Commit 770893f

Browse files
committed
feat(P3): non-localhost consent note on the OAuth authorize page
When the gateway is bound beyond loopback (network access on), /oauth/authorize now shows a note that desktop consent only completes on the host, pointing remote/headless clients to register an API-key client instead. Gated on network_bind, so local-only setups are unchanged. Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent 6a88abc commit 770893f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

crates/mcpmux-gateway/src/server/handlers.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,17 @@ pub async fn oauth_authorize(
478478
// authorization for the desktop UI, which renders it as text via React.
479479
let display_name_html = html_escape_text(&display_name);
480480

481+
// When the gateway is exposed beyond loopback, a client that reached this
482+
// page from another machine can't complete the desktop consent (the
483+
// mcpmux:// deep link fires only on the host). Surface the API-key path so a
484+
// remote user isn't left at a dead end.
485+
let network_bind = state.read().await.network_bind;
486+
let network_note = if network_bind {
487+
r#"<div style="margin-bottom:1.5rem;padding:0.85rem 1rem;border-radius:10px;background:rgba(218,119,86,0.08);border:1px solid rgba(218,119,86,0.25);color:#d8b08c;font-size:0.8rem;line-height:1.45;text-align:left;"><strong style="color:#DA7756;">Connecting from another machine?</strong> This approval only completes on the computer running McpMux. For a remote or headless client, register an <strong>API-key client</strong> in McpMux (Clients tab) and connect with that key &mdash; no browser approval needed.</div>"#
488+
} else {
489+
""
490+
};
491+
481492
// HTML page that triggers the deep link
482493
// The page shows a brief message while the app opens
483494
// Industry standard: Don't auto-close, let user close after approval
@@ -589,6 +600,8 @@ pub async fn oauth_authorize(
589600
Complete authorization in {app_name}
590601
</p>
591602
603+
{network_note}
604+
592605
<div class="client-info">
593606
<div class="client-name">{display_name_html}</div>
594607
<div class="client-id">wants to connect</div>

0 commit comments

Comments
 (0)