home / mcp / mcp code indexer

MCP Code Indexer

Provides semantic code search, analysis, and project context for AI language models.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "zxfgds-mcp-code-indexer": {
      "command": "python",
      "args": [
        "-m",
        "server.app"
      ]
    }
  }
}

MCP Code Indexer is an intelligent code-search and analysis tool designed to empower AI language models with fast, semantic code retrieval and insightful project analysis. It helps you understand large codebases, extract meaningful context, and perform targeted searches across languages to improve code comprehension, navigation, and quality.

How to use

To work with the MCP Code Indexer, run the provided MCP server and connect your client to the local or remote endpoint. Use the available tools to identify your project, index code, and perform targeted searches. You can then analyze code structure, measure quality, extract documentation, and explore dependencies to gain deep insights into your codebase.

How to install

Prerequisites: make sure Python is installed on your system.

# Install dependencies
pip install -r requirements.txt

# Install the MCP Code Indexer package locally
python setup.py install

Configuration

Configure the MCP server connection in your client settings. The standard stdio-based local server uses Python to run the application module.

{
  "mcpServers": {
    "code_indexer": {
      "command": "python",
      "args": ["-m", "server.app"],
      "cwd": "安装目录路径",
      "env": {},
      "disabled": false,
      "alwaysAllow": []
    }
  }
}

Claude Desktop configuration

Set up the Claude Desktop configuration to connect to the MCP Code Indexer server.

{
  "mcpServers": {
    "code-indexer": {
      "command": "python",
      "args": ["-m", "server.app"],
      "cwd": "安装目录路径",
      "env": {},
      "disabled": false,
      "alwaysAllow": []
    }
  }
}

VSCode extension configuration

Configure the VSCode extension to connect to the MCP Code Indexer server.

{
  "mcpServers": {
    "code-indexer": {
      "command": "python",
      "args": ["-m", "server.app"],
      "cwd": "安装目录路径",
      "env": {},
      "disabled": false,
      "alwaysAllow": []
    }
  }
}

Usage patterns

Common workflows include identifying a project, indexing its code, and then searching for relevant snippets. After indexing, you can inspect code structure, evaluate quality, extract documentation, locate similar code, gather metrics, and analyze dependencies to improve understanding and maintainability.

Project tools and capabilities

The MCP Code Indexer exposes a set of tools to streamline your work with code. Use these core actions to interact with your project:

identify_project
index_project
search_code
get_code_structure
analyze_code_quality
extract_documentation
find_similar_code
get_code_metrics
analyze_dependencies

Notes on security and environment

Keep your environment secure by running the MCP server in trusted networks and restricting access to authorized clients. Use appropriate environment variables for sensitive configurations if provided by your setup.

Available tools

identify_project

Identify the target project to be indexed to determine its scope and structure.

index_project

Index the project's codebase to build a semantic, queryable representation.

search_code

Search for relevant code snippets across indexed projects using semantic understanding.

get_code_structure

Analyze and retrieve the code structure, including classes, functions, and dependencies.

analyze_code_quality

Assess code quality metrics and identify improvement opportunities.

extract_documentation

Extract documentation and comments to support documentation generation.

find_similar_code

Detect and surface similar or duplicate code across the index.

get_code_metrics

Provide code metrics and statistics for analysis and reporting.

analyze_dependencies

Analyze project dependencies and their relationships.