@@ -14,7 +14,7 @@ import {
14
14
ServerNotification ,
15
15
EmptyResultSchema ,
16
16
} from "mcp-typescript/types.js" ;
17
- import { useState , useRef } from "react" ;
17
+ import { useState , useRef , useEffect } from "react" ;
18
18
import {
19
19
Send ,
20
20
Terminal ,
@@ -56,12 +56,18 @@ const App = () => {
56
56
const [ tools , setTools ] = useState < Tool [ ] > ( [ ] ) ;
57
57
const [ toolResult , setToolResult ] = useState < string > ( "" ) ;
58
58
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
+ } ) ;
65
71
const [ url , setUrl ] = useState < string > ( "http://localhost:3001/sse" ) ;
66
72
const [ transportType , setTransportType ] = useState < "stdio" | "sse" > ( "stdio" ) ;
67
73
const [ requestHistory , setRequestHistory ] = useState <
@@ -84,6 +90,14 @@ const App = () => {
84
90
const [ nextToolCursor , setNextToolCursor ] = useState < string | undefined > ( ) ;
85
91
const progressTokenRef = useRef ( 0 ) ;
86
92
93
+ useEffect ( ( ) => {
94
+ localStorage . setItem ( "lastCommand" , command ) ;
95
+ } , [ command ] ) ;
96
+
97
+ useEffect ( ( ) => {
98
+ localStorage . setItem ( "lastArgs" , args ) ;
99
+ } , [ args ] ) ;
100
+
87
101
const pushHistory = ( request : object , response : object ) => {
88
102
setRequestHistory ( ( prev ) => [
89
103
...prev ,
0 commit comments