@@ -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 ,
@@ -56,12 +56,18 @@ const App = () => {
5656 const [ tools , setTools ] = useState < Tool [ ] > ( [ ] ) ;
5757 const [ toolResult , setToolResult ] = useState < string > ( "" ) ;
5858 const [ error , setError ] = useState < string | null > ( null ) ;
59- const [ command , setCommand ] = useState < string > (
60- "/Users/ashwin/.nvm/versions/node/v18.20.4/bin/node" ,
61- ) ;
62- const [ args , setArgs ] = useState < string > (
63- "/Users/ashwin/code/mcp/example-servers/build/everything/stdio.js" ,
64- ) ;
59+ const [ command , setCommand ] = useState < string > ( ( ) => {
60+ return (
61+ localStorage . getItem ( "lastCommand" ) ||
62+ "/Users/ashwin/.nvm/versions/node/v18.20.4/bin/node"
63+ ) ;
64+ } ) ;
65+ const [ args , setArgs ] = useState < string > ( ( ) => {
66+ return (
67+ localStorage . getItem ( "lastArgs" ) ||
68+ "/Users/ashwin/code/mcp/example-servers/build/everything/stdio.js"
69+ ) ;
70+ } ) ;
6571 const [ url , setUrl ] = useState < string > ( "http://localhost:3001/sse" ) ;
6672 const [ transportType , setTransportType ] = useState < "stdio" | "sse" > ( "stdio" ) ;
6773 const [ requestHistory , setRequestHistory ] = useState <
@@ -84,6 +90,14 @@ const App = () => {
8490 const [ nextToolCursor , setNextToolCursor ] = useState < string | undefined > ( ) ;
8591 const progressTokenRef = useRef ( 0 ) ;
8692
93+ useEffect ( ( ) => {
94+ localStorage . setItem ( "lastCommand" , command ) ;
95+ } , [ command ] ) ;
96+
97+ useEffect ( ( ) => {
98+ localStorage . setItem ( "lastArgs" , args ) ;
99+ } , [ args ] ) ;
100+
87101 const pushHistory = ( request : object , response : object ) => {
88102 setRequestHistory ( ( prev ) => [
89103 ...prev ,
0 commit comments