MCP Git Explorer
Allows to explore remote Git repositories by cloning and analyzing their contents, generating structured text representations with token counting and .gitignore support.
Integrates with GitLab to access private repositories using token-based authentication, enabling exploration of GitLab-hosted code.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Git Explorer explore https://github.com/example/repo"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Git Explorer
Simple MCP (Model Context Protocol) server for fetching the remote git repository content as a structured text file.
Features
Clone and analyze Git repositories
Generate a structured text representation of repository contents
Quickly estimate codebase size and token count without retrieving all content
Support for public repositories and private GitLab repositories with token authentication
Tokenization counting using OpenAI's tiktoken library
Respect for .gitignore and .repomixignore patterns
Skip binary files and empty text files
Integration with Claude's Model Context Protocol
Related MCP server: Gitingest MCP Server
Installation
From PyPI
pip install mcp-git-explorerUsing uv
uv pip install mcp-git-explorerDirect execution with uvx (without installation)
uvx mcp-git-explorerUsage
As a command-line tool
# Basic usage
mcp-git-explorer
# Using SSE transport
mcp-git-explorer --transport sse
# Providing GitLab token
mcp-git-explorer --gitlab-token YOUR_TOKENEnvironment Variables
GIT_EXPLORER_GITLAB_TOKEN: Your GitLab personal access token for accessing private repositories
In Claude
MCP Git Explorer provides Claude with the ability to:
Explore Git repositories without needing to manually download and upload files
Access the full contents of repositories, with automatic token counting
Navigate through repository structure and file contents
Quickly assess repository size before deciding whether to retrieve full content
When to use which tool
Use
estimate_codebasewhen you want to quickly check the size and structure of a repository before analyzing its contents. This is especially useful for large repositories where you need to check if retrieving the full content is feasible within token limits.Use
get_codebasewhen you need to analyze the actual code and content of the files in the repository.
Available Tools
get_codebase(repo_url: str, use_token: bool = True) -> str: Clone and analyze a Git repository, returning full file contentsestimate_codebase(repo_url: str, use_token: bool = True) -> str: Quick analysis providing repository statistics including file count, structure, and token estimationcheck_gitlab_token_status() -> str: Check if a GitLab token is configured
Development
Setup
# Clone the repository
git clone https://github.com/jmiedzinski/mcp-git-explorer.git
cd mcp-git-explorer
# Install development dependencies
uv pip install -e ".[dev]"Running locally
# Run directly
python -m mcp_git_explorer.cli
# Run via MCP CLI
mcp dev mcp_git_explorer/cli.py
# Run via uvx
uvx mcp-git-explorerLicense
MIT
Available Tools
4 toolscheck_gitlab_token_statusA
Check if the GitLab token is configured in the environment. Returns: A message indicating whether the GitLab token is configured
Inputs: no named parameters.
estimate_codebaseA
Get statistics about a Git repository without downloading all content.
This tool clones a git repository from the provided URL, analyzes its structure,
and returns statistical information useful for LLM processing, including:
- Estimated token count
- Total file count
- Repository structure
Args:
repo_url (str): The URL of the Git repository to clone
use_token (bool, optional): Whether to use the GitLab token for authentication.
Defaults to True.
Returns:
str: A formatted text representation of the repository statistics
Raises:
GitCommandError: If there is an error during the git clone operation
Exception: For any other errors that occur during processing
Inputs: repo_url (required), use_token.
get_codebaseA
Clone a Git repository and generate a structured text file containing its contents.
This tool clones a git repository from the provided URL, processes its contents,
and returns a single text file containing the repository structure and the content
of all files. Binary files and empty text files are excluded. The tool respects
.gitignore and .repomixignore patterns. The output includes an estimated token count
using the o200k_base encoding.
Args:
repo_url (str): The URL of the Git repository to clone
use_token (bool, optional): Whether to use the GitLab token for authentication.
Defaults to True.
Returns:
str: A formatted text representation of the repository contents, including
file structure, estimated token count, and the content of all text files.
Raises:
GitCommandError: If there is an error during the git clone operation
Exception: For any other errors that occur during processing
Inputs: repo_url (required), use_token.
get_fileA
Fetch the content of a single specified file from a Git repository.
This tool clones a Git repository from the provided URL, reads the content
of the specified file, and returns it as a string. The repository is cloned
with depth=1 for efficiency. If the file does not exist or an error occurs,
an appropriate error message is returned.
Args:
repo_url (str): The URL of the Git repository to clone.
file_path (str): The relative path to the file within the repository.
use_token (bool, optional): Whether to use the GitLab token for authentication.
Defaults to True.
Returns:
str: The content of the specified file, or an error message if retrieval fails.
Inputs: repo_url (required), file_path (required), use_token.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
The tools are mostly distinct: get_codebase returns full content, estimate_codebase returns statistics, get_file retrieves a single file, and check_gitlab_token_status checks configuration. There is minor overlap between get_codebase and estimate_codebase (both analyze the repo), but their outputs are clearly different.
All tool names follow the verb_noun pattern in snake_case (get_, check_, estimate_). The naming is consistent and predictable, with no mixed conventions.
Four tools is well-suited for a Git explorer. The scope is focused on repository inspection, and each tool serves a distinct purpose without bloat or excessive overlap.
The tool set covers the core needs: full codebase extraction, single file retrieval, and statistics. A minor gap is the lack of a dedicated tool for listing the repository tree without content, though estimate_codebase partially addresses this. Overall, it is reasonably complete for its stated purpose.
Maintenance
Related MCP Connectors
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Operate GitHub from your AI assistant: repos, PRs, issues, Actions. Previews and read-only mode.
Read and write KukGit repositories, files, issues and pull requests from an AI assistant.
Access the GitHub API, enabling file operations, repository management, search functionality, and…
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables Claude to interact with git repositories by providing real-time access to repository status, branch information, commit history, and file changes. Allows users to query their git workspace through natural language commands.-
- FlicenseBqualityDmaintenanceEnables analysis and querying of Git repository content (both public and private) through a unified tool that provides repository summaries, file structures, and full content optimized for LLM consumption.1-
- AlicenseNot gradedqualityDmaintenanceEnables to interact with GitHub repositories directly from Claude, supporting actions like viewing repos, checking status, committing and pushing changes, and managing pull requests.544 npmMIT
- AlicenseAqualityBmaintenanceEnables Claude to inspect, analyze, and grade local Git repositories with tools for stats, TODO scanning, git history, large file detection, health scores, and tech stack fingerprinting.6MIT