johnhuang316
MCP Serverjohnhuang316public

code index mcp

A Model Context Protocol (MCP) server that helps large language models index, search, and analyze code repositories with minimal setup

Repository Info

274
Stars
30
Forks
274
Watchers
9
Issues
Python
Language
MIT License
License

About This Server

A Model Context Protocol (MCP) server that helps large language models index, search, and analyze code repositories with minimal setup

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

Code Index MCP

MCP Server Python License

Intelligent code indexing and analysis for Large Language Models

Transform how AI understands your codebase with advanced search, analysis, and navigation capabilities.

code-index-mcp MCP server

Overview

Code Index MCP is a Model Context Protocol server that bridges the gap between AI models and complex codebases. It provides intelligent indexing, advanced search capabilities, and detailed code analysis to help AI assistants understand and navigate your projects effectively.

Perfect for: Code review, refactoring, documentation generation, debugging assistance, and architectural analysis.

Key Features

🔍 Intelligent Search & Analysis

  • Advanced Search: Auto-detects and uses the best available tool (ugrep, ripgrep, ag, or grep)
  • Regex Support: Full regex pattern matching with ReDoS attack prevention
  • Fuzzy Search: True fuzzy matching with edit distance (ugrep) or word boundary patterns
  • File Analysis: Deep insights into structure, imports, classes, methods, and complexity metrics

🗂️ Multi-Language Support

  • Mainstream Languages: Java, Python, JavaScript/TypeScript, C/C++, Go, Rust, C#
  • Mobile Development: Swift, Kotlin, Objective-C/C++, React Native
  • Web Frontend: Vue, React, Svelte, Astro, HTML, CSS, SCSS
  • Database: SQL (MySQL, PostgreSQL, SQLite), NoSQL, stored procedures, migrations
  • Scripting: Ruby, PHP, Shell, PowerShell, Bash
  • Systems: C/C++, Rust, Go, Zig
  • JVM Ecosystem: Java, Kotlin, Scala, Groovy
  • Others: Lua, Perl, R, MATLAB, configuration files
  • 50+ File Types Total - View complete list

Real-time Monitoring & Auto-refresh

  • File Watcher: Automatic index updates when files change
  • Cross-platform: Native OS file system monitoring (inotify, FSEvents, ReadDirectoryChangesW)
  • Smart Debouncing: Batches rapid changes to prevent excessive rebuilds (default: 6 seconds)
  • Thread-safe: Non-blocking background operations with ThreadPoolExecutor

Performance & Efficiency

  • Smart Indexing: Recursively scans with intelligent filtering of build directories
  • Persistent Caching: Stores indexes for lightning-fast subsequent access
  • Lazy Loading: Tools detected only when needed for optimal startup
  • Memory Efficient: Intelligent caching strategies for large codebases

Supported File Types

📁 Programming Languages (Click to expand)

System & Low-Level:

  • C/C++ (.c, .cpp, .h, .hpp)
  • Rust (.rs)
  • Zig (.zig)
  • Go (.go)

Object-Oriented:

  • Java (.java)
  • C# (.cs)
  • Kotlin (.kt)
  • Scala (.scala)
  • Objective-C/C++ (.m, .mm)
  • Swift (.swift)

Scripting & Dynamic:

  • Python (.py)
  • JavaScript/TypeScript (.js, .ts, .jsx, .tsx, .mjs, .cjs)
  • Ruby (.rb)
  • PHP (.php)
  • Shell (.sh, .bash)
🌐 Web & Frontend (Click to expand)

Frameworks & Libraries:

  • Vue (.vue)
  • Svelte (.svelte)
  • Astro (.astro)

Styling:

  • CSS (.css, .scss, .less, .sass, .stylus, .styl)
  • HTML (.html)

Templates:

  • Handlebars (.hbs, .handlebars)
  • EJS (.ejs)
  • Pug (.pug)
🗄️ Database & SQL (Click to expand)

SQL Variants:

  • Standard SQL (.sql, .ddl, .dml)
  • Database-specific (.mysql, .postgresql, .psql, .sqlite, .mssql, .oracle, .ora, .db2)

Database Objects:

  • Procedures & Functions (.proc, .procedure, .func, .function)
  • Views & Triggers (.view, .trigger, .index)

Migration & Tools:

  • Migration files (.migration, .seed, .fixture, .schema)
  • Tool-specific (.liquibase, .flyway)

