open-context-engine 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  <a href="docs/BENCHMARKS.md#engineering-validation"><img src="https://img.shields.io/badge/verified_tests-107-23875b?style=flat-square" alt="107 verified tests"></a>
12
12
  <a href="docs/QUICKSTART.md"><img src="https://img.shields.io/badge/MCP-stdio-193c34?style=flat-square" alt="MCP over stdio"></a>
13
13
  </p>
14
- <p><a href="#quick-start">Quick start</a> · <a href="docs/BENCHMARKS.md">Benchmarks</a> · <a href="docs/QUICKSTART.md">MCP setup</a></p>
14
+ <p><a href="#quick-start">Quick start</a> · <a href="docs/BENCHMARKS.md">Benchmarks</a> · <a href="docs/QUICKSTART.md">MCP setup</a> · <strong>English</strong> | <a href="README.zh-CN.md">简体中文</a></p>
15
15
  </div>
16
16
 
17
17
  OpenContextEngine is a **self-hostable code context engine for AI coding agents**. Connect it to your agent through MCP to help it explore an unfamiliar codebase, locate implementations, and find the related code needed for a fix or feature.
@@ -37,9 +37,9 @@ Measured with the optional batch rerank API. 40 source-derived tasks, each asked
37
37
 
38
38
  Requires **macOS or Linux**, Node.js 22.14+, Python 3.10+, Git, and configured embedding/reranking services. Go repositories also need Go 1.22+.
39
39
 
40
- **Preparing the first npm release; not yet published.** Get the installation archive from the maintainer, then expand your client's guide. Model settings are shared across clients on the same machine.
40
+ Install from npm, then expand your client's guide. Model settings are shared across clients on the same machine.
41
41
 
42
- <details>
42
+ <details open>
43
43
  <summary><strong>Codex — install, connect, and search</strong></summary>
44
44
 
45
45
  **1. Install the CLI**
@@ -47,7 +47,7 @@ Requires **macOS or Linux**, Node.js 22.14+, Python 3.10+, Git, and configured e
47
47
  With Codex CLI already installed, run:
48
48
 
49
49
  ```sh
50
- npm install -g /path/to/open-context-engine-0.1.0.tgz
50
+ npm install -g open-context-engine
51
51
  ```
52
52
 
53
53
  **2. Configure your models**
@@ -80,8 +80,6 @@ Ask:
80
80
 
81
81
  Codex supplies the project's absolute path as `directory_path`. The first request starts indexing; if it is still building, ask Codex to check `index_status` and retry when ready. Later searches reuse the index, and saved changes update automatically.
82
82
 
