Skip to main content
Glama

docs_preview

Start a local development server to preview documentation before deployment, supporting Docusaurus, MkDocs, and Sphinx frameworks.

Instructions

Start local development server to preview documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docsPathYesPath to documentation directory
frameworkYesDocumentation framework used
portNoPort number (default: 3000 for Docusaurus, 8000 for MkDocs/Sphinx)

Implementation Reference

  • The main handler function for the 'docs_preview' tool. It generates framework-specific (Docusaurus, MkDocs, Sphinx) instructions for starting a local preview server, including commands and port information.
    export async function preview(args: any) { const { docsPath, framework, port } = args as PreviewArgs; const defaultPorts: Record<string, number> = { docusaurus: 3000, mkdocs: 8000, sphinx: 8000, }; const selectedPort = port || defaultPorts[framework] || 3000; const instructions: Record<string, string> = { docusaurus: `πŸ‘€ Starting Docusaurus Preview: 1. Navigate to docs: cd ${docsPath} 2. Start dev server: npm start 3. Server will run on: http://localhost:${selectedPort} 4. Features: - Hot reload - Fast refresh - Search - Navigation Press Ctrl+C to stop the server.`, mkdocs: `πŸ‘€ Starting MkDocs Preview: 1. Navigate to project: cd ${docsPath} 2. Start dev server: mkdocs serve -a localhost:${selectedPort} 3. Server will run on: http://localhost:${selectedPort} 4. Features: - Auto-reload on save - Live preview - Search Press Ctrl+C to stop the server.`, sphinx: `πŸ‘€ Starting Sphinx Preview: 1. Build the docs: cd ${docsPath} make html 2. Start simple HTTP server: cd _build/html python -m http.server ${selectedPort} 3. Server will run on: http://localhost:${selectedPort} 4. For auto-rebuild, use sphinx-autobuild: pip install sphinx-autobuild sphinx-autobuild . _build/html --port ${selectedPort} Press Ctrl+C to stop the server.`, }; const instruction = instructions[framework] || "Framework not supported"; return { content: [ { type: "text", text: instruction, }, ], }; }
  • src/index.ts:179-201 (registration)
    Registration of the 'docs_preview' tool in the tools array provided to ListToolsRequestHandler. Includes name, description, and input schema.
    { name: "docs_preview", description: "Start local development server to preview documentation", inputSchema: { type: "object", properties: { docsPath: { type: "string", description: "Path to documentation directory", }, framework: { type: "string", description: "Documentation framework used", enum: ["docusaurus", "mkdocs", "sphinx"], }, port: { type: "number", description: "Port number (default: 3000 for Docusaurus, 8000 for MkDocs/Sphinx)", }, }, required: ["docsPath", "framework"], }, },
  • src/index.ts:312-313 (registration)
    Dispatch case in the CallToolRequestHandler switch statement that invokes the preview handler function.
    case "docs_preview": return await preview(args);
  • TypeScript interface defining the expected input arguments for the preview function, matching the tool schema.
    interface PreviewArgs { docsPath: string; framework: string; port?: number; }
  • Import statement for the preview handler function used in the tool dispatch.
    import { preview } from "./tools/preview.js";

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ThaLoc0one/documentation-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server