Home / MCP / Repomix MCP Server

Repomix MCP Server

Provides on-demand codebase packaging for AI tools via an MCP endpoint, enabling secure, structured analysis of local and remote repositories.

typescript
21.3kstars
Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
    "mcpServers": {
        "repomix_mcp": {
            "command": "repomix",
            "args": [
                "--mcp"
            ]
        }
    }
}

The MCP Server lets you run Repomix as a dedicated service that AI agents can talk to directly. It packages codebases on demand so assistants can analyze, search, and reason about your repository without requiring you to manually prepare files.

How to use

You run Repomix as an MCP server and connect your AI tool to its endpoints. The server exposes tooling to pack local or remote repositories, attach existing packed outputs, search within packed data, and read files securely. When you start the MCP server, you can request AI assistants to pack a project and then query or analyze the resulting packed output with builtโ€‘in helpers.

How to install

Prerequisites: ensure Node.js and npm are installed on your system. You may also run the MCP server via Docker if you prefer containerized deployment.

# Install Node.js and npm if needed (follow your platform)
# Example: verify installation
node -v
npm -v

# Install the MCP server package locally (example name shown in commands from the docs)
npm install -D repomix

# Or install globally for easy access
npm install -g repomix

# Start the MCP server (the command in the docs is an MCP start for Repomix)
repomix --mcp

MCP server configuration

Configure how your AI tools connect to Repomix as an MCP server. The server can be run as a local stdio process or via a Docker container. The following stdio configuration starts Repomix as an MCP server using a direct CLI invocation.

{
  "mcpServers": {
    "repomix_mcp": {
      "type": "stdio",
      "name": "repomix",
      "command": "repomix",
      "args": ["--mcp"]
    }
  }
}

Examples of MCP workflows

With Repomix running as an MCP server, your AI assistant can pack a repository and then analyze the packed output using the server's tools. You can request packing of a local directory or a remote repository, attach prepacked outputs, or read specific portions of a packed file.

Troubleshooting and notes

If you encounter connection issues, verify that the MCP server process is running and reachable by your AI tool. Check that the start command used for the MCP server matches the configuration above and that any required environment variables are provided by your integration layer.

Security considerations

Treat packed outputs as sensitive data. Use the server's security features to scan for secrets and restrict access to packed data to trusted AI tools and users.

Available tools

pack_codebase

Package a local code directory into a consolidated XML document for AI analysis. Supports options like compress, include/exclude patterns, and git-context features.

attach_packed_output

Attach an existing repomix-packed XML file for AI analysis without re-packing.

pack_remote_repository

Fetch, clone, and package a remote GitHub repository into a single consolidated XML file for AI analysis.

read_repomix_output

Read the contents of a packed output file, with optional partial reading by line ranges.

grep_repomix_output

Search within a packed output using regex patterns, with configurable context lines.

file_system_read_file

Read a file from the local file system with security validation to prevent access to sensitive data.

file_system_read_directory

List directory contents with clear indicators and safe traversal.