MCP DocGen Examples

See MCP DocGen in action with real-world examples of generating documentation for Model Control Protocol servers.

🚀 Basic Usage

$ mcp-docgen generate ./my-server

Generate documentation for any MCP server with a single command.

🎨 Custom Theme

$ mcp-docgen generate ./server --theme modern

Choose from multiple professional themes or create your own.

🌐 Deploy to Web

$ mcp-docgen deploy --platform netlify

One-command deployment to popular hosting platforms.

📄 TypeScript MCP Server Documentation

Generate comprehensive documentation for a TypeScript-based MCP server with resources, tools, and prompts.

server.ts
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import {
  ListResourcesRequestSchema,
  ReadResourceRequestSchema,
  ListToolsRequestSchema,
  CallToolRequestSchema,
} from "@modelcontextprotocol/sdk/types.js";

/**
 * File Management MCP Server
 * Provides file system operations for LLM applications
 */
const server = new Server(
  {
    name: "file-manager-server",
    version: "1.0.0",
    description: "Secure file system operations for AI applications"
  },
  {
    capabilities: {
      resources: {},
      tools: {},
      prompts: {}
    }
  }
);

// Resource handlers for file listing
server.setRequestHandler(ListResourcesRequestSchema, async () => {
  return {
    resources: [
      {
        uri: "file://documents",
        name: "Documents Directory",
        mimeType: "text/plain",
        description: "Access to user documents"
      }
    ]
  };
});

// Tool for reading files
server.setRequestHandler(ListToolsRequestSchema, async () => {
  return {
    tools: [
      {
        name: "read_file",
        description: "Read contents of a text file",
        inputSchema: {
          type: "object",
          properties: {
            path: {
              type: "string",
              description: "Path to the file to read"
            }
          },
          required: ["path"]
        }
      },
      {
        name: "list_directory",
        description: "List files in a directory",
        inputSchema: {
          type: "object",
          properties: {
            path: {
              type: "string",
              description: "Directory path to list"
            }
          },
          required: ["path"]
        }
      }
    ]
  };
});

async function main() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
  console.error("File Manager MCP Server running on stdio");
}

main();
$ mcp-docgen generate ./file-manager-server
🔍 Analyzing MCP server...
📝 Generating documentation...
🎨 Applying theme...
✅ Documentation generated in ./docs/
🌐 Run 'mcp-docgen serve ./docs' to preview

Advanced options:

Advanced Generation
# Custom output directory and theme
mcp-docgen generate ./file-manager-server \
  --output ./custom-docs \
  --theme professional \
  --include-examples \
  --add-search

# Generate with configuration file
mcp-docgen generate ./server --config mcp-docgen.json

📋 Generated Documentation Structure:

  • Overview - Server description and capabilities
  • Resources - Documents Directory with access details
  • Tools - read_file and list_directory with parameters
  • API Reference - Complete JSON-RPC method documentation
  • Examples - Interactive code samples
  • Schema - Input/output type definitions

Preview would show a beautiful, interactive documentation site with syntax highlighting, copy buttons, and mobile-responsive design.

🐍 Python MCP Server Documentation

Document a Python-based MCP server that provides data analysis capabilities.

data_analyzer.py
#!/usr/bin/env python3
"""
Data Analytics MCP Server
Provides data analysis tools for CSV files and datasets
"""

import asyncio
import pandas as pd
from mcp.server import Server
from mcp.server.stdio import stdio_server
from mcp.types import (
    Resource,
    Tool,
    TextContent,
    ImageContent,
    EmbeddedResource,
)

