// Minimal MCP stdio server for verifying the dsh-mcp-client bridge. // Exposes one tool `echo` (returns its `message` argument) using the // @modelcontextprotocol/sdk vendored with the local dsh installation. // Imports use absolute file URLs so the script resolves the SDK from // the dsh profiles junction farm; the SDK's own `zod` import resolves // from the same farm. // // Run directly (`node server.mjs`) it serves MCP over stdio for the // dsh-mcp-client bridge. Imported as a module it exports createServer() // so tests can drive the real handlers over InMemoryTransport. import { McpServer } from "file:///C:/Users/12914/.dsh/profiles/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js"; import { StdioServerTransport } from "file:///C:/Users/12914/.dsh/profiles/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js"; import { z } from "file:///C:/Users/12914/.dsh/profiles/node_modules/zod/index.js"; import { pathToFileURL } from "node:url"; export function createServer() { const server = new McpServer({ name: "dsh-demo", version: "0.1.0" }); server.registerTool("echo", { title: "Echo", description: "Returns the message it was given, prefixed with 'echo:'.", inputSchema: { message: z.string().describe("Text to echo back.") } }, async ({ message }) => ({ content: [{ type: "text", text: `echo: ${message}` }] })); return server; } const isMain = process.argv[1] !== undefined && import.meta.url === pathToFileURL(process.argv[1]).href; if (isMain) { const server = createServer(); await server.connect(new StdioServerTransport()); }