Why loading the whole repo does not scale
A model accepts a limited amount of text per request, its context window. A client sends the conversation again on each turn, so a file in the context is paid for again on each turn, until the client compacts the conversation. A small project can fit in the window. A large repository can exceed it, and files unrelated to the current task still cost tokens.
With a search tool, the repository stays on disk and the index covers the files that the project settings select. The agent requests the chunks that match the current task.
What the index covers
cocoindex-code is an open-source (Apache 2.0) CLI and MCP server. ccc index walks the project and indexes the files that match its include patterns, minus the excluded ones listed below. The README lists 33 languages, among them Python, TypeScript, JavaScript, Rust, Go, Java, C, C++, C#, SQL and Markdown.
The project settings file, .cocoindex_code/settings.yml, controls the scope:
include_patternsandexclude_patternsselect files. The defaults exclude hidden directories,node_modules,dist,target,__pycache__and vendor directories.- Files that
.gitignoreexcludes stay out of the index, and so do empty files and files that are not UTF-8 text. max_file_sizeskips bundled or generated files above a size, for example500KB.
For the languages it supports, Tree-sitter parses the file, and the tool tries to split it at function, class and method boundaries. Each chunk is embedded. The agent’s query returns the closest chunks with file path and line numbers, from any indexed file.
Install and connect each client
Install the CLI and index the repository:
pipx install 'cocoindex-code[full]'
# or with uv:
uv tool install --upgrade 'cocoindex-code[full]'
cd your-repo
ccc index
Claude Code. The README recommends the skill. The skill teaches the agent to initialize, index and search, and you can invoke it with /ccc:
npx skills add cocoindex-io/cocoindex-code
Or add the MCP server:
claude mcp add cocoindex-code -- ccc mcp
OpenAI Codex CLI.
codex mcp add cocoindex-code -- ccc mcp
Cursor and other MCP clients. A client that launches a stdio server takes this entry in its MCP configuration. The client must start ccc mcp with the project as its working directory:
{
"mcpServers": {
"cocoindex-code": {
"command": "ccc",
"args": ["mcp"]
}
}
}
The README also documents OpenCode, Kilo Code, Grok and Oh My Pi, and a Docker setup for teams that want no Python on the host.
The MCP server exposes one tool:
search(
query: str, # Natural language query or code snippet
limit: int = 5, # Maximum results (1-100)
offset: int = 0, # Pagination offset
refresh_index: bool = True, # Refresh index before querying
languages: list[str] | None = None, # Filter by language (e.g. ["python", "typescript"])
paths: list[str] | None = None, # Filter by path glob (e.g. ["src/utils/*"])
)
Limits, and when another tool fits better
- Chunks. Search returns chunks, so the agent still opens the file to edit a function. Each result gives the file and the lines.
- Built-in search. Claude Code searches with file patterns and regular expressions (docs), and Cursor documents its own codebase search. The MCP server adds search by meaning next to them. In a small repository the built-in tools can be enough.
- Scope. The index covers one project on one machine. For the repositories of a whole organization behind one API, see CocoIndex Code Plus (
ccx). It is a separate self-hosted product, with search across repositories, symbol definitions and references, and cited answers. - Summaries. Search does not summarize. For an overview of how a codebase is organized, a generated wiki fits better. Build a self-updating wiki for your codebases shows one built with CocoIndex.
Sources and further reading
- cocoindex-code README: client setup, MCP tool reference, project settings, supported languages.
- Index your codebase for AI agents with CocoIndex V1: build your own code index with the CocoIndex framework.
- llms.txt: the install recipes in plain text for agents.