import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { z } from "zod"; import { $ } from "bun"; const server = new McpServer({ name: "man-page-lookup", version: "0.0.1" }); server.tool("look-up-man-page", "Look up a man page for a given Unix / terminal command.", { command: z.string().regex(/^[a-zA-Z0-9_-]+$/).min(1).max(40).toLowerCase() }, async ({ command }) => { let output = await $`man ${command} | col -b`.text(); return { content: [{ type: "text", text: output }] }; } ); const transport = new StdioServerTransport(); await server.connect(transport);