Logotipo de Code Index MCP

Code Index MCP

ComunidadPopular
johnhuang316

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

Editorjohnhuang316
Repositoriocode-index-mcp
IdiomaPython
Forks
120
Estrellas
1K
Herramientas disponibles
0
Tipo de transportestdio
Categorías
LicenciaMIT
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    Code Index MCP ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    1K estrellas y 120 forks en el repositorio enlazado.

Code Index MCP

MCP Server Python License Sponsor

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):

    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:

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:

toml
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

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

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)

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, .properties)

🛠️ Development Setup

For contributing or local development:

  1. Clone and install:

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

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

    bash
    npx @modelcontextprotocol/inspector uv run code-index-mcp

If you prefer traditional pip management:

bash
pip install code-index-mcp

Then configure:

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

Available Tools

🏗️ Project Management

ToolDescription
set_project_pathInitialize indexing for a project directory
refresh_indexRebuild the shallow file index after file changes
build_deep_indexGenerate the full symbol index used by deep analysis
get_settings_infoView 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

ToolDescription
search_code_advancedSmart 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_filesLocate files using glob patterns (e.g., **/*.py)
get_file_summaryAnalyze file structure, functions, imports, and complexity (requires deep index)

🔄 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 Tip: run build_deep_index first if you get a needs_deep_index response.

🔍 Advanced Search Examples

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.

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 literal matching and 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

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

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

🐛 Debugging

bash
npx @modelcontextprotocol/inspector uvx code-index-mcp

🤝 Contributing

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


📜 License

MIT License

🌐 Translations

Instalación

TypingMind
Requisitos:

Node.js 18+

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

Usa el MCP de Code Index MCP con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado Code Index MCP, puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade Code Index MCP como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de Code Index MCP.
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "johnhuang316-code-index-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "code-index-mcp"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de Code Index MCP y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de Code Index MCP.
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar Code Index MCP para ayudarme con esta tarea?
Code Index MCP
Claro. Lo he leído.
Esto he encontrado usando Code Index MCP.

Preguntas frecuentes

¿Para qué sirve el servidor MCP Code Index MCP?

Code Index MCP es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP Code Index MCP con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar Code Index MCP con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de Code Index MCP con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con Code Index MCP conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP Code Index MCP a TypingMind?

Code Index MCP funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP Code Index MCP en TypingMind?

Code Index MCP ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP Code Index MCP?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si Code Index MCP requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