diff --git a/client/src/App.tsx b/client/src/App.tsx index 2c84377..4395dcc 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -59,7 +59,8 @@ const DEFAULT_REQUEST_TIMEOUT_MSEC = 10000; const params = new URLSearchParams(window.location.search); const PROXY_PORT = params.get("proxyPort") ?? "3000"; -const REQUEST_TIMEOUT = parseInt(params.get("timeout") ?? "") || DEFAULT_REQUEST_TIMEOUT_MSEC; +const REQUEST_TIMEOUT = + parseInt(params.get("timeout") ?? "") || DEFAULT_REQUEST_TIMEOUT_MSEC; const PROXY_SERVER_URL = `http://localhost:${PROXY_PORT}`; const App = () => { @@ -217,6 +218,12 @@ const App = () => { rootsRef.current = roots; }, [roots]); + useEffect(() => { + if (!window.location.hash) { + window.location.hash = "resources"; + } + }, []); + const pushHistory = (request: object, response?: object) => { setRequestHistory((prev) => [ ...prev, @@ -251,10 +258,14 @@ const App = () => { response = await mcpClient.request(request, schema, { signal: abortController.signal, }); + pushHistory(request, response); + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + pushHistory(request, { error: errorMessage }); + throw error; } finally { clearTimeout(timeoutId); } - pushHistory(request, response); if (tabKey !== undefined) { clearError(tabKey); @@ -485,7 +496,11 @@ const App = () => {
{mcpClient ? ( - + (window.location.hash = value)} + >