mcp-git-ingest
Ingesta de Git de MCP
Un servidor de Protocolo de Contexto de Modelo (MCP) que ayuda a leer la estructura del repositorio de GitHub y archivos importantes.
Inspirado en gitingest .
Configuración
{
"mcpServers": {
"mcp-git-ingest": {
"command": "uvx",
"args": ["--from", "git+https://github.com/adhikasp/mcp-git-ingest", "mcp-git-ingest"],
}
}
}Related MCP server: Gitingest-MCP
Uso
Usando mcp-client-cli :
$ llm read https://github.com/adhikasp/mcp-git-ingest and determine how the code technically works
I'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.
Tool Calls:
github_directory_structure
Args:
repo_url: https://github.com/adhikasp/mcp-git-ingest
Now, I'll read the important files to understand the technical implementation:
Tool Calls:
github_read_important_files
Args:
repo_url: https://github.com/adhikasp/mcp-git-ingest
file_paths: ['README.md', 'src/mcp_git_ingest/main.py', 'pyproject.toml']
Let me break down how this code technically works:
1. Purpose:
The `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:
- `github_directory_structure`: Returns a tree-like representation of a repository's directory structure
- `github_read_important_files`: Reads and returns the contents of specified files in a repository
2. Technical Implementation:
a. Dependencies:
- Uses `fastmcp` for creating an MCP server
- Uses `gitpython` for Git repository operations
- Requires Python 3.8+
b. Key Functions:
`clone_repo(repo_url: str) -> str`:
- Creates a deterministic temporary directory based on the repository URL's hash
- Checks if the repository is already cloned
- If not, clones the repository
- Handles error cases and cleanup
- Returns the path to the cloned repository
`get_directory_tree(path: str, prefix: str = "") -> str`:
- Recursively generates a tree-like directory structure
- Skips `.git` directories
- Uses Unicode box-drawing characters to create a visual tree representation
- Handles sorting of entries
`github_directory_structure(repo_url: str) -> str`:
- Clones the repository
- Generates directory tree
- Cleans up the temporary repository after processing
- Returns the tree structure or an error message
`github_read_important_files(repo_url: str, file_paths: List[str]) -> dict[str, str]`:
- Clones the repository
- Reads specified files
- Returns a dictionary mapping file paths to their contents
- Handles file reading errors
- Cleans up the temporary repository
3. Error Handling:
- Uses try-except blocks to handle repository cloning, file reading errors
- Ensures temporary directories are always cleaned up using `finally` blocks
- Returns descriptive error messages
4. Performance Optimizations:
- Uses a hash-based temporary directory naming to potentially reuse cloned repositories
- Checks for existing repositories before cloning
- Implements cleanup to prevent accumulation of temporary files
5. Unique Features:
- Deterministic temporary directory creation
- Unicode tree representation
- Flexible file reading with error handling
6. Execution:
- Can be run as a CLI tool via `mcp-git-ingest`
- Configured through `pyproject.toml`
- Depends on `fastmcp` for MCP server functionality
The code is a robust, flexible tool for programmatically exploring and reading GitHub repositories, with a focus on error handling and clean implementation.
Would you like me to elaborate on any specific aspect of the implementation?Available Tools
2 toolsgit_directory_structureGit Directory StructureB
Clone a Git repository and return its directory structure in a tree format.
Inputs: repo_url (required). Returns: result
git_read_important_filesGit Read Important FilesC
Read the contents of specified files in a given git repository.
Inputs: repo_url (required), file_paths (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one exposes repository structure, the other reads file contents. There is no realistic overlap in selection, since listing a tree and reading files are separate operations.
Both tools use snake_case and a shared git_ prefix, but the naming pattern is mixed: git_directory_structure is resource-oriented while git_read_important_files is verb-oriented. They remain readable, but the convention is not fully predictable.
Two tools is thin for a repository-ingestion server, even though each tool has a distinct role. The surface is just barely sufficient for basic use, but it sits at the low end of appropriate scope.
The server covers basic cloning, structure discovery, and file reading, but it lacks branch/ref selection, commit metadata, search, and broader file-discovery operations. These are notable gaps for a git-ingestion workflow, though simple use cases can still proceed.
Maintenance
Related MCP Connectors
Repo intel for AI coding agents: overview, PRs, contributors, hot files, CI, deps. Remote MCP.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Dive into the world of open-source with the GitHub Repo Explorer! Utilize the powerful GitHub
Ask any GitHub repository a question. Get source-backed answers.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to analyze GitHub repository structures and read file contents with features like directory traversal, file type analysis, syntax highlighting, and code pattern detection. Supports both public and private repositories through GitHub API integration.8 npmApache 2.0
- FlicenseNot gradedqualityAmaintenanceEnables MCP clients to quickly extract information from GitHub repositories, including repository summaries, project directory structures, and file contents.-
- FlicenseNot gradedqualityAmaintenanceEnables MCP clients such as Claude Desktop, Cline, and Cursor to quickly extract GitHub repository information, including summaries, directory structure, and file contents.-
- FlicenseNot gradedqualityAmaintenanceEnables MCP clients to quickly extract GitHub repository summaries, project directory structures, and file content.-
Appeared in Searches
- Finding the Best Memory Compression Policies (MCPs) for Optimizing Limited Context Window in Claude Code
- A search for information related to 'augment'
- Learning to Read and Use GitHub Project Documentation
- A server for finding code examples on GitLab using semantic search
- A tool for retrieving code examples from GitLab using semantic search