# Code Context Engine

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

- **Type:** MCP server
- **Install:** `agentstack add mcp-acc-c-code-context-engine`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [acc-c](https://agentstack.voostack.com/s/acc-c)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [acc-c](https://github.com/acc-c)
- **Source:** https://github.com/acc-c/code-context-engine

## Install

```sh
agentstack add mcp-acc-c-code-context-engine
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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](https://github.com/acc-c/code-context-engine/releases/latest).
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](docs/installation.md) for checksum commands and PATH setup.

### Build from source

Install stable Rust, clone this repository, and run:

```bash
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:

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

## Quick Start

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

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

Search the index:

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

Gather context before editing:

```bash
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:

```bash
context mcp-stdio
```

Example MCP client configuration:

```json
{
  "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](docs/mcp-setup.md) 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:

```bash
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

- [Installation](docs/installation.md)
- [MCP setup](docs/mcp-setup.md)
- [CLI guide](docs/cli.md)
- [Tool contracts](docs/tool-contracts.md)
- [Agent workflow](docs/agent-workflow.md)
- [Architecture](docs/architecture.md)
- [Release process](docs/releasing.md)
- [Roadmap](docs/roadmap.md)
- [Changelog](CHANGELOG.md)

## License

Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [acc-c](https://github.com/acc-c)
- **Source:** [acc-c/code-context-engine](https://github.com/acc-c/code-context-engine)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-acc-c-code-context-engine
- Seller: https://agentstack.voostack.com/s/acc-c
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
