Code Context Engine
Save 94% on AI coding tokens. Index your codebase, agents search instead of reading files. Works with Claude Code, Codex, Copilot, Cursor, Gemini CLI. Local MCP server, free, open source.
What is Code Context Engine?
Code Context Engine is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to save 94% on ai coding tokens. index your codebase, agents search instead of reading files. works with claude code, codex, copilot, cursor, gemini cli. local mcp server, free, open source.
Save 94% on AI coding tokens. Index your codebase, agents search instead of reading files. Works with Claude Code, Codex, Copilot, Cursor, Gemini CLI. Local MCP server, free, open source.
This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Save 94% on AI coding tokens. Index your codebase, agents se
Use Cases
Maintainer
Works with
Installation
PIP
pip install code-context-engineManual Installation
pip install code-context-engineConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use Code Context Engine
Code Context Engine (CCE) is a local MCP server written in Python that indexes your codebase into a hybrid vector + BM25 search index with call graph expansion, enabling AI coding agents to retrieve precise code context through semantic search instead of reading files one by one. It exposes nine MCP tools including context_search, expand_chunk, related_context, session_recall, and reindex, and integrates with Claude Code, Cursor, Gemini CLI, GitHub Copilot, OpenAI Codex, and more. By replacing broad file scanning with targeted index queries, it claims to reduce AI coding token consumption by up to 94% while keeping all data entirely local — no external API calls required.
Prerequisites
- Python 3.10+ installed
- uv or pipx package manager (uv recommended)
- An AI coding agent: Claude Code, Cursor, Gemini CLI, GitHub Copilot (VS Code), or OpenAI Codex CLI
- Optional: Ollama for the non-local embedding variant (default local install includes a bundled embedding model)
Install Code Context Engine
Install with uv tool install using the [local] extra to include the bundled local embedding model. This avoids needing a separate Ollama instance. You can also use pipx as an alternative.
# Recommended: includes local embedding model
uv tool install "code-context-engine[local]"
# Alternative: requires Ollama for embeddings
uv tool install code-context-engine
# Or with pipx
pipx install "code-context-engine[local]"Initialize the index for your project
Navigate to your project root and run cce init. This builds the hybrid search index from your source files. The index is stored locally in a project-level directory.
cd /path/to/your/project
cce init
# Initialize and register with a specific agent
cce init --agent claudeRegister CCE with your AI coding agent
Run cce init --agent <name> to automatically write the MCP configuration to your agent's config path and create any required instruction files (e.g., CLAUDE.md for Claude Code).
cce init --agent claude # Claude Code → .mcp.json + CLAUDE.md
cce init --agent cursor # Cursor → .cursor/mcp.json + .cursorrules
cce init --agent gemini # Gemini CLI → .gemini/settings.json + GEMINI.md
cce init --agent codex # Codex CLI → ~/.codex/config.toml + AGENTS.mdCheck index status and verify token savings
Confirm the index is fresh and view the savings dashboard to see token and tool call reductions compared to baseline file-scanning behavior.
cce dashboard
cce savings --all
cce search "authentication flow"Configure optional settings
Adjust compression level, retrieval parameters, and Ollama URL via the global config file at ~/.cce/config.yaml or project-level .context-engine.yaml.
# ~/.cce/config.yaml
compression:
level: standard # minimal | standard | full
output: standard # off | lite | standard | max
retrieval:
top_k: 20
confidence_threshold: 0.5
# For remote Ollama (optional):
# CCE_OLLAMA_URL=http://remote-host:11434Code Context Engine Examples
Client configuration
After running cce init --agent claude, the .mcp.json is written automatically. The equivalent manual config for Claude Code looks like this:
{
"mcpServers": {
"code-context-engine": {
"command": "cce",
"args": ["serve"]
}
}
}Prompts to try
Once CCE is indexed and registered, the AI agent uses context_search and related_context automatically. You can also ask explicitly.
- "Search the codebase for how user authentication is implemented"
- "Find all code related to the payment processing flow and show me the relevant functions"
- "What files would I need to change to add a new API endpoint?"
- "Show me the context around the database connection pooling logic"
- "What decisions were recorded in previous sessions about the auth module?"Troubleshooting Code Context Engine
cce command not found after installation
Ensure uv's tool bin directory is in your PATH. Run uv tool dir to find the bin path, then add it to your shell profile: export PATH="$HOME/.local/bin:$PATH". Reload your shell with source ~/.zshrc or source ~/.bashrc.
Index initialization fails with embedding model errors
If you installed without the [local] extra, you need Ollama running locally. Install Ollama from ollama.ai and start it with ollama serve. Alternatively, reinstall with uv tool install "code-context-engine[local]" to use the bundled model and avoid this dependency.
AI agent still reads files with Read/grep instead of using CCE tools
Run cce init --agent <name> from your project root to ensure the agent-specific instruction file (e.g., CLAUDE.md, .cursorrules) is present. These instruction files tell the agent to prefer CCE tools over direct file access. Also verify the MCP server is listed as connected in your agent's interface.
Frequently Asked Questions about Code Context Engine
What is Code Context Engine?
Code Context Engine is a Model Context Protocol (MCP) server that save 94% on ai coding tokens. index your codebase, agents search instead of reading files. works with claude code, codex, copilot, cursor, gemini cli. local mcp server, free, open source. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install Code Context Engine?
Install via pip with: pip install code-context-engine. Then configure your AI client to connect to this MCP server.
Which AI clients work with Code Context Engine?
Code Context Engine works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is Code Context Engine free to use?
Yes, Code Context Engine is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
Code Context Engine Alternatives — Similar Coding Agents Servers
Looking for alternatives to Code Context Engine? Here are other popular coding agents servers you can use with Claude, Cursor, and VS Code.
Dify
★ 142.2kProduction-ready platform for agentic workflow development.
Ruflo
★ 54.0k🌊 The leading agent orchestration platform for Claude. Deploy intelligent multi-agent swarms, coordinate autonomous workflows, and build conversational AI systems. Features enterprise-grade architecture, self-learning swarm intelligence, RAG integrat
Goose
★ 45.7kan open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
Antigravity Awesome Skills
★ 38.3kInstallable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.
AgentScope
★ 25.5kBuild and run agents you can see, understand and trust.
Serena
★ 24.5kA coding agent toolkit that provides IDE-like semantic code retrieval and editing tools, enabling LLMs to efficiently navigate and modify codebases using symbol-level operations instead of basic file reading and string replacements.
Browse More Coding Agents MCP Servers
Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up Code Context Engine in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use Code Context Engine?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.