MCP_git_repo_to_single_file
MCP to convert a git repo to a single file and feed it to an LLM as context
A Model Context Protocol (MCP) server that clones a GitHub repository and uses files-to-prompt to convert it to a single LLM file. This server allows you to: This package uses uv for fast Python package management. Install uv first if you haven't already: Cursor has native MCP support. Add this to your Cursor MCP settings file at ~/.cursor/mcp.json:
Summary extracted from the README.
MCP GitHub Files Server
A Model Context Protocol (MCP) server that clones a GitHub repository and uses files-to-prompt to convert it to a single LLM file. This server allows you to:
- Analyze GitHub repository directory structures
- Read all files
- Convert GitHub repositories to prompt format using files-to-prompt
Features
- GitHub Repository Analysis: Clone and analyze the structure of any public GitHub repository
- File Reading: Read files from GitHub repositories
- Files to Prompt: Convert files and directories to LLM-friendly prompt format
- Smart Caching: Reuses cloned repositories to improve performance
- Multiple Formats: Support for Markdown, and CXML output formats
Prerequisites
This package uses uv for fast Python package management. Install uv first if you haven't already:
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# or on macOS
brew install uv
# or on Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
Installation
From Git (Recommended)
uv pip install git+https://github.com/nsourlos/MCP_git_repo_to_single_file
Local Development
git clone https://github.com/nsourlos/MCP_git_repo_to_single_file
cd MCP_git_repo_to_single_file
uv pip install -e .
Configuration
Note: This MCP server may have compatibility issues on Visual Studio Code. It has been tested on macOS and Windows 10. To test if the server is installed correctly, run
python test_client.py
Cursor Configuration
Cursor has native MCP support. Add this to your Cursor MCP settings file at ~/.cursor/mcp.json:
{
"mcpServers": {
"git-files-server": {
"command": "uvx",
"args": ["--from", "git+https://github.com/nsourlos/MCP_git_repo_to_single_file", "mcp-git-files-server"],
"env": {}
}
}
}
Claude Code
claude mcp add --scope user git-files-server -- uvx --from git+https://github.com/nsourlos/MCP_git_repo_to_single_file mcp-git-files-server
VS Code Configuration
VS Code doesn't have native MCP support, but you can use the server through VS Code Tasks for easy access:
- Create a
C:\Users\<user>\AppData\Roaming\Code\User\mcp.json(if in Windows) file and a.vscode/mcp.jsonfile in your project root, both with the following content:
{
"servers": {
"git-files-server": {
"command": "uvx",
"args": ["--from", "git+https://github.com/nsourlos/MCP_git_repo_to_single_file", "mcp-git-files-server"],
"env": {}
}
}
}
- Open the MCP SERVERS - INSTALLED section in the Extensions view and
Start Server. Run theMCP: List Serverscommand from the Command Palette (Command+Shift+P) to view the list of installed MCP servers
Tools
files_to_prompt
Convert files and directories to LLM prompt format. Supports both local paths and git URLs.
Parameters:
paths(List[str]): List of file/directory paths or git repository URLsextensions(List[str]): Only include files with these extensions (default: [])include_hidden(bool): Include hidden files and directories (default: False)ignore_patterns(List[str]): Patterns to ignore (default: [])ignore_files_only(bool): Only ignore files, not directories matching patterns (default: False)ignore_gitignore(bool): Ignore .gitignore rules (default: False)output_format(str): Output format - "default", "cxml", or "markdown" (default: "default")include_line_numbers(bool): Include line numbers in output (default: False)output_file(str): Output file path (default: "")
Example:
files_to_prompt(
paths=["https://github.com/user/repo"],
extensions=["py", "md"],
output_format="markdown"
)
Key Improvements
This implementation provides several key advantages:
- Cross-Editor Compatibility: Works with both Cursor (native MCP) and VS Code (possibly issues due to non-native MCP support)
- No Local Setup: Users don't need to install dependencies manually. Dependencies declared in
pyproject.tomland installed automatically - Version Control: Server code is version controlled and can be updated via git
- Consistent Environment and Reliable Installation: Dependencies are managed consistently with uv
- Better Performance: Smart caching reduces repeated git operations, uv provides faster installs
- Easy Distribution: Can be shared via GitHub URL