Skip to content

Code Context Engine

Code Context Engine is a local-first code index and MCP server for AI coding agents. It indexes a local repository, returns compact context before an edit, fetches exact source on demand, and reports likely impact afterward.

Source code stays on the local machine unless an optional external provider is configured to do otherwise.

Features

  • Indexes Rust, Java, TypeScript/TSX, and Python source.
  • Stores chunks, symbols, graph edges, search data, and project memories in file-backed SQLite storage.
  • Provides lexical search, deterministic local hash-vector search, reference lookup, context expansion, and impact analysis.
  • Exposes the workflow through both a context CLI and an MCP stdio server.
  • Supports optional compiler or type-checker reference providers.
  • Runs without Java, Node.js, Python, or external providers for the basic local indexing workflow.

Install

Download a release

  1. Open GitHub Releases.
  2. Download the archive matching your operating system and architecture.
  3. Extract the archive.
  4. Run context --help on Linux/macOS or context.exe --help on Windows.

Each archive has a matching .sha256 file. See Installation for checksum commands and PATH setup.

Build from source

Install stable Rust, clone this repository, and run:

cargo build --locked --release -p context-cli

The executable is written to target/release/context on Linux/macOS or target/release/context.exe on Windows.

You can also install it into Cargo's binary directory:

cargo install --locked --path crates/context-cli

Quick Start

Index a local project into a file-backed SQLite database:

context index --repo /absolute/path/to/project --db /absolute/path/to/project/.context/code-index.sqlite

Search the index:

context search --db /absolute/path/to/project/.context/code-index.sqlite --query "authentication middleware" --limit 10

Gather context before editing:

context pre-change-context --repo /absolute/path/to/project --db /absolute/path/to/project/.context/code-index.sqlite --task "change authentication middleware" --limit 10 --depth 1

Use context get-chunk with a returned chunk ID when exact source text is needed. Run context post-change-impact after the edit to inspect likely affected symbols and recommended tests.

On Windows, absolute paths such as C:\work\project are accepted. Quote paths that contain spaces.

Start the MCP Server

The MCP entry point is:

context mcp-stdio

Example MCP client configuration:

{
  "mcpServers": {
    "code-context-engine": {
      "command": "/absolute/path/to/context",
      "args": ["mcp-stdio"]
    }
  }
}

Use context.exe on Windows. If the executable is already on PATH, the command may simply be context. See MCP setup for smoke tests, path guidance, and the recommended AI workflow.

AI Workflow

  1. Run index_repo for the local repository and a file-backed SQLite path.
  2. Run pre_change_context before a non-trivial edit.
  3. Fetch selected source with get_chunk.
  4. Edit with normal development tools and run the project's tests.
  5. Run post_change_impact with the Git diff or explicit changed files.

Built-in graph evidence is heuristic. Treat it as investigation guidance, not as proof that every dependency has been found.

Development

Run the public quality gates from the workspace root:

cargo fmt --all -- --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace

GitHub Actions runs these checks on pushes and pull requests. Tags matching v* build downloadable Windows, Linux, and macOS release archives.

Documentation

License

Apache-2.0. See LICENSE and NOTICE.

About

Local-first code indexing and MCP context server for AI coding agents.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages