Code Index MCP
Supports indexing and analysis of Astro projects, including component structure and syntax-aware search.
Supports indexing and analysis of C/C++ code, including classes, functions, includes, and preprocessor directives.
Supports indexing and analysis of CSS files, including selectors, classes, and styling structure.
Supports indexing and analysis of EJS templates, including embedded JavaScript and includes.
Supports indexing and analysis of Flyway migration files, including SQL and Java-based migrations.
Supports indexing and analysis of JavaScript code, including ES modules, classes, and functions.
Supports indexing and analysis of Kotlin code, including classes, functions, and extensions.
Supports indexing and analysis of Less stylesheets, including variables, mixins, and imports.
Supports indexing and analysis of Liquibase migration files, including change sets and preconditions.
Supports indexing and analysis of Lua code, including tables, functions, and modules.
Supports indexing and analysis of Markdown documentation, including headings, code blocks, and links.
Supports indexing and analysis of MDX files, combining Markdown with JSX components.
Supports indexing and analysis of MySQL SQL files, including queries, stored procedures, and migrations.
Supports indexing and analysis of Perl code, including packages, subroutines, and regex patterns.
Supports indexing and analysis of PHP code, including classes, functions, and namespaces.
Supports indexing and analysis of PostgreSQL SQL files, including queries, functions, and migrations.
Supports indexing and analysis of Pug templates, including mixins, includes, and interpolation.
Supports indexing and analysis of Python code, including imports, classes, functions, and complexity metrics.
Supports indexing and analysis of React projects, including JSX/TSX components, hooks, and imports.
Supports indexing and analysis of Ruby code, including modules, classes, methods, and gems.
Supports indexing and analysis of Rust code, including modules, structs, and functions.
Supports indexing and analysis of Sass/SCSS stylesheets, including variables, mixins, and inheritance.
Supports indexing and analysis of Scala code, including objects, classes, and traits.
Supports indexing and analysis of shell scripts (Bash, Zsh), including functions and command structure.
Supports indexing and analysis of SQLite SQL files, including queries, clauses, and database objects.
Supports indexing and analysis of Stylus stylesheets, including functions and imports.
Supports indexing and analysis of Svelte projects, including component structure and syntax-aware search.
Supports indexing and analysis of Swift code, including structs, classes, functions, and protocols.
Supports indexing and analysis of TypeScript code, including types, interfaces, and generics.
Supports indexing and analysis of XML files, including elements, attributes, and schemas.
Supports indexing and analysis of YAML configuration and data files.
Supports indexing and analysis of Zig code, including structs, enums, and functions.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Code Index MCP find all classes that implement the Observer pattern"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Code Index MCP
Intelligent code indexing and analysis for Large Language Models
Transform how AI understands your codebase with advanced search, analysis, and navigation capabilities.
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.
Related MCP server: Portable MCP Toolkit
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
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)
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)
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)
Markdown (
.md,.mdx)Configuration (
.json,.xml,.yml,.yaml)
Quick Start
🚀 Recommended Setup (Most Users)
The easiest way to get started with any MCP-compatible application:
Prerequisites: Python 3.10+ and uv
Add to your MCP configuration (e.g.,
claude_desktop_config.jsonor~/.claude.json):{ "mcpServers": { "code-index": { "command": "uvx", "args": ["code-index-mcp"] } } }Restart your application –
uvxautomatically handles installation and execution
🛠️ Development Setup
For contributing or local development:
Clone and install:
git clone https://github.com/johnhuang316/code-index-mcp.git cd code-index-mcp uv syncConfigure for local development:
{ "mcpServers": { "code-index": { "command": "uv", "args": ["run", "code-index-mcp"] } } }Debug with MCP Inspector:
npx @modelcontextprotocol/inspector uv run code-index-mcp
If you prefer traditional pip management:
pip install code-index-mcpThen configure:
{
"mcpServers": {
"code-index": {
"command": "code-index-mcp",
"args": []
}
}
}Available Tools
🏗️ Project Management
Tool | Description |
| Initialize indexing for a project directory |
| Rebuild the project index after file changes |
| View current project configuration and status |
🔍 Search & Discovery
Tool | Description |
| Smart search with regex, fuzzy matching, and file filtering |
| Locate files using glob patterns (e.g., |
| Analyze file structure, functions, imports, and complexity |
🔄 Monitoring & Auto-refresh
Tool | Description |
| Check file watcher status and configuration |
| Enable/disable auto-refresh and configure settings |
🛠️ System & Maintenance
Tool | Description |
| Set up storage directory for index data |
| Verify index storage location and permissions |
| Reset all cached data and configurations |
| 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-appAutomatically indexes your codebase and creates searchable cache
2. Explore Project Structure
Find all TypeScript component files in src/componentsUses: find_files with pattern src/components/**/*.tsx
3. Analyze Key Files
Give me a summary of src/api/userService.tsUses: get_file_summary to show functions, imports, and complexity
🔍 Advanced Search Examples
Search for all function calls matching "get.*Data" using regexFinds: getData(), getUserData(), getFormData(), etc.
Find authentication-related functions with fuzzy search for 'authUser'Matches: authenticateUser, authUserToken, userAuthCheck, etc.
Search for "API_ENDPOINT" only in Python filesUses: search_code_advanced with file_pattern: "*.py"
Configure automatic index updates when files changeUses: configure_file_watcher to enable/disable monitoring and set debounce timing
I added new components, please refresh the project indexUses: 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_indextool after making file changesCheck file watcher status: Use
get_file_watcher_statusto 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
🌐 Translations
Available Tools
12 toolscheck_temp_directoryA
Check the temporary directory used for storing index data.
Inputs: no named parameters.
clear_settingsB
Clear all settings and cached data.
Inputs: no named parameters.
configure_file_watcherC
Configure file watcher service settings.
Inputs: enabled, debounce_seconds, additional_exclude_patterns.
create_temp_directoryA
Create the temporary directory used for storing index data.
Inputs: no named parameters.
find_filesA
Find files matching a glob pattern using efficient directory tree traversal.
Use when:
- Looking for files by pattern (e.g., "*.py", "test_*.js", "src/**/*.ts")
- Searching by filename only (e.g., "README.md" finds all README files)
- Checking if specific files exist in the project
- Getting file lists for further analysis
Pattern matching:
- Supports both full path and filename-only matching
- Uses forward slashes consistently across all platforms
- Efficient directory tree traversal for better performance
Args:
pattern: Glob pattern to match files (e.g., "*.py", "test_*.js", "README.md")
Returns:
Dictionary with files list and status information
Inputs: pattern (required).
get_file_summaryA
Get a summary of a specific file, including:
- Line count
- Function/class definitions (for supported languages)
- Import statements
- Basic complexity metrics
Inputs: file_path (required).
get_file_watcher_statusA
Get file watcher service status and statistics.
Inputs: no named parameters.
get_settings_infoB
Get information about the project settings.
Inputs: no named parameters.
refresh_indexA
Manually refresh the project index when files have been added/removed/moved.
Use when:
- File watcher is disabled or unavailable
- After large-scale operations (git checkout, merge, pull) that change many files
- When you want immediate index rebuild without waiting for file watcher debounce
- When find_files results seem incomplete or outdated
- For troubleshooting suspected index synchronization issues
Important notes for LLMs:
- Always available as backup when file watcher is not working
- Performs full project re-indexing for complete accuracy
- Use when you suspect the index is stale after file system changes
- **Call this after programmatic file modifications if file watcher seems unresponsive**
- Complements the automatic file watcher system
Returns:
Success message with total file count
Inputs: no named parameters.
refresh_search_toolsA
Manually re-detect the available command-line search tools on the system. This is useful if you have installed a new tool (like ripgrep) after starting the server.
Inputs: no named parameters.
search_code_advancedA
Search for a code pattern in the project using an advanced, fast tool.
This tool automatically selects the best available command-line search tool
(like ugrep, ripgrep, ag, or grep) for maximum performance.
Args:
pattern: The search pattern. Can be literal text or regex (see regex parameter).
case_sensitive: Whether the search should be case-sensitive.
context_lines: Number of lines to show before and after the match.
file_pattern: A glob pattern to filter files to search in
(e.g., "*.py", "*.js", "test_*.py").
All search tools now handle glob patterns consistently:
- ugrep: Uses glob patterns (*.py, *.{js,ts})
- ripgrep: Uses glob patterns (*.py, *.{js,ts})
- ag (Silver Searcher): Automatically converts globs to regex patterns
- grep: Basic glob pattern matching
All common glob patterns like "*.py", "test_*.js", "src/*.ts" are supported.
fuzzy: If True, enables fuzzy/partial matching behavior varies by search tool:
- ugrep: Native fuzzy search with --fuzzy flag (true edit-distance fuzzy search)
- ripgrep, ag, grep, basic: Word boundary pattern matching (not true fuzzy search)
IMPORTANT: Only ugrep provides true fuzzy search. Other tools use word boundary
matching which allows partial matches at word boundaries.
For exact literal matches, set fuzzy=False (default and recommended).
regex: Controls regex pattern matching behavior:
- If True, enables regex pattern matching
- If False, forces literal string search
- If None (default), automatically detects regex patterns and enables regex for patterns like "ERROR|WARN"
The pattern will always be validated for safety to prevent ReDoS attacks.
Returns:
A dictionary containing the search results or an error message.Inputs: pattern (required), case_sensitive, context_lines, file_pattern, +2 more.
set_project_pathC
Set the base project path for indexing.
Inputs: path (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool has a clearly distinct purpose: checking vs creating temp directory, configuring vs getting watcher status, clearing vs getting settings, finding files vs searching code vs getting file summary, refreshing index vs refreshing search tools. No overlap or ambiguity.
All tool names follow a consistent verb_noun pattern with lowercase and underscores, e.g., check_temp_directory, get_file_summary, set_project_path. The verbs are diverse but each clearly indicates the action.
With 12 tools covering directory management, settings, file watching, file finding, code search, and index refresh, the count is well-scoped for the server's purpose. No tool feels redundant or missing.
The tool set covers key operations: setting project path, finding files, searching code, getting file summaries, refreshing index, and managing settings/watcher. Minor gaps exist, such as no explicit tool to list indexed files or get index status, but the core workflows are supported.
Related MCP Connectors
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides code repository indexing and semantic search capabilities, allowing natural language queries to find relevant code snippets with automatic incremental indexing and multi-language support.1361ISC
- AlicenseNot gradedqualityFmaintenanceProvides AI-powered code intelligence for any codebase using local LLMs and vector search, enabling semantic code search, pattern analysis, and context-optimized code generation with 90% token savings.2MIT
- AlicenseNot gradedqualityBmaintenanceLocal-first code indexer that provides deep code understanding for Claude and other LLMs with symbol/text search across 48+ languages, semantic search capabilities, and real-time index updates through the Model Context Protocol.61MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to perform high-performance code search and analysis across multiple languages using symbol indexing, regex text search, and structural AST pattern matching. It also provides tools for technology stack detection and dependency analysis with persistent caching for optimized performance.12MIT