File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -159,16 +159,20 @@ class MCPClient {
159159 output : process . stdout ,
160160 } ) ;
161161
162- console . log ( "\nMCP Client Started!" ) ;
163- console . log ( "Type your queries or 'quit' to exit." ) ;
164-
165- while ( true ) {
166- const message = await rl . question ( "\nQuery: " ) ;
167- if ( message === "quit" ) {
168- break ;
162+ try {
163+ console . log ( "\nMCP Client Started!" ) ;
164+ console . log ( "Type your queries or 'quit' to exit." ) ;
165+
166+ while ( true ) {
167+ const message = await rl . question ( "\nQuery: " ) ;
168+ if ( message . toLowerCase ( ) === "quit" ) {
169+ break ;
170+ }
171+ const response = await this . processQuery ( message ) ;
172+ console . log ( "\n" + response ) ;
169173 }
170- const response = await this . processQuery ( message ) ;
171- console . log ( "\n" + response ) ;
174+ } finally {
175+ rl . close ( ) ;
172176 }
173177 }
174178
@@ -182,7 +186,7 @@ class MCPClient {
182186
183187async function main ( ) {
184188 if ( process . argv . length < 3 ) {
185- console . log ( "Usage: node index.ts <path_to_server_script>" ) ;
189+ console . log ( "Usage: node build/ index.js <path_to_server_script>" ) ;
186190 return ;
187191 }
188192 const mcpClient = new MCPClient ( ) ;
You can’t perform that action at this time.
0 commit comments