MCP-Repo2LLM
Extracts and transforms code from GitHub repositories into LLM-friendly formats, preserving structure and context while requiring a GitHub token for authentication.
Processes GitLab repositories and converts them into text formats optimized for LLMs, maintaining code structure and relationships while requiring a GitLab token.
Processes local code repositories and transforms them into LLM-friendly text formats, preserving project structure and contextual information.
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-Repo2LLM get the main branch from https://github.com/example/project for LLM analysis"
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-Repo2LLM
Overview
mcp-repo2llm is a MCP server that transforms code repositories into LLM-friendly formats. A powerful tool that transforms code repositories into LLM-friendly formats, bridging the gap between traditional code bases and modern AI language models. This repo is based on RepoToTextForLLMs, which provides core functionality for converting repositories into LLM-readable formats.
Related MCP server: SRC (Structured Repo Context)
Motivation
As AI and Large Language Models (LLMs) become increasingly important in software development, there's a growing need to effectively communicate our codebases to these models. Traditional code repositories aren't optimized for LLM processing, which can lead to suboptimal results when using AI tools for code analysis and generation.
Problem Solved
This project addresses several critical challenges:
Difficulty in processing large codebases with LLMs
Loss of context and structure when feeding code to AI models
Inefficient handling of repository metadata and documentation
Inconsistent formatting across different programming languages
Key Features
Smart Repository Scanning: Intelligently processes entire codebases while maintaining structural integrity
Context Preservation: Maintains important contextual information and relationships between code files
Multi-language Support: Handles various programming languages with language-specific optimizations
Metadata Enhancement: Enriches code with relevant metadata for better LLM understanding
Efficient Processing: Optimized for handling large repositories with minimal resource usage
Installation
To install mcp-repo2llm by uv:
"mcp-repo2llm-server": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"--with-editable",
"/mcp-repo2llm",
"mcp",
"run",
"/mcp-repo2llm/mcp-repo2llm-server.py"
],
"env":{
"GITHUB_TOKEN":"your-github-token",
"GITLAB_TOKEN":"your-gitlab-token"
}
}GITHUB_TOKEN: your github token GITLAB_TOKEN: your gitlab token
Tools
get_gitlab_repo
Process and return the code from a GitLab repository branch as text
Input:
repo_url (string): the repository URL from gitlab
branch (string): The branch name,default is master
Returns(string): The project all information and struction from the repository as text
get_github_repo
Process and return the code from a Github repository branch as text
Input:
repo_url (string): the repository URL from github
branch (string): The branch name,default is master
Returns(string): The project all information and struction from the repository as text
get_local_repo
Process and return the code from a GitLab repository branch as text
Input:
repo_url (string): the repository path
Returns(string): The project all information and struction from the repository as text
Available Tools
3 toolsget_github_repoC
Process and return the code from a GitHub repository branch as text
Inputs: repo_url (required), branch.
get_gitlab_repoC
Process and return the code from a GitLab repository branch as text
Inputs: repo_url (required), branch.
get_local_repoC
Process and return the code from a local repository as text
Inputs: repo_path (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct purpose targeting a different repository source: GitHub, GitLab, and local repositories. The descriptions explicitly differentiate them by source, leaving no ambiguity about which tool to use for each scenario.
All tools follow a consistent verb_noun pattern with 'get_' prefix and descriptive suffixes indicating the repository source. The naming is uniform and predictable across all three tools.
With only 3 tools, the server feels thin for its apparent scope of repository code retrieval. While it covers three repository sources, the functionality is limited to a single 'get' operation without supporting related actions like searching, filtering, or managing repositories.
The tool surface is severely incomplete for repository interaction. It only provides retrieval operations without any create, update, delete, search, or management capabilities. Even within retrieval, there are no options for filtering, pagination, or handling different file types beyond returning 'code as text'.
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
A MCP server built for developers enabling Git based project management with project and personal…
Repository knowledge graph MCP server for codebase understanding and debugging.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that scans codebases to extract structural information (classes, functions, etc.) with flexible filtering options and outputs in LLM-friendly formats.12GPL 3.0
- AlicenseAqualityBmaintenanceAn MCP server and CLI tool that transforms codebases into AI-ready context through semantic search, call graph analysis, and incremental indexing. It enables AI assistants to perform hybrid vector and keyword searches to understand complex repository structures and cross-file relationships.3528 npm3MIT
- AlicenseCqualityDmaintenanceAn MCP server that analyzes local or remote GitHub repositories, providing intelligent code context and structure to AI coding assistants.1013MIT
- AlicenseDqualityDmaintenanceA lightweight MCP server for bringing GitHub repositories into context for large language models, enabling repository analysis, file access, and search without local cloning.49 npm6Apache 2.0