NoSQL & Modern:

  • Graph & Query (.cql, .cypher, .sparql, .gql)
📄 Documentation & Config (Click to expand)
  • Markdown (.md, .mdx)
  • Configuration (.json, .xml, .yml, .yaml)

Quick Start

The easiest way to get started with any MCP-compatible application:

Prerequisites: Python 3.10+ and uv

  1. Add to your MCP configuration (e.g., claude_desktop_config.json or ~/.claude.json):

    {
      "mcpServers": {
        "code-index": {
          "command": "uvx",
          "args": ["code-index-mcp"]
        }
      }
    }
    
  2. Restart your applicationuvx automatically handles installation and execution

🛠️ Development Setup

For contributing or local development:

  1. Clone and install:

    git clone https://github.com/johnhuang316/code-index-mcp.git
    cd code-index-mcp
    uv sync
    
  2. Configure for local development:

    {
      "mcpServers": {
        "code-index": {
          "command": "uv",
          "args": ["run", "code-index-mcp"]
        }
      }
    }
    
  3. Debug with MCP Inspector:

    npx @modelcontextprotocol/inspector uv run code-index-mcp
    
Alternative: Manual pip Installation

If you prefer traditional pip management:

pip install code-index-mcp

Then configure:

{
  "mcpServers": {
    "code-index": {
      "command": "code-index-mcp",
      "args": []
    }
  }
}

Available Tools

🏗️ Project Management

ToolDescription
set_project_pathInitialize indexing for a project directory
refresh_indexRebuild the project index after file changes
get_settings_infoView current project configuration and status

🔍 Search & Discovery

ToolDescription
search_code_advancedSmart search with regex, fuzzy matching, and file filtering
find_filesLocate files using glob patterns (e.g., **/*.py)
get_file_summaryAnalyze file structure, functions, imports, and complexity

🔄 Monitoring & Auto-refresh

ToolDescription
get_file_watcher_statusCheck file watcher status and configuration
configure_file_watcherEnable/disable auto-refresh and configure settings

🛠️ System & Maintenance

ToolDescription
create_temp_directorySet up storage directory for index data
check_temp_directoryVerify index storage location and permissions
clear_settingsReset all cached data and configurations
refresh_search_toolsRe-detect available search tools (ugrep, ripgrep, etc.)

Usage Examples

🎯 Quick Start Workflow

1. Initialize Your Project

Set the project path to /Users/dev/my-react-app

Automatically indexes your codebase and creates searchable cache

2. Explore Project Structure

Find all TypeScript component files in src/components

Uses: find_files with pattern src/components/**/*.tsx

3. Analyze Key Files

Give me a summary of src/api/userService.ts

Uses: get_file_summary to show functions, imports, and complexity

🔍 Advanced Search Examples

Code Pattern Search
Search for all function calls matching "get.*Data" using regex

Finds: getData(), getUserData(), getFormData(), etc.

Fuzzy Function Search
Find authentication-related functions with fuzzy search for 'authUser'

Matches: authenticateUser, authUserToken, userAuthCheck, etc.

Language-Specific Search
Search for "API_ENDPOINT" only in Python files

Uses: search_code_advanced with file_pattern: "*.py"

Auto-refresh Configuration
Configure automatic index updates when files change

Uses: configure_file_watcher to enable/disable monitoring and set debounce timing

Project Maintenance
I added new components, please refresh the project index

Uses: refresh_index to update the searchable cache

Troubleshooting

🔄 Auto-refresh Not Working

If automatic index updates aren't working when files change, try:

  • pip install watchdog (may resolve environment isolation issues)
  • Use manual refresh: Call the refresh_index tool after making file changes
  • Check file watcher status: Use get_file_watcher_status to verify monitoring is active

Development & Contributing

🔧 Building from Source

git clone https://github.com/johnhuang316/code-index-mcp.git
cd code-index-mcp
uv sync
uv run code-index-mcp

🐛 Debugging

npx @modelcontextprotocol/inspector uvx code-index-mcp

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


📜 License

MIT License

🌐 Translations

  • 繁體中文
  • 日本語

Quick Start

1

Clone the repository

git clone https://github.com/johnhuang316/code-index-mcp
2

Install dependencies

cd code-index-mcp
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownerjohnhuang316
Repocode-index-mcp
LanguagePython
LicenseMIT License
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation