This guide is specifically designed for AI agents like Cline to install and configure the Repomix MCP server for use with LLM applications like Claude Desktop, Cursor, Roo Code, and Cline.
An MCP server that generates contextual prompts from codebases, making it easier for AI assistants to understand and work with your code repositories.
code2prompt-mcp leverages the high-performance code2prompt-rs Rust library to analyze codebases and produce structured summaries. It helps bridge the gap between your code and language models by extracting relevant context in a format that's optimized for AI consumption.
Before installation, you need:
- Install rye for dependency management.
curl -sSf https://rye.astral.sh/get | bash
on linux or macOS. Make sure to select to add rye to your PATH when prompted.
Clone the repository and install dependencies:
git clone https://github.com/odancona/code2prompt-mcp.git
cd code2prompt-mcp
Install all the required dependencies specified in the pyproject.toml
file in the .venv
directory with :
rye build
This will create a virtual environment and install all necessary packages.
Then, configure the MCP server configuration file. To run the environnment, you have several options. The first one would be to activate the virtual environment and run the server:
cd <installation_directory>
source .venv/bin/activate
python code2prompt_mcp.main
Alternatively, you can run the server directly using rye:
rye run python code2prompt_mcp.main
It's important to run this command in the cloned directory to use pyproject.toml
and the virtual environment created by rye.
If you want to be able to run the MCP server from anywhere, you can create a configuration file for your LLM application. Here's an example configuration:
{
"mcpServers": {
"code2prompt": {
"command": "bash",
"args": [
"-c",
"cd /path/to/code2prompt-mcp && rye run python /path/to/code2prompt-mcp/src/code2prompt_mcp/main.py"
],
"env": {}
}
}
}
To verify the installation is working:
- Restart your LLM application (Cline, Claude Desktop, etc.)
- Test the connection by running a simple command like:
Please get context from /path/to/project for AI analysis using Code2Prompt.
Here are some examples of how to use Code2Prompt MCP server with AI assistants:
Can you analyze the code in my project at /path/to/project? Please use Code2prompt MCP to get the context.
Please get all python files and remove markdown files and the folder tests, use Code2prompt MCP for context.