@@ -59,7 +59,8 @@ const DEFAULT_REQUEST_TIMEOUT_MSEC = 10000;
59
59
60
60
const params = new URLSearchParams ( window . location . search ) ;
61
61
const PROXY_PORT = params . get ( "proxyPort" ) ?? "3000" ;
62
- const REQUEST_TIMEOUT = parseInt ( params . get ( "timeout" ) ?? "" ) || DEFAULT_REQUEST_TIMEOUT_MSEC ;
62
+ const REQUEST_TIMEOUT =
63
+ parseInt ( params . get ( "timeout" ) ?? "" ) || DEFAULT_REQUEST_TIMEOUT_MSEC ;
63
64
const PROXY_SERVER_URL = `http://localhost:${ PROXY_PORT } ` ;
64
65
65
66
const App = ( ) => {
@@ -217,6 +218,12 @@ const App = () => {
217
218
rootsRef . current = roots ;
218
219
} , [ roots ] ) ;
219
220
221
+ useEffect ( ( ) => {
222
+ if ( ! window . location . hash ) {
223
+ window . location . hash = "resources" ;
224
+ }
225
+ } , [ ] ) ;
226
+
220
227
const pushHistory = ( request : object , response ?: object ) => {
221
228
setRequestHistory ( ( prev ) => [
222
229
...prev ,
@@ -251,10 +258,14 @@ const App = () => {
251
258
response = await mcpClient . request ( request , schema , {
252
259
signal : abortController . signal ,
253
260
} ) ;
261
+ pushHistory ( request , response ) ;
262
+ } catch ( error ) {
263
+ const errorMessage = error instanceof Error ? error . message : String ( error ) ;
264
+ pushHistory ( request , { error : errorMessage } ) ;
265
+ throw error ;
254
266
} finally {
255
267
clearTimeout ( timeoutId ) ;
256
268
}
257
- pushHistory ( request , response ) ;
258
269
259
270
if ( tabKey !== undefined ) {
260
271
clearError ( tabKey ) ;
@@ -485,7 +496,11 @@ const App = () => {
485
496
< div className = "flex-1 flex flex-col overflow-hidden" >
486
497
< div className = "flex-1 overflow-auto" >
487
498
{ mcpClient ? (
488
- < Tabs defaultValue = "resources" className = "w-full p-4" >
499
+ < Tabs
500
+ defaultValue = { window . location . hash . slice ( 1 ) || "resources" }
501
+ className = "w-full p-4"
502
+ onValueChange = { ( value ) => ( window . location . hash = value ) }
503
+ >
489
504
< TabsList className = "mb-4 p-0" >
490
505
< TabsTrigger value = "resources" >
491
506
< Files className = "w-4 h-4 mr-2" />
0 commit comments