Code Indexer MCP server

Indexes and analyzes code repositories to enable file navigation, pattern searching, and complexity assessment across multiple programming languages through persistent project settings and efficient dependency management.
Back to servers
Setup instructions
Provider
John Huang
Release date
Mar 18, 2025
Language
Python
Stats
62 stars

Code Index MCP is a Model Context Protocol server that allows large language models (LLMs) to interact with your code, enabling features like code indexing, searching, and analysis. This tool helps LLMs understand and work with your project's code structure more effectively.

Installation

Prerequisites

  • Python 3.10 or later
  • UV package manager (recommended)

Install UV

# Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

Get the Code

# Clone the repository
git clone https://github.com/your-username/code-index-mcp.git

Usage

Running the Server

Simply run the server using UV:

# UV will automatically handle all dependency installations
uv run run.py

Integrating with Claude Desktop

  1. Ensure you have UV installed (see installation section above)

  2. Find or create the Claude Desktop configuration file:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json
  3. Add the following configuration (replace with your actual path):

For Windows:

{
  "mcpServers": {
    "code-indexer": {
      "command": "uv",
      "args": [
         "--directory",
         "C:\\Users\\username\\path\\to\\code-index-mcp",
         "run",
         "run.py"
       ]
    }
  }
}

For macOS/Linux:

{
  "mcpServers": {
    "code-indexer": {
      "command": "uv",
      "args": [
         "--directory",
         "/home/username/path/to/code-index-mcp",
         "run",
         "run.py"
       ]
    }
  }
}
  1. Restart Claude Desktop to use Code Indexer

Working with Code Index MCP

Basic Workflow

  1. Set Project Path (required first step):

    • When using for the first time, tell Claude: "I need to analyze a project, help me set up the project path"
    • Provide the complete project directory path
  2. Code Search:

    • Search for keywords: "Search for 'function name' in the project"
    • Filter by file type: "Search for 'import' in all .py files"
  3. File Analysis:

    • Analyze specific files: "Analyze the file src/main.py"
    • Get file summaries: "Give me a list of functions in utils/helpers.js"
  4. Project Navigation:

    • View project structure: "Show me the structure of this project"
    • Find files by pattern: "Find all test_*.py files"

Supported File Types

The tool supports indexing and analysis of many common file types, including:

  • Python (.py)
  • JavaScript/TypeScript (.js, .ts, .jsx, .tsx)
  • Java (.java)
  • C/C++ (.c, .cpp, .h, .hpp)
  • Many other languages and file formats (C#, Go, Ruby, PHP, Swift, etc.)
  • Markup and data formats (HTML, CSS, Markdown, JSON, XML, YAML)

Persistent Storage

All index and settings data are stored in the .code_indexer folder within your project directory, including:

  • config.json: Project configuration information
  • file_index.pickle: File index data
  • content_cache.pickle: File content cache

This ensures your project doesn't need to be re-indexed each time you use the tool.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "code-indexer" '{"command":"uv","args":["run","run.py"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "code-indexer": {
            "command": "uv",
            "args": [
                "run",
                "run.py"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "code-indexer": {
            "command": "uv",
            "args": [
                "run",
                "run.py"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later