Code Index MCP

Code Index MCP

Intelligent code indexing and analysis for Large Language Models, enabling advanced search, file analysis, and real-time monitoring of codebases.

Category
访问服务器

README

Code Index MCP

<div align="center">

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.

</div>

<a href="https://glama.ai/mcp/servers/@johnhuang316/code-index-mcp"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@johnhuang316/code-index-mcp/badge" alt="code-index-mcp MCP server" /> </a>

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

<details> <summary><strong>📁 Programming Languages (Click to expand)</strong></summary>

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)

</details>

<details> <summary><strong>🌐 Web & Frontend (Click to expand)</strong></summary>

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)

</details>

<details> <summary><strong>🗄️ Database & SQL (Click to expand)</strong></summary>

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)

</details>

<details> <summary><strong>📄 Documentation & Config (Click to expand)</strong></summary>

  • Markdown (.md, .mdx)
  • Configuration (.json, .xml, .yml, .yaml)

</details>

Quick Start

🚀 Recommended Setup (Most Users)

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
    

<details> <summary><strong>Alternative: Manual pip Installation</strong></summary>

If you prefer traditional pip management:

pip install code-index-mcp

Then configure:

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

</details>

Available Tools

🏗️ Project Management

Tool Description
set_project_path Initialize indexing for a project directory
refresh_index Rebuild the project index after file changes
get_settings_info View current project configuration and status

🔍 Search & Discovery

Tool Description
search_code_advanced Smart search with regex, fuzzy matching, and file filtering
find_files Locate files using glob patterns (e.g., **/*.py)
get_file_summary Analyze file structure, functions, imports, and complexity

🔄 Monitoring & Auto-refresh

Tool Description
get_file_watcher_status Check file watcher status and configuration
configure_file_watcher Enable/disable auto-refresh and configure settings

🛠️ System & Maintenance

Tool Description
create_temp_directory Set up storage directory for index data
check_temp_directory Verify index storage location and permissions
clear_settings Reset all cached data and configurations
refresh_search_tools Re-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

<details> <summary><strong>Code Pattern Search</strong></summary>

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

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

</details>

<details> <summary><strong>Fuzzy Function Search</strong></summary>

Find authentication-related functions with fuzzy search for 'authUser'

Matches: authenticateUser, authUserToken, userAuthCheck, etc.

</details>

<details> <summary><strong>Language-Specific Search</strong></summary>

Search for "API_ENDPOINT" only in Python files

Uses: search_code_advanced with file_pattern: "*.py"

</details>

<details> <summary><strong>Auto-refresh Configuration</strong></summary>

Configure automatic index updates when files change

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

</details>

<details> <summary><strong>Project Maintenance</strong></summary>

I added new components, please refresh the project index

Uses: refresh_index to update the searchable cache

</details>

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选