A Model Context Protocol (MCP) server that helps read GitHub repository structure and important files. Inspired by gitingest. Using mcp-client-cli:
Add this skill
npx mdskills install adhikasp/mcp-git-ingestProvides useful GitHub repo analysis tools with clear setup, though permissions could be tighter
1# MCP Git Ingest2[](https://smithery.ai/server/mcp-git-ingest)34A Model Context Protocol (MCP) server that helps read GitHub repository structure and important files.56Inspired by [gitingest](https://gitingest.com/).78<a href="https://glama.ai/mcp/servers/un2zatig9e"><img width="380" height="200" src="https://glama.ai/mcp/servers/un2zatig9e/badge" /></a>910## Configuration1112```json13{14 "mcpServers": {15 "mcp-git-ingest": {16 "command": "uvx",17 "args": ["--from", "git+https://github.com/adhikasp/mcp-git-ingest", "mcp-git-ingest"],18 }19 }20}21```2223## Usage2425Using [mcp-client-cli](https://github.com/adhikasp/mcp-client-cli):2627```28$ llm read https://github.com/adhikasp/mcp-git-ingest and determine how the code technically works2930I'll help you understand the technical details of the mcp-git-ingest repository. I'll first fetch the directory structure and then read the important files to analyze how the code works.3132Tool Calls:33 github_directory_structure34 Args:35 repo_url: https://github.com/adhikasp/mcp-git-ingest3637Now, I'll read the important files to understand the technical implementation:3839Tool Calls:40 github_read_important_files41 Args:42 repo_url: https://github.com/adhikasp/mcp-git-ingest43 file_paths: ['README.md', 'src/mcp_git_ingest/main.py', 'pyproject.toml']4445Let me break down how this code technically works:46471. Purpose:48The `mcp-git-ingest` is a Model Context Protocol (MCP) server designed to help read GitHub repository structures and important files. It provides two main tools:49- `github_directory_structure`: Returns a tree-like representation of a repository's directory structure50- `github_read_important_files`: Reads and returns the contents of specified files in a repository51522. Technical Implementation:5354a. Dependencies:55- Uses `fastmcp` for creating an MCP server56- Uses `gitpython` for Git repository operations57- Requires Python 3.8+5859b. Key Functions:6061`clone_repo(repo_url: str) -> str`:62- Creates a deterministic temporary directory based on the repository URL's hash63- Checks if the repository is already cloned64- If not, clones the repository65- Handles error cases and cleanup66- Returns the path to the cloned repository6768`get_directory_tree(path: str, prefix: str = "") -> str`:69- Recursively generates a tree-like directory structure70- Skips `.git` directories71- Uses Unicode box-drawing characters to create a visual tree representation72- Handles sorting of entries7374`github_directory_structure(repo_url: str) -> str`:75- Clones the repository76- Generates directory tree77- Cleans up the temporary repository after processing78- Returns the tree structure or an error message7980`github_read_important_files(repo_url: str, file_paths: List[str]) -> dict[str, str]`:81- Clones the repository82- Reads specified files83- Returns a dictionary mapping file paths to their contents84- Handles file reading errors85- Cleans up the temporary repository86873. Error Handling:88- Uses try-except blocks to handle repository cloning, file reading errors89- Ensures temporary directories are always cleaned up using `finally` blocks90- Returns descriptive error messages91924. Performance Optimizations:93- Uses a hash-based temporary directory naming to potentially reuse cloned repositories94- Checks for existing repositories before cloning95- Implements cleanup to prevent accumulation of temporary files96975. Unique Features:98- Deterministic temporary directory creation99- Unicode tree representation100- Flexible file reading with error handling1011026. Execution:103- Can be run as a CLI tool via `mcp-git-ingest`104- Configured through `pyproject.toml`105- Depends on `fastmcp` for MCP server functionality106107The code is a robust, flexible tool for programmatically exploring and reading GitHub repositories, with a focus on error handling and clean implementation.108109Would you like me to elaborate on any specific aspect of the implementation?110```111112
Full transparency — inspect the skill content before installing.