{"id":23108274,"url":"https://github.com/adhikasp/mcp-git-ingest","last_synced_at":"2025-05-06T00:50:06.215Z","repository":{"id":268206431,"uuid":"903643338","full_name":"adhikasp/mcp-git-ingest","owner":"adhikasp","description":"A Model Context Protocol (MCP) server that helps read GitHub repository structure and important files.","archived":false,"fork":false,"pushed_at":"2025-01-26T10:32:13.000Z","size":17,"stargazers_count":204,"open_issues_count":2,"forks_count":29,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-06T00:50:00.459Z","etag":null,"topics":["git","llm","mcp","model-context-protocol"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adhikasp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-15T06:36:38.000Z","updated_at":"2025-05-05T20:03:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"27779828-f688-494d-8af4-1543800b04d0","html_url":"https://github.com/adhikasp/mcp-git-ingest","commit_stats":null,"previous_names":["adhikasp/mcp-git-ingest"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhikasp%2Fmcp-git-ingest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhikasp%2Fmcp-git-ingest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhikasp%2Fmcp-git-ingest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adhikasp%2Fmcp-git-ingest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adhikasp","download_url":"https://codeload.github.com/adhikasp/mcp-git-ingest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252601674,"owners_count":21774657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","llm","mcp","model-context-protocol"],"created_at":"2024-12-17T01:18:10.100Z","updated_at":"2025-05-06T00:50:05.928Z","avatar_url":"https://github.com/adhikasp.png","language":"Python","readme":"# MCP Git Ingest\n[![smithery badge](https://smithery.ai/badge/mcp-git-ingest)](https://smithery.ai/server/mcp-git-ingest)\n\nA Model Context Protocol (MCP) server that helps read GitHub repository structure and important files.\n\nInspired by [gitingest](https://gitingest.com/).\n\n\u003ca href=\"https://glama.ai/mcp/servers/un2zatig9e\"\u003e\u003cimg width=\"380\" height=\"200\" src=\"https://glama.ai/mcp/servers/un2zatig9e/badge\" /\u003e\u003c/a\u003e\n\n## Configuration\n\n```json\n{\n    \"mcpServers\": {\n        \"mcp-git-ingest\": {\n            \"command\": \"uvx\",\n            \"args\": [\"--from\", \"git+https://github.com/adhikasp/mcp-git-ingest\", \"mcp-git-ingest\"],\n        }\n    }\n}\n```\n\n## Usage\n\nUsing [mcp-client-cli](https://github.com/adhikasp/mcp-client-cli):\n\n```\n$ llm read https://github.com/adhikasp/mcp-git-ingest and determine how the code technically works\n\nI'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.\n\nTool Calls:\n  github_directory_structure\n  Args:\n    repo_url: https://github.com/adhikasp/mcp-git-ingest\n\nNow, I'll read the important files to understand the technical implementation:\n\nTool Calls:\n  github_read_important_files\n  Args:\n    repo_url: https://github.com/adhikasp/mcp-git-ingest\n    file_paths: ['README.md', 'src/mcp_git_ingest/main.py', 'pyproject.toml']\n\nLet me break down how this code technically works:\n\n1. Purpose:\nThe `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:\n- `github_directory_structure`: Returns a tree-like representation of a repository's directory structure\n- `github_read_important_files`: Reads and returns the contents of specified files in a repository\n\n2. Technical Implementation:\n\na. Dependencies:\n- Uses `fastmcp` for creating an MCP server\n- Uses `gitpython` for Git repository operations\n- Requires Python 3.8+\n\nb. Key Functions:\n\n`clone_repo(repo_url: str) -\u003e str`:\n- Creates a deterministic temporary directory based on the repository URL's hash\n- Checks if the repository is already cloned\n- If not, clones the repository\n- Handles error cases and cleanup\n- Returns the path to the cloned repository\n\n`get_directory_tree(path: str, prefix: str = \"\") -\u003e str`:\n- Recursively generates a tree-like directory structure\n- Skips `.git` directories\n- Uses Unicode box-drawing characters to create a visual tree representation\n- Handles sorting of entries\n\n`github_directory_structure(repo_url: str) -\u003e str`:\n- Clones the repository\n- Generates directory tree\n- Cleans up the temporary repository after processing\n- Returns the tree structure or an error message\n\n`github_read_important_files(repo_url: str, file_paths: List[str]) -\u003e dict[str, str]`:\n- Clones the repository\n- Reads specified files\n- Returns a dictionary mapping file paths to their contents\n- Handles file reading errors\n- Cleans up the temporary repository\n\n3. Error Handling:\n- Uses try-except blocks to handle repository cloning, file reading errors\n- Ensures temporary directories are always cleaned up using `finally` blocks\n- Returns descriptive error messages\n\n4. Performance Optimizations:\n- Uses a hash-based temporary directory naming to potentially reuse cloned repositories\n- Checks for existing repositories before cloning\n- Implements cleanup to prevent accumulation of temporary files\n\n5. Unique Features:\n- Deterministic temporary directory creation\n- Unicode tree representation\n- Flexible file reading with error handling\n\n6. Execution:\n- Can be run as a CLI tool via `mcp-git-ingest`\n- Configured through `pyproject.toml`\n- Depends on `fastmcp` for MCP server functionality\n\nThe code is a robust, flexible tool for programmatically exploring and reading GitHub repositories, with a focus on error handling and clean implementation.\n\nWould you like me to elaborate on any specific aspect of the implementation?\n```\n\n","funding_links":[],"categories":["Developer Tools","Cloud Infrastructure","Repository \u0026 Code Analysis MCP Servers","📚 Projects (1974 total)","MCP 服务器精选列表","Python","Legend","پیاده‌سازی‌های سرور","🤖 AI/ML","MCP Frameworks and libraries","Version Control","🔄 CI/CD \u0026 Version Control","Table of Contents"],"sub_categories":["Version Control","🔄 Version Control","MCP Servers","🔄 版本控制 (Git / GitHub / GitLab)","🔄 \u003ca name=\"version-control\"\u003e\u003c/a\u003eVersion Control","🔄 \u003ca name=\"version-control\"\u003e\u003c/a\u003eکنترل نسخه","Python","How to Submit"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadhikasp%2Fmcp-git-ingest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadhikasp%2Fmcp-git-ingest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadhikasp%2Fmcp-git-ingest/lists"}