class DataAnalyzer:
    """MCP Server for data analysis operations"""
    
    def __init__(self):
        self.server = Server("data-analyzer")
        self.setup_handlers()
    
    def setup_handlers(self):
        """Configure MCP request handlers"""
        
        @self.server.list_resources()
        async def list_resources() -> list[Resource]:
            """List available data resources"""
            return [
                Resource(
                    uri="data://uploads",
                    name="Uploaded Datasets",
                    mimeType="text/csv",
                    description="User-uploaded CSV files for analysis"
                )
            ]
        
        @self.server.list_tools()
        async def list_tools() -> list[Tool]:
            """List available analysis tools"""
            return [
                Tool(
                    name="analyze_csv",
                    description="Perform statistical analysis on CSV data",
                    inputSchema={
                        "type": "object",
                        "properties": {
                            "file_path": {
                                "type": "string",
                                "description": "Path to CSV file"
                            },
                            "analysis_type": {
                                "type": "string",
                                "enum": ["summary", "correlation", "distribution"],
                                "description": "Type of analysis to perform"
                            }
                        },
                        "required": ["file_path", "analysis_type"]
                    }
                ),
                Tool(
                    name="create_visualization",
                    description="Generate charts and plots from data",
                    inputSchema={
                        "type": "object",
                        "properties": {
                            "data_source": {"type": "string"},
                            "chart_type": {
                                "type": "string",
                                "enum": ["bar", "line", "scatter", "histogram"]
                            },
                            "x_column": {"type": "string"},
                            "y_column": {"type": "string"}
                        },
                        "required": ["data_source", "chart_type"]
                    }
                )
            ]
        
        @self.server.call_tool()
        async def call_tool(name: str, arguments: dict) -> list[TextContent]:
            """Execute analysis tools"""
            if name == "analyze_csv":
                return await self.analyze_csv(**arguments)
            elif name == "create_visualization":
                return await self.create_visualization(**arguments)
            else:
                raise ValueError(f"Unknown tool: {name}")
    
    async def analyze_csv(self, file_path: str, analysis_type: str):
        """Perform CSV analysis"""
        # Implementation would go here
        return [TextContent(
            type="text",
            text=f"Analysis results for {file_path} ({analysis_type})"
        )]

async def main():
    analyzer = DataAnalyzer()
    async with stdio_server() as (read_stream, write_stream):
        await analyzer.server.run(read_stream, write_stream)

if __name__ == "__main__":
    asyncio.run(main())
mcp-docgen.json
{
  "title": "Data Analytics MCP Server",
  "description": "Professional data analysis tools for LLM applications",
  "theme": "scientific",
  "output": "./analytics-docs",
  "features": {
    "search": true,
    "examples": true,
    "playground": true,
    "download": true
  },
  "sections": {
    "overview": true,
    "quickstart": true,
    "resources": true,
    "tools": true,
    "api": true,
    "examples": true,
    "troubleshooting": true
  },
  "customization": {
    "logo": "./assets/logo.png",
    "colors": {
      "primary": "#2563eb",
      "secondary": "#7c3aed"
    },
    "footer": {
      "links": [
        {"title": "GitHub", "url": "https://github.com/user/data-analyzer"},
        {"title": "Issues", "url": "https://github.com/user/data-analyzer/issues"}
      ]
    }
  }
}
$ mcp-docgen generate ./data-analyzer --config mcp-docgen.json
📊 Generating documentation for Data Analytics MCP Server...
🎨 Applying 'scientific' theme...
🔍 Adding search functionality...
🎮 Creating interactive playground...
✅ Documentation complete! Open ./analytics-docs/index.html

🎯 Professional Documentation Output:

  • Scientific Theme - Clean, data-focused design
  • Interactive Playground - Test tools directly in browser
  • Advanced Search - Full-text search across all content
  • Code Examples - Python and curl examples for each tool
  • Schema Validation - Interactive input parameter validation
  • Download Options - PDF export and offline documentation

🚀 Deployment Examples

Deploy your generated documentation to various hosting platforms with single commands.

GitHub Pages Deployment
# Generate and deploy to GitHub Pages
mcp-docgen generate ./my-server --output ./docs
mcp-docgen deploy --platform github-pages --source ./docs

# Or in one command
mcp-docgen deploy --platform github-pages --generate ./my-server

# Custom branch deployment
mcp-docgen deploy --platform github-pages \
  --branch gh-pages \
  --message "Update documentation"

Automatic Setup: MCP DocGen configures GitHub Pages settings, creates necessary workflows, and sets up custom domains if specified.

Netlify Deployment
# Deploy to Netlify
mcp-docgen deploy --platform netlify --source ./docs

# With custom domain
mcp-docgen deploy --platform netlify \
  --domain my-api-docs.com \
  --source ./docs

# Enable form handling and redirects
mcp-docgen deploy --platform netlify \
  --source ./docs \
  --features forms,redirects,analytics

✅ Deployment Features:

  • Automatic HTTPS certificates
  • Global CDN distribution
  • Form handling for feedback
  • Analytics integration
  • Preview deployments for pull requests
Custom Server Deployment
# Generate optimized build
mcp-docgen build ./my-server --optimize --compress

# Deploy via SCP
mcp-docgen deploy --platform custom \
  --host docs.mycompany.com \
  --user deploy \
  --path /var/www/docs

# Deploy via FTP
mcp-docgen deploy --platform ftp \
  --host ftp.myhost.com \
  --credentials ./ftp-config.json

# Generate Docker image
mcp-docgen docker --source ./docs --tag my-docs:latest

Ready to Try MCP DocGen?

Start generating beautiful documentation for your MCP servers today.

Get Started View on GitHub