@@ -14,7 +14,7 @@ import {
1414 ServerNotification ,
1515 EmptyResultSchema ,
1616} from "mcp-typescript/types.js" ;
17- import { useState , useRef } from "react" ;
17+ import { useState , useRef , useEffect } from "react" ;
1818import {
1919 Send ,
2020 Terminal ,
@@ -57,12 +57,18 @@ const App = () => {
5757 const [ tools , setTools ] = useState < Tool [ ] > ( [ ] ) ;
5858 const [ toolResult , setToolResult ] = useState < string > ( "" ) ;
5959 const [ error , setError ] = useState < string | null > ( null ) ;
60- const [ command , setCommand ] = useState < string > (
61- "/Users/ashwin/.nvm/versions/node/v18.20.4/bin/node" ,
62- ) ;
63- const [ args , setArgs ] = useState < string > (
64- "/Users/ashwin/code/mcp/example-servers/build/everything/stdio.js" ,
65- ) ;
60+ const [ command , setCommand ] = useState < string > ( ( ) => {
61+ return (
62+ localStorage . getItem ( "lastCommand" ) ||
63+ "/Users/ashwin/.nvm/versions/node/v18.20.4/bin/node"
64+ ) ;
65+ } ) ;
66+ const [ args , setArgs ] = useState < string > ( ( ) => {
67+ return (
68+ localStorage . getItem ( "lastArgs" ) ||
69+ "/Users/ashwin/code/mcp/example-servers/build/everything/stdio.js"
70+ ) ;
71+ } ) ;
6672 const [ url , setUrl ] = useState < string > ( "http://localhost:3001/sse" ) ;
6773 const [ transportType , setTransportType ] = useState < "stdio" | "sse" > ( "stdio" ) ;
6874 const [ requestHistory , setRequestHistory ] = useState <
@@ -85,6 +91,14 @@ const App = () => {
8591 const [ nextToolCursor , setNextToolCursor ] = useState < string | undefined > ( ) ;
8692 const progressTokenRef = useRef ( 0 ) ;
8793
94+ useEffect ( ( ) => {
95+ localStorage . setItem ( "lastCommand" , command ) ;
96+ } , [ command ] ) ;
97+
98+ useEffect ( ( ) => {
99+ localStorage . setItem ( "lastArgs" , args ) ;
100+ } , [ args ] ) ;
101+
88102 const pushHistory = ( request : object , response : object ) => {
89103 setRequestHistory ( ( prev ) => [
90104 ...prev ,
0 commit comments