Code Index

Developer tools

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

Your AI app calls the Code Index MCP server, which does the developer tools work and sends the result back to the chat.

About Code Index

Code Index is a community MCP server from johnhuang316, filed in our directory under developer tools. A Model Context Protocol (MCP) server that helps large language models index, search, and analyze code repositories with minimal setup.

Code Index runs on your own machine: your AI app starts it with the command uvx code-index-mcp and talks to it over standard input and output.

At a glance

Publisher
johnhuang316 (community)
Runs
Locally on your machine
Install from
Python package on PyPI: code-index-mcp
Written in
Python
License
MIT
GitHub stars
1,006

How to set up Code Index

  1. Install uv on the machine that runs your AI app, because Code Index starts with uvx and fetches its Python package on first run.
  2. Check the Code Index README for keys or settings; the registry lists none that Code Index requires.
  3. Add Code Index to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Code Index tools to confirm the connection.
  5. Run one read-only task with Code Index first, and keep your app asking before each tool call until the results look right.

Code Index compared with similar servers

  • Stitch by davideast has fewer GitHub stars than Code Index (985 against 1k); both are community servers, and both run locally.
  • Mcpm Sh by pathintegral-institute has more GitHub stars than Code Index (1k against 1k); both are community servers, and both run locally.
  • Adobe Premiere Pro by hetpatel-11 has fewer GitHub stars than Code Index (976 against 1k); both are community servers, and both run locally.

Before you connect Code Index

  • Give Code Index its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Code Index tool call until you trust what it does with them.
  • Treat text that Code Index fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Code Index on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Code Index

How marketing and sales teams put Code Index to work, by company size. Pick the size closest to yours and start Code Index on one use case.

Small business

  • A small business with a developer can use Code Index to ship site and tracking fixes faster, with the AI reading the code it changes.
  • Technical founders can ask Code Index to explain and fix a marketing site issue without context switching between tools.
  • Code Index runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Growth engineers can use Code Index to build landing pages, tracking and integrations in fewer cycles, with reviews kept in the normal flow.
  • Marketing ops engineers can connect Code Index to keep scripts and automations documented and versioned as they change.
  • Start Code Index on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprise engineering teams can roll out Code Index with repo scopes and audit logs, so agents work only where they are allowed.
  • Platform teams can standardize on Code Index so web and marketing engineering share one reviewed way of working with AI.
  • Code Index is a community server, so have security review the code and pin a version before Code Index touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Code Index README

From johnhuang316/code-index-mcp on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

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.

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"]
        }
      }
    }
    

    Optional: append --project-path /absolute/path/to/repo to the args array so the server initializes with that repository automatically (equivalent to calling set_project_path after startup).

  2. Restart your application – uvx automatically handles installation and execution

  3. 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.

Codex CLI Configuration

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/repo to the args list to set the project automatically on startup (same effect as running the set_project_path tool).

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.

FastMCP & Discovery Manifests
  • Run fastmcp run fastmcp.json to launch the server via FastMCP with the correct source entrypoint and dependency metadata. Pass --project-path (or call the set_project_path tool after startup) so the index boots against the right repository.
  • Serve or copy .well-known/mcp.json to share a standards-compliant MCP manifest. Clients that support the .well-known convention (e.g., Claude Desktop, Codex CLI) can import this file directly instead of crafting configs manually.
  • Publish .well-known/mcp.llmfeed.json when you want to expose the richer LLM Feed metadata. It references the same code-index server definition plus documentation/source links, which helps registries present descriptions, tags, and capabilities automatically.

When sharing the manifests, remind consumers to supply --project-path (or to call set_project_path) so the server indexes the intended repository.

Typical Use Cases

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"

Key Features

🔍 Intelligent Search & Analysis
  • Dual-Strategy Architecture: Specialized tree-sitter parsing for 10 core languages, fallback strategy for 50+ file types
  • Direct Tree-sitter Integration: No regex fallbacks for specialized languages - fail fast with clear errors
  • Advanced Search: Auto-detects and uses the best available tool (ugrep, ripgrep, ag, or grep)
  • Universal File Support: Comprehensive coverage from advanced AST parsing to basic file indexing
  • File Analysis: Deep insights into structure, imports, classes, methods, and complexity metrics after running build_deep_index
🗂️ Multi-Language Support
  • 10 Languages with Tree-sitter AST Parsing: Python, JavaScript, TypeScript, Java, Kotlin, C#, Go, Objective-C, Zig, Rust
  • 50+ File Types with Fallback Strategy: C/C++, Ruby, PHP, and all other programming languages
  • Document & Config Files: Markdown, JSON, YAML, XML with appropriate handling
  • Web Frontend: Vue, React, Svelte, HTML, CSS, SCSS
  • Java Web & Build: JSP/Tag files (.jsp, .jspx, .jspf, .tag, .tagx), Grails/GSP (.gsp), Gradle & Groovy builds (.gradle, .groovy), .properties, and Protocol Buffers (.proto)
  • Database: SQL variants, NoSQL, stored procedures, migrations
  • Configuration: JSON, YAML, XML, Markdown
  • View complete list
