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 = () => {
216216 localStorage . setItem ( "lastTransportType" , transportType ) ;
217217 } , [ transportType ] ) ;
218218
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+
219234 useEffect ( ( ) => {
220235 fetch ( `${ PROXY_SERVER_URL } /config` )
221236 . then ( ( response ) => response . json ( ) )
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ const OAuthCallback = () => {
1919 const accessToken = await handleOAuthCallback ( serverUrl , code ) ;
2020 // Store the access token for future use
2121 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 ) } ` ;
2424 } catch ( error ) {
2525 console . error ( 'OAuth callback error:' , error ) ;
2626 window . location . href = '/' ;
You can’t perform that action at this time.
0 commit comments