MCPcopy Create free account
hub / github.com/modelcontextprotocol/typescript-sdk / main

Function main

src/examples/client/elicitationUrlExample.ts:86–108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

84>();
85
86async 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
110async function waitForElicitationsToComplete(): Promise<void> {
111 // Wait until the queue is empty and nothing is being processed

Callers 1

Calls 5

elicitationLoopFunction · 0.85
connectFunction · 0.70
printHelpFunction · 0.70
commandLoopFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…