⚡ Real-time Monitoring & Auto-refresh
  • File Watcher: Automatic index updates when files change
  • Cross-platform: Native OS file system monitoring
  • Smart Processing: Batches rapid changes to prevent excessive rebuilds
  • Shallow Index Refresh: Watches file changes and keeps the file list current; run a deep rebuild when you need symbol metadata
⚡ Performance & Efficiency
  • Tree-sitter AST Parsing: Native syntax parsing for accurate symbol extraction
  • Persistent Caching: Stores indexes for lightning-fast subsequent access
  • Smart Filtering: Intelligent exclusion of build directories and temporary files
  • Memory Efficient: Optimized for large codebases
  • Direct Dependencies: No fallback mechanisms - fail fast with clear error messages

Supported File Types

📁 Programming Languages (Click to expand)

Languages with Specialized Tree-sitter Strategies:

  • Python (.py, .pyw) - Full AST analysis with class/method extraction and call tracking
  • JavaScript (.js, .jsx, .mjs, .cjs) - ES6+ class and function parsing with tree-sitter
  • TypeScript (.ts, .tsx) - Complete type-aware symbol extraction with interfaces
  • Java (.java) - Full class hierarchy, method signatures, and call relationships
  • Kotlin (.kt, .kts) - Package-aware symbol extraction with methods and call relationships
  • C# (.cs) - Namespace-aware type/member extraction with call relationships
  • Go (.go) - Struct methods, receiver types, and function analysis
  • Rust (.rs) - Functions, module-aware names, impl methods, structs/enums/traits, and basic call relationships
  • Objective-C (.m, .mm) - Class/instance method distinction with +/- notation
  • Zig (.zig, .zon) - Function and struct parsing with tree-sitter AST

All Other Programming Languages: All other programming languages use the FallbackParsingStrategy which provides basic file indexing and metadata extraction. This includes:

  • System & Low-Level: C/C++ (.c, .cpp, .h, .hpp)
  • Object-Oriented: Scala (.scala), Swift (.swift)
  • Scripting & Dynamic: Ruby (.rb), PHP (.php), Shell (.sh, .bash)
  • And 40+ more file types - All handled through the fallback strategy for basic indexing
🌐 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)
  • FreeMarker (.ftl)
  • Mustache (.mustache)
  • Liquid (.liquid)
  • ERB (.erb)
🗄️ 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, .properties)
🛠️ 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
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.

🔍 Search & Discovery
Tool Description
search_code_advanced Smart search with literal-by-default matching, optional regex=True, fuzzy matching, file filtering, and paginated results (10 per page by default); regex mode requires a native search tool because the basic fallback is literal-only
find_files Locate files using glob patterns (e.g., **/*.py)
get_file_summary Analyze file structure, functions, imports, and complexity (requires deep index)
🔄 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 Tip: run build_deep_index first if you get a needs_deep_index response.

🔍 Advanced Search Examples
Code Pattern Search
Search for all function calls matching "get.*Data" using `regex=True`

Finds: getData(), getUserData(), getFormData(), etc. Regex search is opt-in; install a native search tool and use regex=True because the basic fallback stays literal-only.

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 literal matching and file_pattern: "*.py" (defaults to 10 matches; use max_results to expand or start_index to page)

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
macOS File Watcher Options

The default FSEvents observer works well for most projects. If you experience issues, you can switch to an alternative observer via configure_file_watcher:

  • "auto" (default): Platform default (FSEvents on macOS)
  • "kqueue": Kqueue observer (macOS/BSD)
  • "fsevents": Force FSEvents (macOS only)
  • "polling": Cross-platform polling fallback

Note: Kqueue opens one file descriptor per watched file. For large projects using kqueue, you may need to increase the limit: ulimit -n 10240

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

Questions about Code Index

What is the Code Index MCP server?

A Model Context Protocol (MCP) server that helps large language models index, search, and analyze code repositories with minimal setup. Code Index is maintained by johnhuang316 on GitHub at johnhuang316/code-index-mcp, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Code Index MCP server?

Add Code Index to your AI app's MCP config with the command uvx code-index-mcp. In Claude Code, run claude mcp add --transport stdio code-index -- uvx code-index-mcp. To run Code Index this way you need uv installed.

Does Code Index need an API key?

The registry lists no required keys for Code Index. Check the Code Index README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Code Index an official MCP server?

No. Code Index is a community server maintained by johnhuang316. Community servers can be excellent; read the code and the open issues before you give Code Index access to company data.

What license is Code Index under?

Code Index is released under the MIT license, according to its GitHub repository. The license covers the code of Code Index; the service it connects to has its own terms.