83
- [Codex MCP reference](https://developers.openai.com/codex/mcp)
84
-
85
83
  </details>
86
84
 
87
85
  <details>
@@ -92,7 +90,7 @@ Codex supplies the project's absolute path as `directory_path`. The first reques
92
90
  With Claude Code already installed, run:
93
91
 
94
92
  ```sh
95
- npm install -g /path/to/open-context-engine-0.1.0.tgz
93
+ npm install -g open-context-engine
96
94
  ```
97
95
 
98
96
  **2. Configure your models**
@@ -124,8 +122,6 @@ Run `/mcp` to check the connection, then ask:
124
122
 
125
123
  Claude supplies the project's absolute path as `directory_path`. The first request starts indexing; if it is still building, ask Claude to check `index_status` and retry when ready. Later searches reuse the index, and saved changes update automatically.
126
124
 
127
- [Claude Code MCP reference](https://code.claude.com/docs/en/mcp)
128
-
129
125
  </details>
130
126
 
131
127
  <details>
@@ -148,30 +144,16 @@ Your agent supplies the current project's absolute path as `directory_path`. To
148
144
 
149
145
  </details>
150
146
 
151
- <details>
152
- <summary>Run from source or build an internal package</summary>
153
-
154
- ```sh
155
- git clone https://github.com/AnnaSuSu/OpenContextEngine.git
156
- cd OpenContextEngine
157
- npm ci
158
- node bin/opencontextengine.mjs setup
159
- # Build an installable archive for internal testers:
160
- npm pack
161
- ```
162
-
163
- Use the absolute Node and CLI paths printed by setup. [Client-specific configuration →](docs/QUICKSTART.md#client-setup-notes)
164
-
165
- </details>
166
-
167
147
  [Model configuration, troubleshooting, and update behavior →](docs/QUICKSTART.md)
168
148
 
169
- Once published, install with `npm install -g open-context-engine`. Until then, use the archive above. [Release checklist](docs/RELEASING.md).
170
-
171
149
  ## Explore
172
150
 
173
- [Benchmark report](docs/BENCHMARKS.md) · [Raw evaluations](docs/eval/results) · [Retrieval engine](src/retrieval) · [Logo assets](assets/brand)
151
+ [Benchmark report](docs/BENCHMARKS.md) · [Raw evaluations](docs/eval/results) · [Retrieval engine](src/retrieval)
174
152
 
175
153
  ## License
176
154
 
177
155
  [MIT](LICENSE) © 2026 AnnaSuSu.
156
+
157
+ ## Acknowledgments
158
+
159
+ Thanks to the [LINUX DO](https://linux.do/) community.
@@ -0,0 +1,159 @@
1
+ <div align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="assets/brand/logo-lockup-dark.svg">
4
+ <img src="assets/brand/logo-lockup.svg" alt="OpenContextEngine" width="660">
5
+ </picture>
6
+ <p><strong>为 AI 编程助手提供精准的代码上下文。</strong></p>
7
+ <p>跨文件查找相关代码,追踪代码之间的联系,让助手的回答有据可查。</p>
8
+ <p>
9
+ <a href="docs/BENCHMARKS.md#seven-method-comparison"><img src="https://img.shields.io/badge/dev_evidence_coverage-94.79%25-23875b?style=flat-square" alt="开发集证据覆盖率:94.79%"></a>
10
+ <a href="docs/BENCHMARKS.md#seven-method-comparison"><img src="https://img.shields.io/badge/median_retrieval-1.73_s-23875b?style=flat-square" alt="检索耗时中位数:1.73 秒"></a>
11
+ <a href="docs/BENCHMARKS.md#engineering-validation"><img src="https://img.shields.io/badge/verified_tests-107-23875b?style=flat-square" alt="107 项已验证测试"></a>
12
+ <a href="docs/QUICKSTART.md"><img src="https://img.shields.io/badge/MCP-stdio-193c34?style=flat-square" alt="通过 stdio 接入 MCP"></a>
13
+ </p>
14
+ <p><a href="#快速开始">快速开始</a> · <a href="docs/BENCHMARKS.md">评测报告</a> · <a href="docs/QUICKSTART.md">MCP 配置</a> · <a href="README.md">English</a> | <strong>简体中文</strong></p>
15
+ </div>
16
+
17
+ OpenContextEngine 是一个**可自行部署、面向 AI 编程助手的代码上下文引擎**。通过 MCP 接入后,助手可以借助它理解陌生代码库、定位实现,以及查找修复问题或开发功能所需的相关代码。
18
+
19
+ 它为你的工作目录建立索引,并跟随已保存的代码变化自动更新。面对自然语言任务,它结合语义检索、关键词检索、代码关系和重排,在指定的上下文预算内返回相关源码片段、文件路径和行号。
20
+
21
+ ## 为什么选择 OpenContextEngine
22
+
23
+ - **用自然语言查代码。** 描述你要找的行为,检索其实现及跨文件的相关代码。
24
+ - **理解代码结构。** 支持 Python、TypeScript、JavaScript 和 Go 的结构分析,其他语言、配置文件和脚本使用文本检索保底。
25
+ - **索引跟随代码更新。** 保存修改、删除文件和切换分支后自动同步。复用未变化的向量,更新未完成时保留完整的旧索引。
26
+ - **通过 MCP 跨项目使用。** 助手传入项目路径,按需启动并复用索引。`search_code` 检索代码证据,`index_status` 查看同步状态。
27
+
28
+ ## 评测结果
29
+
30
+ ![所需证据覆盖率与实测查询耗时](assets/benchmarks/method-comparison.svg)
31
+
32
+ **所需证据覆盖率 94.79% · 检索耗时中位数 1.73 秒 · 80 次查询中有 69 次覆盖全部所需证据。** 七种引擎、四个仓库,统一采用 4,000 token 的输出预算。在这组内部开发评测中,OpenContextEngine 保留的所需证据最多。
33
+
34
+ 评测使用可选的批量重排接口。共 40 个基于源码设计的任务,每个任务分别用中文和英文提问。覆盖率衡量源码证据的保留情况,不代表编程助手完成任务的成功率。开源工具记录原生检索耗时,ACE 记录 SDK 客户端调用耗时。[完整对比、配置和逐条查询结果 →](docs/eval/METHOD_COMPARISON.md)
35
+
36
+ ## 快速开始
37
+
38
+ 需要 **macOS 或 Linux**、Node.js 22.14+、Python 3.10+、Git,以及已配置好的向量和重排服务。分析 Go 仓库还需要 Go 1.22+。
39
+
40
+ 通过 npm 安装,展开你所用客户端的教程即可。同一台机器、同一用户下的多个客户端可以共用模型配置。下方链接的详细技术文档目前为英文。
41
+
42
+ <details open>
43
+ <summary><strong>Codex:安装、接入与搜索</strong></summary>
44
+
45
+ **1. 安装 CLI**
46
+
47
+ 已安装 Codex CLI 后,执行:
48
+
49
+ ```sh
50
+ npm install -g open-context-engine
51
+ ```
52
+
53
+ **2. 配置模型接口**
54
+
55
+ ```sh
56
+ open-context-engine setup
57
+ ```
58
+
59
+ 依次填写向量和重排服务的基础地址、API Key、模型名,以及向量维度。安装向导会自动安装隔离的 Python 依赖并保存配置。默认重排使用普通 `/rerank` 接口。[接口填写示例 →](docs/QUICKSTART.md#2-shared-model-configuration)
60
+
61
+ **3. 添加 MCP 服务**
62
+
63
+ ```sh
64
+ codex mcp add open-context-engine -- open-context-engine mcp
65
+ codex mcp get open-context-engine
66
+ ```
67
+
68
+ 第二条命令用于检查已保存的配置。以上命令要求客户端能通过 `PATH` 找到 `open-context-engine`。桌面端或源码安装请参考[绝对路径配置](docs/QUICKSTART.md#client-setup-notes)。添加后,重启正在运行的 Codex 客户端。
69
+
70
+ **4. 搜索项目代码**
71
+
72
+ ```sh
73
+ cd /path/to/your-project
74
+ codex
75
+ ```
76
+
77
+ 向 Codex 提问:
78
+
79
+ > 使用 open-context-engine 的 search_code 工具,解释当前项目的核心功能,并指出主要入口、相关文件路径和行号。
80
+
81
+ Codex 会通过 `directory_path` 传入项目的绝对路径。首次请求会启动索引;如果还在构建,让 Codex 调用 `index_status` 检查进度,待就绪后重试。后续搜索复用索引,保存代码后自动更新。
82
+
83
+ </details>
84
+
85
+ <details>
86
+ <summary><strong>Claude Code:安装、接入与搜索</strong></summary>
87
+
88
+ **1. 安装 CLI**
89
+
90
+ 已安装 Claude Code 后,执行:
91
+
92
+ ```sh
93
+ npm install -g open-context-engine
94
+ ```
95
+
96
+ **2. 配置模型接口**
97
+
98
+ ```sh
99
+ open-context-engine setup
100
+ ```
101
+
102
+ 依次填写向量和重排服务的基础地址、API Key、模型名,以及向量维度。安装向导会自动安装隔离的 Python 依赖并保存配置。如果已经为 Codex 完成配置,可以跳过这一步,直接复用。[接口填写示例 →](docs/QUICKSTART.md#2-shared-model-configuration)
103
+
104
+ **3. 添加 MCP 服务**
105
+
106
+ ```sh
107
+ claude mcp add --transport stdio --scope user open-context-engine -- open-context-engine mcp
108
+ ```
109
+
110
+ `--scope user` 让服务在你的各个项目中都可用。如果需要团队共用的项目级配置,在该项目目录运行命令,并将 `--scope user` 改为 `--scope project`。以上命令要求客户端能通过 `PATH` 找到 `open-context-engine`;绝对路径写法见[客户端配置说明](docs/QUICKSTART.md#client-setup-notes)。添加后,重启正在运行的 Claude Code 会话。
111
+
112
+ **4. 搜索项目代码**
113
+
114
+ ```sh
115
+ cd /path/to/your-project
116
+ claude
117
+ ```
118
+
119
+ 输入 `/mcp` 检查连接,然后提问:
120
+
121
+ > 使用 open-context-engine 的 search_code 工具,解释当前项目的核心功能,并指出主要入口、相关文件路径和行号。
122
+
123
+ Claude 会通过 `directory_path` 传入项目的绝对路径。首次请求会启动索引;如果还在构建,让 Claude 调用 `index_status` 检查进度,待就绪后重试。后续搜索复用索引,保存代码后自动更新。
124
+
125
+ </details>
126
+
127
+ <details>
128
+ <summary>其他 MCP 客户端</summary>
129
+
130
+ [安装并完成初始化](docs/QUICKSTART.md#1-install)后,运行 `open-context-engine mcp-config`,将输出配置转换为客户端支持的格式。对于接受 `mcpServers` JSON 且能通过 `PATH` 找到已安装命令的客户端,可以使用:
131
+
132
+ ```json
133
+ {
134
+ "mcpServers": {
135
+ "open-context-engine": {
136
+ "command": "open-context-engine",
137
+ "args": ["mcp"]
138
+ }
139
+ }
140
+ }
141
+ ```
142
+
143
+ 助手通过 `directory_path` 传入当前项目的绝对路径。如果只搜索固定项目,在 `args` 中追加 `"--root", "/absolute/path/to/your-repository"`。
144
+
145
+ </details>
146
+
147
+ [模型配置、问题排查和索引更新机制 →](docs/QUICKSTART.md)
148
+
149
+ ## 进一步了解
150
+
151
+ [评测报告](docs/BENCHMARKS.md) · [原始评测数据](docs/eval/results) · [检索引擎源码](src/retrieval)
152
+
153
+ ## 许可证
154
+
155
+ [MIT](LICENSE) © 2026 AnnaSuSu。
156
+
157
+ ## 致谢
158
+
159
+ 感谢 [LINUX DO](https://linux.do/) 社区。
@@ -6,10 +6,10 @@ OpenContextEngine runs a local repository index and calls configured model servi
6
6
 
7
7
  Requires Node.js 22.14+, Python 3.10+, and Git. Go source analysis also needs Go 1.22+ on `PATH`, or an explicit `OCE_GO_BINARY`.
8
8
 
9
- **First npm release in preparation; not yet published.** Install the archive supplied by the maintainer:
9
+ Install the package from npm:
10
10
 
11
11
  ```sh
12
- npm install -g /path/to/open-context-engine-0.1.0.tgz
12
+ npm install -g open-context-engine
13
13
  open-context-engine setup
14
14
  ```
15
15
 
@@ -24,7 +24,7 @@ npm ci
24
24
  node bin/opencontextengine.mjs setup
25
25
  ```
26
26
 
27
- After the first npm release, install with `npm install -g open-context-engine`, then run `open-context-engine setup`. Maintainers can build an archive with `npm pack`; see the [release checklist](https://github.com/AnnaSuSu/OpenContextEngine/blob/main/docs/RELEASING.md).
27
+ For internal builds, maintainers can create an archive with `npm pack` and install it with `npm install -g /path/to/open-context-engine-0.1.2.tgz`. See the [release checklist](https://github.com/AnnaSuSu/OpenContextEngine/blob/main/docs/RELEASING.md).
28
28
 
29
29
  The CLI and package are named `open-context-engine`. The previous `opencontextengine` command remains an alias. Existing configuration and cache directories keep their paths, so saved keys and indexes are reused.
30
30
 
@@ -40,14 +40,16 @@ For automation, set the following environment variables and run `open-context-en
40
40
  EMBEDDING_BASE_URL=https://your-embedding-service.example/v1
41
41
  EMBEDDING_API_KEY=your-embedding-key
42
42
  EMBEDDING_MODEL=Qwen3-Embedding-4B
43
- OCE_EMBEDDING_DIMENSIONS=1024
43
+ # Match the actual output size of your embedding endpoint.
44
+ OCE_EMBEDDING_DIMENSIONS=2560
44
45
 
45
46
  RERANK_BASE_URL=https://your-reranker-service.example/v1
46
47
  RERANK_API_KEY=your-reranker-key
47
48
  RERANK_MODEL=Qwen3-Reranker-4B
48
- OCE_RERANK_API=rerank
49
49
  ```
50
50
 
51
+ The setup prompt initially suggests `1024` dimensions; replace it with your endpoint's actual output size. The example above uses `2560`.
52
+
51
53
  The embedding service must implement `POST /v1/embeddings`. By default, the reranker uses the ordinary `/rerank` API: requests contain `model`, `query`, `documents`, and `top_n`; responses must return every requested document in `results`, with its original `index` and a finite `relevance_score` between 0 and 1. Results may arrive in relevance order. Set the reranker base URL to the part before `/rerank`: for example, `https://provider.example/v1`, `/v2`, or `https://provider.example` for an unversioned endpoint.
52
54
 
53
55
  HTTPS is the default. For an explicitly trusted remote HTTP deployment, set `OCE_ALLOW_HTTP=1` before running `open-context-engine setup`; setup saves this choice in the shared configuration. HTTP transmits API keys and source text without encryption. Local model endpoints remain prohibited. Set `OCE_EMBEDDING_DIMENSIONS` to the service's actual output size (for example, `2560`); changing the provider or dimensions creates a new index generation and does not mix incompatible cached vectors.
@@ -71,11 +73,11 @@ Then start the CLI with these overrides, or save them with `setup --non-interact
71
73
  ```dotenv
72
74
  EMBEDDING_SSH_TUNNEL_URL=http://127.0.0.1:43079/v1
73
75
  EMBEDDING_SSH_REMOTE=operator@model-host.example:22
74
- RERANK_SSH_TUNNEL_URL=http://127.0.0.1:43078
76
+ RERANK_SSH_TUNNEL_URL=http://127.0.0.1:43078/v1
75
77
  RERANK_SSH_REMOTE=operator@model-host.example:22
76
78
  ```
77
79
 
78
- The rerank tunnel must preserve the configured base URL's path prefix (for example, `/v1` if required). Keep the SSH process running while using MCP. The CLI does not create SSH sessions or store SSH passwords, and a disconnected tunnel surfaces an error instead of falling back to public HTTP. Models continue to run on the remote server.
80
+ The rerank tunnel must preserve the configured base URL's path prefix. The example above matches `RERANK_BASE_URL=https://your-reranker-service.example/v1`; if your provider uses an unversioned `/rerank` endpoint, omit `/v1` from both base URLs. Keep the SSH process running while using MCP. The CLI does not create SSH sessions or store SSH passwords, and a disconnected tunnel surfaces an error instead of falling back to public HTTP. Models continue to run on the remote server.
79
81
 
80
82
  ## 3. Add the MCP server
81
83
 
@@ -144,7 +146,7 @@ Client references: [Codex MCP](https://developers.openai.com/codex/mcp) · [Clau
144
146
 
145
147
  ## Updates & storage
146
148
 
147
- Saved files are checked every second by default, with a 300 ms debounce. New files, deletions, renames, and branch changes update the index automatically. Embeddings are reused by model identity and actual input content. Structural analysis conservatively refreshes the affected language group to update references in unchanged files.
149
+ Saved files are checked every second by default (`OCE_POLL_SECONDS=1`), with a 300 ms debounce (`OCE_DEBOUNCE_SECONDS=0.3`). New files, deletions, renames, and branch changes update the index automatically. Embeddings are reused by model identity and actual input content. Structural analysis conservatively refreshes the affected language group to update references in unchanged files.
148
150
 
149
151
  Search actively checks source hashes before retrieval and again before returning. It waits up to 30 seconds for synchronization (`freshnessWaitMs`, maximum 120 seconds). Failed updates, timeouts, or edits during retrieval produce explicit errors. Unsaved editor buffers are not indexed.
150
152
 
@@ -152,6 +154,8 @@ State is stored in `~/.cache/opencontextengine/<repository-path-hash>/`. Overrid
152
154
 
153
155
  When model weights change under the same name, increment `OCE_EMBEDDING_REVISION`. A different provider, model name, or dimension count also invalidates vector reuse. Other models need separate compatibility and quality validation.
154
156
 
157
+ Optional Go type analysis can be enabled with `OCE_LANGUAGE_OPTIONS='{"go":{"mode":"types"}}'`; the default uses syntax-based analysis. `OCE_PYTHON` selects an existing Python environment with the required dependencies; normal CLI installations use the runtime created by setup.
158
+
155
159
  ## Share one worker across clients
156
160
 
157
161
  This optional source-installation workflow shares a running worker, in addition to the shared model configuration available to all CLI installations. Set an `OCE_API_KEY` of at least 24 characters in the environment, then run from the checkout:
@@ -168,10 +172,10 @@ Run `open-context-engine doctor` to check model configuration, Python dependenci
168
172
 
169
173
  If upgrading from the old package named `opencontextengine`, first run `npm uninstall -g opencontextengine` to avoid a command-name conflict. This leaves your saved model settings and indexes intact.
170
174
 
171
- For an internal upgrade, install the new archive and rerun setup:
175
+ To upgrade from npm and reuse your saved settings:
172
176
 
173
177
  ```sh
174
- npm install -g /path/to/new-open-context-engine.tgz
178
+ npm install -g open-context-engine@latest
175
179
  open-context-engine setup
176
180
  ```
177
181
 
@@ -179,13 +183,13 @@ Press Enter to retain saved settings. Setup reuses a healthy managed Python runt
179
183
 
180
184
  First-time setup requires network access to npm/PyPI and tokenizer data. If Python is missing or lacks `venv`/`pip`, install Python 3.10+ with those components, then rerun setup. The CLI does not install system Node, Python, Git, or Go.
181
185
 
182
- ## Internal testing checklist
186
+ ## Installation verification
183
187
 
184
- 1. Install the supplied tarball on macOS or Linux and run setup with your model endpoints.
188
+ 1. Install from npm (or an internal tarball) on macOS or Linux and run setup with your model endpoints.
185
189
  2. Paste the generated MCP configuration into your client, restart it, and search a small project.
186
190
  3. Save an edit, add a file, and delete a file; verify search returns current source.
187
191
  4. Switch to another project and back; verify the results belong to the requested project.
188
- 5. Restart the client and reinstall the archive; verify model settings and compatible indexes are retained.
192
+ 5. Restart the client and reinstall the package; verify model settings and compatible indexes are retained.
189
193
 
190
194
  For issues, include the CLI version, operating system, client name, and the error message. Keep API keys and private source code out of reports.
191
195
 
@@ -6,6 +6,8 @@ The published benchmarks used Qwen3-Reranker-4B with an optional batch API. Its
6
6
 
7
7
  ## API modes
8
8
 
9
+ The paths below belong to this reference server. For another provider, OpenContextEngine appends `/rerank` to `RERANK_BASE_URL`; a `/v1` prefix is only needed if that provider requires it.
10
+
9
11
  | Mode | Endpoint | Request | Response |
10
12
  | --- | --- | --- | --- |
11
13
  | Default | `POST /v1/rerank` | `model`, `query`, `documents`, `top_n` | `results` with original document `index` and `relevance_score` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-context-engine",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22.14"
@@ -36,6 +36,7 @@
36
36
  "linux"
37
37
  ],
38
38
  "files": [
39
+ "README.zh-CN.md",
39
40
  "bin/",
40
41
  "src/config.mjs",
41
42
  "src/environment.mjs",
@@ -77,5 +78,7 @@
77
78
  "publishConfig": {
78
79
  "access": "public",
79
80
  "registry": "https://registry.npmjs.org/"
80
- }
81
+ },
82
+ "readme": "<div align=\"center\">\n <picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"assets/brand/logo-lockup-dark.svg\">\n <img src=\"assets/brand/logo-lockup.svg\" alt=\"OpenContextEngine\" width=\"660\">\n </picture>\n <p><strong>Precise code context for AI coding agents.</strong></p>\n <p>Find related code across files. Follow its connections. Give your agent the evidence it needs.</p>\n <p>\n <a href=\"docs/BENCHMARKS.md#seven-method-comparison\"><img src=\"https://img.shields.io/badge/dev_evidence_coverage-94.79%25-23875b?style=flat-square\" alt=\"Development evidence coverage: 94.79%\"></a>\n <a href=\"docs/BENCHMARKS.md#seven-method-comparison\"><img src=\"https://img.shields.io/badge/median_retrieval-1.73_s-23875b?style=flat-square\" alt=\"Median retrieval: 1.73 seconds\"></a>\n <a href=\"docs/BENCHMARKS.md#engineering-validation\"><img src=\"https://img.shields.io/badge/verified_tests-107-23875b?style=flat-square\" alt=\"107 verified tests\"></a>\n <a href=\"docs/QUICKSTART.md\"><img src=\"https://img.shields.io/badge/MCP-stdio-193c34?style=flat-square\" alt=\"MCP over stdio\"></a>\n </p>\n <p><a href=\"#quick-start\">Quick start</a> · <a href=\"docs/BENCHMARKS.md\">Benchmarks</a> · <a href=\"docs/QUICKSTART.md\">MCP setup</a> · <strong>English</strong> | <a href=\"README.zh-CN.md\">简体中文</a></p>\n</div>\n\nOpenContextEngine is a **self-hostable code context engine for AI coding agents**. Connect it to your agent through MCP to help it explore an unfamiliar codebase, locate implementations, and find the related code needed for a fix or feature.\n\nIt indexes your working directory and follows saved changes. Given a natural-language task, it combines semantic and keyword search, code relationships, and reranking to return relevant source snippets with file paths and line numbers, within a fixed context budget.\n\n## Why OpenContextEngine\n\n- **Search beyond exact words.** Describe a behavior; retrieve its implementation and connected code across files.\n- **Understand code structure.** Python, TypeScript, JavaScript, and Go adapters, plus text fallback for other languages, configuration, and scripts.\n- **Stay current as you edit.** Saved changes, file deletions, and branch switches sync automatically. Unchanged embeddings are reused; incomplete updates never replace a complete index.\n- **Work across projects through MCP.** Your agent supplies the project path; indexes start on demand and are reused. `search_code` retrieves evidence; `index_status` reports synchronization.\n\n## Measured results\n\n![Required evidence coverage and observed query time](assets/benchmarks/method-comparison.svg)\n\n**94.79% required evidence coverage · 1.73 s median retrieval · 69/80 queries with complete evidence.** Seven engines, four repositories, the same 4,000-token output budget. OpenContextEngine retained the most required evidence in this internal development evaluation.\n\nMeasured with the optional batch rerank API. 40 source-derived tasks, each asked in Chinese and English. Coverage measures source evidence, not coding-agent success. Timings reflect native retrieval for open tools and SDK client calls for ACE. [Full comparison, configurations, and per-query results →](docs/eval/METHOD_COMPARISON.md)\n\n## Quick start\n\nRequires **macOS or Linux**, Node.js 22.14+, Python 3.10+, Git, and configured embedding/reranking services. Go repositories also need Go 1.22+.\n\nInstall from npm, then expand your client's guide. Model settings are shared across clients on the same machine.\n\n<details open>\n<summary><strong>Codex — install, connect, and search</strong></summary>\n\n**1. Install the CLI**\n\nWith Codex CLI already installed, run:\n\n```sh\nnpm install -g open-context-engine\n```\n\n**2. Configure your models**\n\n```sh\nopen-context-engine setup\n```\n\nEnter your embedding and reranking base URLs, API keys, model names, and embedding dimensions. Setup installs isolated Python dependencies and saves your settings. The default reranker uses the ordinary `/rerank` API. [Endpoint examples →](docs/QUICKSTART.md#2-shared-model-configuration)\n\n**3. Add the MCP server**\n\n```sh\ncodex mcp add open-context-engine -- open-context-engine mcp\ncodex mcp get open-context-engine\n```\n\nThe second command checks the saved configuration. These commands assume `open-context-engine` is on the client's `PATH`. For the desktop app or source installations, use the [absolute-path configuration](docs/QUICKSTART.md#client-setup-notes). Restart an already-running Codex client after adding the server.\n\n**4. Search your project**\n\n```sh\ncd /path/to/your-project\ncodex\n```\n\nAsk:\n\n> Use open-context-engine's search_code tool to explain this project's main functionality. Include the entry points and relevant file paths and line numbers.\n\nCodex supplies the project's absolute path as `directory_path`. The first request starts indexing; if it is still building, ask Codex to check `index_status` and retry when ready. Later searches reuse the index, and saved changes update automatically.\n\n</details>\n\n<details>\n<summary><strong>Claude Code — install, connect, and search</strong></summary>\n\n**1. Install the CLI**\n\nWith Claude Code already installed, run:\n\n```sh\nnpm install -g open-context-engine\n```\n\n**2. Configure your models**\n\n```sh\nopen-context-engine setup\n```\n\nEnter your embedding and reranking base URLs, API keys, model names, and embedding dimensions. Setup installs isolated Python dependencies and saves your settings. If you already completed setup for Codex, reuse those settings and skip this step. [Endpoint examples →](docs/QUICKSTART.md#2-shared-model-configuration)\n\n**3. Add the MCP server**\n\n```sh\nclaude mcp add --transport stdio --scope user open-context-engine -- open-context-engine mcp\n```\n\nUser scope makes the server available across your projects. For a shared project configuration, run the command from that project and replace `--scope user` with `--scope project`. These commands assume `open-context-engine` is on the client's `PATH`; see [client setup notes](docs/QUICKSTART.md#client-setup-notes) for absolute paths. Restart an already-running Claude Code session after adding the server.\n\n**4. Search your project**\n\n```sh\ncd /path/to/your-project\nclaude\n```\n\nRun `/mcp` to check the connection, then ask:\n\n> Use open-context-engine's search_code tool to explain this project's main functionality. Include the entry points and relevant file paths and line numbers.\n\nClaude supplies the project's absolute path as `directory_path`. The first request starts indexing; if it is still building, ask Claude to check `index_status` and retry when ready. Later searches reuse the index, and saved changes update automatically.\n\n</details>\n\n<details>\n<summary>Other MCP clients</summary>\n\n[Install and run setup](docs/QUICKSTART.md#1-install), then use the configuration printed by `open-context-engine mcp-config` in your client's supported format. For clients that accept `mcpServers` JSON and can find the installed command on `PATH`:\n\n```json\n{\n \"mcpServers\": {\n \"open-context-engine\": {\n \"command\": \"open-context-engine\",\n \"args\": [\"mcp\"]\n }\n }\n}\n```\n\nYour agent supplies the current project's absolute path as `directory_path`. To pin one project, add `\"--root\", \"/absolute/path/to/your-repository\"` to `args`.\n\n</details>\n\n[Model configuration, troubleshooting, and update behavior →](docs/QUICKSTART.md)\n\n## Explore\n\n[Benchmark report](docs/BENCHMARKS.md) · [Raw evaluations](docs/eval/results) · [Retrieval engine](src/retrieval)\n\n## License\n\n[MIT](LICENSE) © 2026 AnnaSuSu.\n\n## Acknowledgments\n\nThanks to the [LINUX DO](https://linux.do/) community.\n",
83
+ "readmeFilename": "README.md"
81
84
  }
package/src/mcp.mjs CHANGED
@@ -15,7 +15,7 @@ export function createMcpServer(config, {resolveConfig, automatic = false} = {})
15
15
  }
16
16
  const pathSchema = z.string().min(1).describe('Absolute path to the project directory. Required in automatic workspace mode.');
17
17
  const directoryPath = automatic ? pathSchema : pathSchema.optional();
18
- const server = new McpServer({name:'open-context-engine',version:'0.1.0'}, {
18
+ const server = new McpServer({name:'open-context-engine',version:'0.1.2'}, {
19
19
  instructions:workspaceInstructions + 'Search for source evidence. Results include source paths and line numbers. '
20
20
  + 'Search waits for saved file changes to be indexed. If an update is pending or fails, inspect index_status and retry after it completes. '
21
21
  + 'Read target files again before editing, because code may change after a search.',