by johnhuang316
Provides intelligent code indexing, search, and analysis for large language models to navigate codebases efficiently.
Code Index offers a Model Context Protocol (MCP) server that creates searchable, structured indexes of source code. It enables AI assistants to understand, query, and analyze large repositories without manual configuration.
~/.claude.json):{
"mcpServers": {
"code-index": {
"command": "uvx",
"args": ["code-index-mcp"]
}
}
}
set_project_path or by passing --project-path /absolute/path/to/repo on launch.search_code_advanced, find_files, get_file_summary, etc.) via normal MCP prompts.build_deep_index) for detailed class, method, import, and complexity analysis.Q: Do I need to install tree‑sitter manually? A: No. The package installs required language grammars automatically.
Q: How large a repository can be indexed? A: Designed for large codebases; indexing is incremental and uses caching to stay memory‑efficient.
Q: What if my project uses a language not in the 7 specialized ones? A: It falls back to generic file indexing, providing basic search and file discovery.
Q: How do I refresh the index after massive changes?
A: Run refresh_index for a shallow update or build_deep_index for a full rebuild.
Q: Can I limit which directories are indexed?
A: Yes, configure exclusions via the MCP settings or by adding .gitignore‑style patterns.
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 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.
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.json or ~/.claude.json):
{
"mcpServers": {
"code-index": {
"command": "uvx",
"args": ["code-index-mcp"]
}
}
}
Optional: append
--project-path /absolute/path/to/repoto theargsarray so the server initializes with that repository automatically (equivalent to callingset_project_pathafter startup).
Restart your application – uvx automatically handles installation and execution
Start using (give these prompts to your AI assistant):
Set the project path to /Users/dev/my-react-app
Find all TypeScript files in this project
Search for "authentication" functions
Analyze the main App.tsx file
If you launch with --project-path, you can skip the first command above - the server already
knows the project location.
If you are using Anthropic's Codex CLI, add the server to ~/.codex/config.toml.
On Windows the file lives at C:\Users\<you>\.codex\config.toml:
[mcp_servers.code-index]
type = "stdio"
command = "uvx"
args = ["code-index-mcp"]
You can append
--project-path C:/absolute/path/to/repoto theargslist to set the project automatically on startup (same effect as running theset_project_pathtool).
On Windows, uvx needs the standard profile directories to be present.
Keep the environment override in the same block so the MCP starts reliably:
env = {
HOME = "C:\\Users\\<you>",
APPDATA = "C:\\Users\\<you>\\AppData\\Roaming",
LOCALAPPDATA = "C:\\Users\\<you>\\AppData\\Local",
SystemRoot = "C:\\Windows"
}
Linux and macOS already expose the required XDG paths and HOME, so you can usually omit the env
table there.
Add overrides only if you run the CLI inside a restricted container.
Code Review: "Find all places using the old API"
Refactoring Help: "Where is this function called?"
Learning Projects: "Show me the main components of this React project"
Debugging: "Search for all error handling related code"
build_deep_indexLanguages with Specialized Tree-sitter Strategies:
.py, .pyw) - Full AST analysis with class/method extraction and call tracking.js, .jsx, .mjs, .cjs) - ES6+ class and function parsing with tree-sitter.ts, .tsx) - Complete type-aware symbol extraction with interfaces.java) - Full class hierarchy, method signatures, and call relationships.go) - Struct methods, receiver types, and function analysis.m, .mm) - Class/instance method distinction with +/- notation.zig, .zon) - Function and struct parsing with tree-sitter ASTAll Other Programming Languages: All other programming languages use the FallbackParsingStrategy which provides basic file indexing and metadata extraction. This includes:
.c, .cpp, .h, .hpp), Rust (.rs).cs), Kotlin (.kt), Scala (.scala), Swift (.swift).rb), PHP (.php), Shell (.sh, .bash)Frameworks & Libraries:
.vue).svelte).astro)Styling:
.css, .scss, .less, .sass, .stylus, .styl).html)Templates:
.hbs, .handlebars).ejs).pug)SQL Variants:
.sql, .ddl, .dml).mysql, .postgresql, .psql, .sqlite, .mssql, .oracle, .ora, .db2)Database Objects:
.proc, .procedure, .func, .function).view, .trigger, .index)Migration & Tools:
.migration, .seed, .fixture, .schema).liquibase, .flyway)NoSQL & Modern:
.cql, .cypher, .sparql, .gql).md, .mdx).json, .xml, .yml, .yaml)For contributing or local development:
Clone and install:
git clone https://github.com/johnhuang316/code-index-mcp.git
cd code-index-mcp
uv sync
Configure 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-mcp
Then configure:
{
"mcpServers": {
"code-index": {
"command": "code-index-mcp",
"args": []
}
}
}
| Tool | Description |
|---|---|
set_project_path |
Initialize indexing for a project directory |
refresh_index |
Rebuild the shallow file index after file changes |
build_deep_index |
Generate the full symbol index used by deep analysis |
get_settings_info |
View current project configuration and status |
Run build_deep_index when you need symbol-level data; the default shallow index powers quick file discovery.
| Tool | Description |
|---|---|
search_code_advanced |
Smart search with regex, fuzzy matching, file filtering, and paginated results (10 per page by default) |
find_files |
Locate files using glob patterns (e.g., **/*.py) |
get_file_summary |
Analyze file structure, functions, imports, and complexity (requires deep index) |
| Tool | Description |
|---|---|
get_file_watcher_status |
Check file watcher status and configuration |
configure_file_watcher |
Enable/disable auto-refresh and configure settings |
| 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.) |
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
Tip: run build_deep_index first if you get a needs_deep_index response.
Search for all function calls matching "get.*Data" using regex
Finds: 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 files
Uses: search_code_advanced with file_pattern: "*.py" (defaults to 10 matches; use max_results to expand or start_index to page)
Configure automatic index updates when files change
Uses: configure_file_watcher to enable/disable monitoring and set debounce timing
I added new components, please refresh the project index
Uses: refresh_index to update the searchable cache
If automatic index updates aren't working when files change, try:
pip install watchdog (may resolve environment isolation issues)refresh_index tool after making file changesget_file_watcher_status to verify monitoring is activegit clone https://github.com/johnhuang316/code-index-mcp.git
cd code-index-mcp
uv sync
uv run code-index-mcp
npx @modelcontextprotocol/inspector uvx code-index-mcp
Contributions are welcome! Please feel free to submit a Pull Request.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
{
"mcpServers": {
"code-index": {
"command": "uvx",
"args": [
"code-index-mcp"
]
}
}
}claude mcp add code-index uvx code-index-mcp