You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
text: `Please summarize the following text concisely:\n\n${text}`,
418
+
},
419
+
},
420
+
],
421
+
maxTokens: 500,
422
+
});
423
+
424
+
return {
425
+
content: [
426
+
{
427
+
type: "text",
428
+
text: response.content.type==="text"?response.content.text:"Unable to generate summary",
429
+
},
430
+
],
431
+
};
432
+
}
433
+
);
434
+
435
+
asyncfunction main() {
436
+
const transport =newStdioServerTransport();
437
+
awaitmcpServer.connect(transport);
438
+
console.log("MCP server is running...");
410
439
}
411
440
412
-
// Sampling request just after connecting to MCP Client
413
-
server.connect(transport);
414
-
samplingExample(server);
441
+
main().catch((error) => {
442
+
console.error("Server error:", error);
443
+
process.exit(1);
444
+
});
415
445
```
416
446
447
+
417
448
## Running Your Server
418
449
419
450
MCP servers in TypeScript need to be connected to a transport to communicate with clients. How you start the server depends on the choice of transport:
0 commit comments