Skip to content

Latest commit

 

History

History
117 lines (91 loc) · 3.14 KB

File metadata and controls

117 lines (91 loc) · 3.14 KB

MCP Setup

Code Context Engine exposes a JSON-RPC MCP server over standard input and output.

Start Command

context mcp-stdio

Example MCP client configuration:

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

Use /absolute/path/to/context.exe on Windows. If the executable is on PATH, use context as the command. MCP clients use different outer configuration formats, but the command and arguments remain the same.

For development directly from the source workspace:

{
  "mcpServers": {
    "code-context-engine": {
      "command": "cargo",
      "args": [
        "run",
        "--manifest-path",
        "/absolute/path/to/code-context-engine/Cargo.toml",
        "-p",
        "context-cli",
        "--",
        "mcp-stdio"
      ]
    }
  }
}

A release binary is preferable for normal use because unrelated source changes cannot prevent the MCP server from starting.

Smoke Test

PowerShell:

@(
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}',
  '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'
) | & "C:\absolute\path\to\context.exe" mcp-stdio

Linux or macOS:

printf '%s\n' \
  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
  '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' |
  /absolute/path/to/context mcp-stdio

The initialize response should identify code-context-engine. The tool list should include index_repo, search_code, get_chunk, pre_change_context, and post_change_impact.

Recommended Agent Workflow

  1. Call index_repo with an existing local directory and a writable SQLite file path.
  2. Call pre_change_context before a non-trivial edit.
  3. Inspect metadata and fetch selected exact source with get_chunk.
  4. Make the edit with normal file and development tools.
  5. Run project tests and static checks.
  6. Call post_change_impact with unified Git diff text when available.

Use memory_add for durable project decisions and invariants, not transient task notes. Run memory_reconcile after major moves or refactors.

Paths and Storage

  • repo is a local directory. It does not need to be a Git repository.
  • Absolute paths avoid ambiguity about the MCP client's working directory.
  • db must be a file-backed SQLite path.
  • A single database may contain multiple repositories.
  • Pass repo to repository-scoped context and memory calls when sharing a database.

Optional Reference Providers

Basic indexing and heuristic graph analysis work without external providers. Optional compiler or type-checker providers can add higher-confidence reference edges when their underlying tools are installed:

  • Rust: rust-analyzer SCIP
  • Java: scip-java
  • TypeScript/TSX: TypeScript compiler and language-service API
  • Python: Pyright and pyright-langserver

Inspect provider_diagnostics after indexing. Do not silently ignore a failed strict provider.

Evidence Limits

The built-in graph provider is heuristic. Its reference and impact results are investigation guidance and do not prove that every dependency or affected test has been found.