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
32
examples/guides/index.examples.ts
Normal file
32
examples/guides/index.examples.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* Type-checked companion for `docs/index.md` (the landing page).
|
||||
*
|
||||
* The single region below is the landing hero: a complete MCP server in one
|
||||
* block. Imports live inside the region so the rendered block stands alone.
|
||||
* Synced into the page by `pnpm sync:snippets`; executed by `pnpm docs:examples` like every runnable companion.
|
||||
*
|
||||
* @module
|
||||
*/
|
||||
|
||||
//#region serveStdio_minimal
|
||||
import { McpServer } from '@modelcontextprotocol/server';
|
||||
import { serveStdio } from '@modelcontextprotocol/server/stdio';
|
||||
import * as z from 'zod/v4';
|
||||
|
||||
serveStdio(() => {
|
||||
const server = new McpServer({ name: 'weather', version: '1.0.0' });
|
||||
|
||||
server.registerTool(
|
||||
'get-forecast',
|
||||
{
|
||||
description: 'Get the weather forecast for a city',
|
||||
inputSchema: z.object({ city: z.string() })
|
||||
},
|
||||
async ({ city }) => ({
|
||||
content: [{ type: 'text', text: `Sunny in ${city} all week.` }]
|
||||
})
|
||||
);
|
||||
|
||||
return server;
|
||||
});
|
||||
//#endregion serveStdio_minimal
|
||||
Loading…
Reference in a new issue