rendergit-mcp

sruckh/rendergit-mcp

3.2

If you are the rightful owner of rendergit-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

RendergitMCP is a Model Context Protocol (MCP) server that transforms GitHub repositories into HTML files optimized for AI analysis and human code review.

Tools
2
Resources
0
Prompts
0

RendergitMCP - MCP Server for Repository Rendering

Transform any GitHub repository into LLM-friendly HTML with a single MCP call.

RendergitMCP is a Model Context Protocol (MCP) server that brings Andrej Karpathy's rendergit functionality to Claude Code and other MCP-compatible clients. It flattens GitHub repositories into single HTML files optimized for AI analysis and human code review.

๐Ÿš€ Features

Dual View Modes

  • ๐Ÿ‘ค Human View: Beautiful interface with syntax highlighting, sidebar navigation, and responsive design
  • ๐Ÿค– LLM View: Raw CXML text format - perfect for copying to Claude/ChatGPT for code analysis

Smart Repository Processing

  • Syntax highlighting for code files via Pygments
  • Markdown rendering for README files and documentation
  • Smart filtering - automatically skips binaries and oversized files
  • Directory tree overview with file size information
  • Search-friendly - use Ctrl+F to find anything across all files
  • Responsive design that works on mobile devices

MCP Integration

  • Two MCP tools: render_repo (returns HTML) and render_repo_to_file (saves to disk)
  • SSE Transport: Compatible with Claude Code's Server-Sent Events transport
  • Health monitoring: Built-in health check and server info endpoints
  • Flexible output: Save to custom paths or auto-generated locations

๐Ÿ›  Installation

Prerequisites

  • Python 3.10 or higher
  • Git installed and accessible from command line
  • MCP-compatible client (like Claude Code)

Quick Setup

  1. Clone the repository:

    git clone https://github.com/sruckh/rendergit-mcp.git
    cd rendergit-mcp
    
  2. Install dependencies:

    pip install -r requirements.txt
    # or use uv for faster installation
    uv pip install -r requirements.txt
    
  3. Install rendergit:

    pip install git+https://github.com/karpathy/rendergit.git
    

Docker Setup

# Build the container
docker build -t rendergit-mcp .

# Run the server
docker run -p 8080:8080 rendergit-mcp

๐Ÿ“‹ MCP Tools

render_repo

Renders a Git repository into HTML content returned directly.

Parameters:

  • repo_url (string): GitHub repository URL

Returns: HTML content as string

Example:

# Via MCP client
result = mcp_client.call_tool("render_repo", {
    "repo_url": "https://github.com/karpathy/nanoGPT"
})

render_repo_to_file

Renders a Git repository and saves the HTML to a local file.

Parameters:

  • repo_url (string): GitHub repository URL
  • output_path (string, optional): Custom output path
  • project_type (string, optional): Storage location ('docker' or 'backblaze'), default 'docker'
  • project_subpath (string, optional): Subdirectory within project type

Returns: Dictionary with success status, file path, and metadata

Example:

# Via MCP client
result = mcp_client.call_tool("render_repo_to_file", {
    "repo_url": "https://github.com/karpathy/nanoGPT",
    "project_type": "docker",
    "project_subpath": "ai-repos"
})

๐Ÿ”ง Usage Examples

Basic Repository Rendering

# Start the MCP server
python mcp_rendergit_sdk.py --transport sse --port 8080

Then from your MCP client (like Claude Code):

# Render repository to HTML string
html_content = render_repo("https://github.com/karpathy/nanoGPT")

# Render and save to file
result = render_repo_to_file(
    "https://github.com/karpathy/nanoGPT",
    output_path="/tmp/nanogpt.html"
)
print(f"Saved to: {result['output_path']}")
print(f"File size: {result['file_size']} bytes")

Simplified Repository URLs

The server accepts various URL formats:

  • https://github.com/owner/repo (full URL)
  • github.com/owner/repo (without protocol)
  • owner/repo (simplified format)

Output File Organization

When using render_repo_to_file without specifying output_path:

  • Files are saved to /projects/{project_type}/{project_subpath}/
  • Filename format: {owner}_{repo}.html
  • Example: /projects/docker/ai-repos/karpathy_nanoGPT.html

๐Ÿ— Architecture

Core Components

  • mcp_rendergit_sdk.py: Main MCP server using FastMCP framework
  • rendergit integration: Uses Karpathy's original rendergit library
  • SSE Transport: Server-Sent Events for Claude Code compatibility
  • Health monitoring: /health and /info endpoints

File Structure

rendergit-mcp/
โ”œโ”€โ”€ mcp_rendergit_sdk.py    # Main MCP server
โ”œโ”€โ”€ Dockerfile              # Container configuration
โ”œโ”€โ”€ requirements.txt        # Python dependencies
โ”œโ”€โ”€ docs/                   # Documentation
โ”‚   โ”œโ”€โ”€ INSTALL.md         # Installation guide
โ”‚   โ”œโ”€โ”€ USAGE.md           # Usage examples
โ”‚   โ””โ”€โ”€ DEVELOPMENT.md     # Development guide
โ””โ”€โ”€ vendor/                 # Vendored dependencies

๐Ÿ”„ Integration with Claude Code

  1. Add MCP server to Claude Code:

    claude mcp add rendergit-mcp python /path/to/mcp_rendergit_sdk.py
    
  2. Use in conversations:

    Use rendergit to analyze https://github.com/karpathy/nanoGPT
    
  3. The server will:

    • Clone the repository
    • Process all source files
    • Generate HTML with dual Human/LLM views
    • Return content for AI analysis

๐Ÿงช Development

Running Tests

python -m pytest tests/

Development Mode

# Install in development mode
pip install -e .

# Run with debug logging
python mcp_rendergit_sdk.py --transport sse --port 8080

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

๐Ÿ“Š Performance

  • Fast cloning: Uses shallow clones (--depth 1) for speed
  • Smart filtering: Automatically skips binary files and large files
  • Efficient rendering: Processes files in memory without temporary storage
  • Responsive output: Handles repositories up to 100MB efficiently

๐Ÿ”ง Configuration

Environment Variables

  • RENDERGIT_MAX_SIZE: Maximum file size to process (default: 100KB)
  • RENDERGIT_TIMEOUT: Git clone timeout (default: 60s)
  • RENDERGIT_TEMP_DIR: Temporary directory for clones

Server Options

  • --transport: Transport type (sse, stdio)
  • --port: Server port (default: 8080)
  • --host: Server host (default: 0.0.0.0)

๐Ÿ› Troubleshooting

Common Issues

  1. Git clone failures: Ensure Git is installed and repository is accessible
  2. Large repositories: Some repositories may exceed processing limits
  3. Network timeouts: Check internet connectivity and repository availability

Debug Mode

# Enable debug logging
export PYTHONPATH=.
python -m logging.DEBUG mcp_rendergit_sdk.py

๐Ÿ“ License

This project builds on Andrej Karpathy's rendergit (0BSD License).

MCP integration code is available under MIT License.

๐Ÿ™ Acknowledgments

  • Andrej Karpathy for the original rendergit tool
  • Anthropic for the MCP protocol and Claude Code integration
  • FastMCP team for the excellent MCP Python framework

๐Ÿ”— Links


Ready to transform repositories into AI-friendly HTML? Install RendergitMCP and start analyzing codebases with a single MCP call! ๐Ÿš€