home / mcp / code index mcp server
A Model Context Protocol (MCP) server that helps large language models index, search, and analyze code repositories with minimal setup
Configuration
View docs{
"mcpServers": {
"johnhuang316-code-index-mcp": {
"command": "uvx",
"args": [
"code-index-mcp"
],
"env": {
"HOME": "<your_home_path>",
"APPDATA": "<your_appdata_path>",
"SystemRoot": "<system_root>",
"LOCALAPPDATA": "<your_localappdata_path>"
}
}
}
}Code Index MCP provides intelligent code indexing, advanced search, and deep code analysis to help AI assistants understand and navigate large codebases. It streams project context to your AI workflows, enabling fast code exploration, review, and debugging across multiple languages and file types.
Connect your MCP client to the Code Index MCP server and start indexing a local project. You can initialize a shallow index for quick file discovery and then build a deep symbol index for language-aware analysis. Use the server to set a project path, search across files, and request summaries of individual files to understand code structure, imports, and complexity.
Recommended workflow patterns you can run with your MCP client include: set the project path to your repository, find all TypeScript component files, search for authentication-related functions, and analyze the main entry file to grasp overall architecture.
Prerequisites: you need Python 3.10+ and uv ready in your environment.
1) Create or update your MCP configuration to include the Code Index server. You will run the MCP server locally through uvx.
2) Start the MCP server using the provided runtime command so it can index your project and serve analysis requests to your MCP client.
{
"mcpServers": {
"code_index": {
"command": "uvx",
"args": ["code-index-mcp"]
}
}
}Windows-specific Codex CLI setup uses the same runtime but in a Windows-friendly TOML form. You can add the server to your Codex CLI configuration as shown here. Use the same command and arguments to start the server.
[mcp_servers.code-index]
type = "stdio"
command = "uvx"
args = ["code-index-mcp"]
# Optional: environment overrides for Windows if you run inside a restricted container
env = {
HOME = "C:\\Users\\<you>",
APPDATA = "C:\\Users\\<you>\\AppData\\Roaming",
LOCALAPPDATA = "C:\\Users\\<you>\\AppData\\Local",
SystemRoot = "C:\\Windows"
}Fast startup and discovery flow can be achieved with FastMCP by launching with the correct source entrypoint and including the repository path on startup. You can publish standard MCP manifests under ".well-known/mcp.json" and expose richer LLM feed metadata under ".well-known/mcp.llmfeed.json" to help clients present descriptions and capabilities automatically.
When you start the server, remember to provide the project path so the index boots against your intended repository. If you include a project path on startup, you can skip the initial project path setup step in prompts.
Code Review: Find all places using the old API. Refactoring Help: Locate where a function is called. Learning Projects: Show the main components of a React project. Debugging: Search for error-handling patterns across the codebase.
Keep your environment variables and paths secure. Use only trusted project paths and avoid exposing your MCP endpoints to untrusted networks. Regularly refresh the index to reflect changes in your codebase and monitor the file watcher status to ensure the system remains up to date.
If automatic index updates arenβt working, ensure your runtime environment includes required tooling and try a manual refresh with the appropriate tool. Check the file watcher status to verify monitoring is active, and review any environment-specific constraints that may block indexing.
To contribute or run locally, install dependencies, set up the local MCP server, and start the indexer. Use the appropriate inspector tool to debug and verify your MCP setup during development.
Initialize indexing for a project directory
Rebuild the shallow file index after file changes
Generate the full symbol index used by deep analysis
View current project configuration and status
Smart search with regex, fuzzy matching, file filtering, and paginated results
Locate files using glob patterns
Analyze file structure, functions, imports, and complexity
Check file watcher status and configuration
Enable/disable auto-refresh and configure settings
Set up storage directory for index data
Verify index storage location and permissions
Reset all cached data and configurations
Re-detect available search tools