File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,21 @@ const App = () => {
216
216
localStorage . setItem ( "lastTransportType" , transportType ) ;
217
217
} , [ transportType ] ) ;
218
218
219
+ // Auto-connect if serverUrl is provided in URL params (e.g. after OAuth callback)
220
+ useEffect ( ( ) => {
221
+ const serverUrl = params . get ( "serverUrl" ) ;
222
+ if ( serverUrl ) {
223
+ setSseUrl ( serverUrl ) ;
224
+ setTransportType ( "sse" ) ;
225
+ // Remove serverUrl from URL without reloading the page
226
+ const newUrl = new URL ( window . location . href ) ;
227
+ newUrl . searchParams . delete ( "serverUrl" ) ;
228
+ window . history . replaceState ( { } , "" , newUrl . toString ( ) ) ;
229
+ // Connect to the server
230
+ connectMcpServer ( ) ;
231
+ }
232
+ } , [ ] ) ;
233
+
219
234
useEffect ( ( ) => {
220
235
fetch ( `${ PROXY_SERVER_URL } /config` )
221
236
. then ( ( response ) => response . json ( ) )
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ const OAuthCallback = () => {
19
19
const accessToken = await handleOAuthCallback ( serverUrl , code ) ;
20
20
// Store the access token for future use
21
21
sessionStorage . setItem ( SESSION_KEYS . ACCESS_TOKEN , accessToken ) ;
22
- // Redirect back to the main app
23
- window . location . href = '/' ;
22
+ // Redirect back to the main app with server URL to trigger auto-connect
23
+ window . location . href = `/?serverUrl= ${ encodeURIComponent ( serverUrl ) } ` ;
24
24
} catch ( error ) {
25
25
console . error ( 'OAuth callback error:' , error ) ;
26
26
window . location . href = '/' ;
You can’t perform that action at this time.
0 commit comments