Code Index MCP is a specialized MCP server that provides intelligent code indexing and analysis capabilities. It enables Large Language Models to interact with your code repositories, offering real-time insights and navigation through complex codebases.
This server integrates with the Model Context Protocol (MCP), a standardized way for AI models to interact with external tools and data sources.
- Project Indexing: Recursively scans directories to build a searchable index of code files
- Code Search: Find patterns, function definitions, and references across your codebase
- File Analysis: Get detailed insights about file structure, imports, and complexity
- Smart Filtering: Automatically ignores build directories, dependencies, and non-code files
- Persistent Storage: Caches indexes for improved performance across sessions
The server supports multiple programming languages and file extensions including:
- Python (.py)
- JavaScript/TypeScript (.js, .ts, .jsx, .tsx)
- Java (.java)
- C/C++ (.c, .cpp, .h, .hpp)
- C# (.cs)
- Go (.go)
- Ruby (.rb)
- PHP (.php)
- Swift (.swift)
- Kotlin (.kt)
- Rust (.rs)
- Scala (.scala)
- Shell scripts (.sh, .bash)
- Web files (.html, .css, .scss)
- Documentation/Config (.md, .json, .xml, .yml, .yaml)
- Python 3.8 or higher
- uv package manager (recommended)
The easiest way to install and use code-index-mcp is with uvx:
uvx code-index-mcp
Alternatively, you can install via pip:
pip install code-index-mcp
After installation, you can run it as a module:
python -m code_index_mcp
Add this to your Claude settings (~/Library/Application Support/Claude/claude_desktop_config.json
):
{
"mcpServers": {
"code-index": {
"command": "uvx",
"args": [
"code-index-mcp"
]
}
}
}
After adding the configuration, restart Claude Desktop and the Code Index MCP tools will be available.
- set_project_path: Sets the base project path for indexing.
- search_code: Searches for code matches within the indexed files.
- find_files: Finds files in the project matching a given pattern.
- get_file_summary: Gets a summary of a specific file, including line count, functions, imports, etc.
- refresh_index: Refreshes the project index.
- get_settings_info: Gets information about the project settings.
- create_temp_directory: Creates the temporary directory used for storing index data.
- check_temp_directory: Checks the temporary directory used for storing index data.
- clear_settings: Clears all settings and cached data.
Here are some examples of how to use Code Index MCP with Claude:
Please set the project path to C:\Users\username\projects\my-python-project
Search the code for all occurrences of "def process_data" in Python files
Give me a summary of the main.py file in the project
Find all JavaScript files in the project
- Clone the repository:
git clone https://github.com/username/code-index-mcp.git
cd code-index-mcp
- Install dependencies:
uv sync
- Run the server locally:
uv run code_index_mcp
You can use the MCP inspector to debug the server:
npx @modelcontextprotocol/inspector uvx code-index-mcp
Contributions are welcome! Please feel free to submit a Pull Request.