@@ -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 ,
@@ -57,12 +57,18 @@ const App = () => {
57
57
const [ tools , setTools ] = useState < Tool [ ] > ( [ ] ) ;
58
58
const [ toolResult , setToolResult ] = useState < string > ( "" ) ;
59
59
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
+ } ) ;
66
72
const [ url , setUrl ] = useState < string > ( "http://localhost:3001/sse" ) ;
67
73
const [ transportType , setTransportType ] = useState < "stdio" | "sse" > ( "stdio" ) ;
68
74
const [ requestHistory , setRequestHistory ] = useState <
@@ -85,6 +91,14 @@ const App = () => {
85
91
const [ nextToolCursor , setNextToolCursor ] = useState < string | undefined > ( ) ;
86
92
const progressTokenRef = useRef ( 0 ) ;
87
93
94
+ useEffect ( ( ) => {
95
+ localStorage . setItem ( "lastCommand" , command ) ;
96
+ } , [ command ] ) ;
97
+
98
+ useEffect ( ( ) => {
99
+ localStorage . setItem ( "lastArgs" , args ) ;
100
+ } , [ args ] ) ;
101
+
88
102
const pushHistory = ( request : object , response : object ) => {
89
103
setRequestHistory ( ( prev ) => [
90
104
...prev ,
0 commit comments