Skip to main content
Glama
narumiruna

Gitingest MCP Server

ingest_git

Analyze and clone a Git repository or local directory, then process files based on specified patterns and parameters. Retrieve summaries, file structures, or file contents directly.

Instructions

This function analyzes a source (URL or local path), clones the corresponding repository (if applicable), and processes its files according to the specified query parameters. It can return a summary, a tree-like structure of the files, or the content of the files.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
branchNoThe branch to clone and ingest.main
exclude_patternsNoPattern or set of patterns specifying which files to exclude, e.q. '*.md, src/'
include_patternsNoPattern or set of patterns specifying which files to include, e.q. '*.md, src/'
max_file_sizeNoMaximum allowed file size for file ingestion.Files larger than this size are ignored, by default 10*1024*1024 (10 MB).
sourceYesThe source to analyze, which can be a URL (for a Git repository) or a local directory path.

Implementation Reference

  • The core handler function for the 'ingest_git' MCP tool. It defines the input parameters with descriptions (schema), is registered via @mcp.tool(), and implements the logic by calling the external ingest_async function to process the git repository or directory and return a combined summary, tree, and content.
    @mcp.tool()
    async def ingest_git(
        source: Annotated[
            str,
            Field(
                description="The source to analyze, which can be a URL (for a Git repository) or a local directory path."
            ),
        ],
        max_file_size: Annotated[
            int,
            Field(
                description=(
                    "Maximum allowed file size for file ingestion."
                    "Files larger than this size are ignored, by default 10*1024*1024 (10 MB)."
                )
            ),
        ] = 10 * 1024 * 1024,
        include_patterns: Annotated[
            str,
            Field(description="Pattern or set of patterns specifying which files to include, e.q. '*.md, src/'"),
        ] = "",
        exclude_patterns: Annotated[
            str,
            Field(description="Pattern or set of patterns specifying which files to exclude, e.q. '*.md, src/'"),
        ] = "",
        branch: Annotated[str, Field(description="The branch to clone and ingest.")] = "main",
    ) -> str:
        """
        This function analyzes a source (URL or local path), clones the corresponding repository (if applicable),
        and processes its files according to the specified query parameters.
        It can return a summary, a tree-like structure of the files, or the content of the files.
        """
        summary, tree, content = await ingest_async(
            source,
            max_file_size=max_file_size,
            include_patterns=include_patterns,
            exclude_patterns=exclude_patterns,
            branch=branch,
        )
    
        return "\n\n".join(
            [
                summary,
                tree,
                content,
            ]
        )
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/narumiruna/gitingest-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server