()
| 84 | >(); |
| 85 | |
| 86 | async function main(): Promise<void> { |
| 87 | console.log('MCP Interactive Client'); |
| 88 | console.log('====================='); |
| 89 | |
| 90 | // Connect to server immediately with default settings |
| 91 | await connect(); |
| 92 | |
| 93 | // Start the elicitation loop in the background |
| 94 | elicitationLoop().catch(error => { |
| 95 | console.error('Unexpected error in elicitation loop:', error); |
| 96 | process.exit(1); |
| 97 | }); |
| 98 | |
| 99 | // Short delay allowing the server to send any SSE elicitations on connection |
| 100 | await new Promise(resolve => setTimeout(resolve, 200)); |
| 101 | |
| 102 | // Wait until we are done processing any initial elicitations |
| 103 | await waitForElicitationsToComplete(); |
| 104 | |
| 105 | // Print help and start the command loop |
| 106 | printHelp(); |
| 107 | await commandLoop(); |
| 108 | } |
| 109 | |
| 110 | async function waitForElicitationsToComplete(): Promise<void> { |
| 111 | // Wait until the queue is empty and nothing is being processed |
no test coverage detected
searching dependent graphs…