docs: rebuild the v2 documentation around a task-based page tree (#2397)
This commit is contained in:
parent
708d5455d9
commit
b153505428
1 changed files with 11884 additions and 4971 deletions
23
examples/guides/troubleshooting.stdio.examples.ts
Normal file
23
examples/guides/troubleshooting.stdio.examples.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// docs: typecheck-only
|
||||
/**
|
||||
* Companion example for the stdio entry on `docs/troubleshooting.md`.
|
||||
*
|
||||
* This file is separate from `troubleshooting.examples.ts` because
|
||||
* `serveStdio` binds stdin: importing it into the runnable companion would
|
||||
* keep that program from terminating. Verified by
|
||||
* `pnpm --filter @modelcontextprotocol/examples typecheck` and
|
||||
* `pnpm sync:snippets --check`; never executed.
|
||||
*
|
||||
* @module
|
||||
*/
|
||||
/* eslint-disable no-console */
|
||||
//#region serveStdio_stderr
|
||||
import { McpServer } from '@modelcontextprotocol/server';
|
||||
import { serveStdio } from '@modelcontextprotocol/server/stdio';
|
||||
|
||||
serveStdio(() => {
|
||||
const server = new McpServer({ name: 'app', version: '1.0.0' });
|
||||
console.error('app server running on stdio'); // stderr — never console.log
|
||||
return server;
|
||||
});
|
||||
//#endregion serveStdio_stderr
|
||||
Loading…
Reference in a new issue