Repository to LLM Context

by crisschan

3 stars
324 downloads
Not rated
GitHub

About

Transform code repositories into LLM-friendly formats.

Details

Author
crisschan
Repository
crisschan/mcp-repo2llm
GitHub stars
3
Downloads
324
License
Apache License 2.0
Categories
Developer Tools, AI, Infrastructure, Other

- 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

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Repository to LLM Context
    Command (node, npx, python, etc.) uv
    Arguments
    • Argument 1 run
    • Argument 2 --with
    • Argument 3 mcp[cli]
    • Argument 4 --with-editable
    • Argument 5 /mcp-repo2llm
    • Argument 6 mcp
    • Argument 7 run
    • Argument 8 /mcp-repo2llm/mcp-repo2llm-server.py
    Environment
    • GITHUB_TOKEN your-github-token
    • GITLAB_TOKEN your-gitlab-token

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

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

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: The project all information and structure 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: The project all information and structure from the repository as text.

get_local_repo

Process and return the code from a local repository branch as text. Input: repo_url (string): the repository path. Returns: The project all information and structure from the repository as text.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "repository to llm context": {
            "env": {
                "GITHUB_TOKEN": "your-github-token",
                "GITLAB_TOKEN": "your-gitlab-token"
            },
            "args": [
                "run",
                "--with",
                "mcp[cli]",
                "--with-editable",
                "/mcp-repo2llm",
                "mcp",
                "run",
                "/mcp-repo2llm/mcp-repo2llm-server.py"
            ],
            "command": "uv"
        }
    }
}

Linux

{
    "env": {
        "GITHUB_TOKEN": "your-github-token",
        "GITLAB_TOKEN": "your-gitlab-token"
    },
    "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with-editable",
        "/mcp-repo2llm",
        "mcp",
        "run",
        "/mcp-repo2llm/mcp-repo2llm-server.py"
    ],
    "command": "uv"
}

Macos

{
    "env": {
        "GITHUB_TOKEN": "your-github-token",
        "GITLAB_TOKEN": "your-gitlab-token"
    },
    "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with-editable",
        "/mcp-repo2llm",
        "mcp",
        "run",
        "/mcp-repo2llm/mcp-repo2llm-server.py"
    ],
    "command": "uv"
}

Windows

{
    "env": {
        "GITHUB_TOKEN": "your-github-token",
        "GITLAB_TOKEN": "your-gitlab-token"
    },
    "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with-editable",
        "/mcp-repo2llm",
        "mcp",
        "run",
        "/mcp-repo2llm/mcp-repo2llm-server.py"
    ],
    "command": "uv"
}

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.

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

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.