semcode-mcp 0.1.0__tar.gz
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.
- semcode_mcp-0.1.0/.env.example +49 -0
- semcode_mcp-0.1.0/.gitignore +28 -0
- semcode_mcp-0.1.0/LICENSE +21 -0
- semcode_mcp-0.1.0/PKG-INFO +272 -0
- semcode_mcp-0.1.0/README.md +225 -0
- semcode_mcp-0.1.0/npm/README.md +23 -0
- semcode_mcp-0.1.0/pyproject.toml +65 -0
- semcode_mcp-0.1.0/src/semantic_code_mcp/__init__.py +3 -0
- semcode_mcp-0.1.0/src/semantic_code_mcp/chunker.py +399 -0
- semcode_mcp-0.1.0/src/semantic_code_mcp/embedder.py +192 -0
- semcode_mcp-0.1.0/src/semantic_code_mcp/expander.py +114 -0
- semcode_mcp-0.1.0/src/semantic_code_mcp/indexer.py +416 -0
- semcode_mcp-0.1.0/src/semantic_code_mcp/retriever.py +705 -0
- semcode_mcp-0.1.0/src/semantic_code_mcp/server.py +284 -0
- semcode_mcp-0.1.0/src/semantic_code_mcp/store.py +488 -0
- semcode_mcp-0.1.0/src/semantic_code_mcp/watcher.py +156 -0
- semcode_mcp-0.1.0/src/semantic_code_mcp/workspace.py +218 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# ============================================================
|
|
2
|
+
# semantic-code-mcp 环境变量配置
|
|
3
|
+
# 复制本文件为 .env 并填入真实 key
|
|
4
|
+
# ============================================================
|
|
5
|
+
|
|
6
|
+
# Voyage AI - embedding + rerank(必需,同一个 key 双用)
|
|
7
|
+
# 申请地址:https://dash.voyageai.com/
|
|
8
|
+
VOYAGE_API_KEY=your-voyage-api-key
|
|
9
|
+
|
|
10
|
+
# Cohere - 可选 rerank 后备后端(默认用 Voyage rerank-2.5,无需此 key)
|
|
11
|
+
# 申请地址:https://dashboard.cohere.com/api-keys
|
|
12
|
+
COHERE_API_KEY=
|
|
13
|
+
|
|
14
|
+
# ------------------------------------------------------------
|
|
15
|
+
# 以下为可选高级配置(有合理默认值,一般无需改动)
|
|
16
|
+
# ------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
# Embedding 模型(默认 voyage-code-3,代码专用)
|
|
19
|
+
# SCM_EMBED_MODEL=voyage-code-3
|
|
20
|
+
|
|
21
|
+
# Rerank 后端:auto(默认,有 VOYAGE key 用 Voyage,其次 Cohere)/ voyage / cohere / off
|
|
22
|
+
# SCM_RERANK_BACKEND=auto
|
|
23
|
+
|
|
24
|
+
# Rerank 模型(默认按后端:voyage → rerank-2.5,cohere → rerank-v3.5)
|
|
25
|
+
# SCM_RERANK_MODEL=
|
|
26
|
+
|
|
27
|
+
# 索引数据库存放目录(默认 ~/.semantic-code-mcp)
|
|
28
|
+
# SCM_DB_DIR=
|
|
29
|
+
|
|
30
|
+
# 向量召回数量(默认 50,rerank 前的候选数)
|
|
31
|
+
# SCM_TOP_K=50
|
|
32
|
+
|
|
33
|
+
# 最终返回结果数(默认 10)
|
|
34
|
+
# SCM_TOP_N=10
|
|
35
|
+
|
|
36
|
+
# 向量精度:float(默认,最高精度)/ int8(省 71% 存储,精度 95% 一致)
|
|
37
|
+
# SCM_EMBED_DTYPE=float
|
|
38
|
+
|
|
39
|
+
# API 限流/错误自动重试次数(默认 4)
|
|
40
|
+
# SCM_EMBED_MAX_RETRIES=4
|
|
41
|
+
|
|
42
|
+
# 请求最小间隔秒数(Voyage 未绑卡受 3 RPM 限制时设为 21)
|
|
43
|
+
# SCM_EMBED_MIN_INTERVAL=0
|
|
44
|
+
|
|
45
|
+
# 单批最大累计字符(约对应 token 上限;未绑卡时可调小)
|
|
46
|
+
# SCM_EMBED_CHAR_BUDGET=200000
|
|
47
|
+
|
|
48
|
+
# 代理(Cohere API 国内需走代理)
|
|
49
|
+
# HTTPS_PROXY=http://127.0.0.1:7897
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# 敏感配置 - 含 API key,禁止提交
|
|
2
|
+
.env
|
|
3
|
+
|
|
4
|
+
# Python
|
|
5
|
+
__pycache__/
|
|
6
|
+
*.pyc
|
|
7
|
+
*.pyo
|
|
8
|
+
|
|
9
|
+
# 本地索引库
|
|
10
|
+
*.db
|
|
11
|
+
.semantic-code-mcp/
|
|
12
|
+
|
|
13
|
+
# 本地资料存档
|
|
14
|
+
*.html
|
|
15
|
+
*_files/
|
|
16
|
+
scm_e2e_*/
|
|
17
|
+
|
|
18
|
+
# 本地私有探针集(含内部仓库信息,不随仓库分发)
|
|
19
|
+
eval_local_probes.py
|
|
20
|
+
|
|
21
|
+
# 评测输出
|
|
22
|
+
eval_result_scm.json
|
|
23
|
+
|
|
24
|
+
# 临时探针脚本
|
|
25
|
+
_probe*.py
|
|
26
|
+
|
|
27
|
+
dist/
|
|
28
|
+
*.egg-info/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 semantic-code-mcp contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: semcode-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Semantic code search MCP server: Tree-sitter AST chunking + voyage-code-3 embeddings + hybrid retrieval (sqlite-vec + FTS5 + RRF) + Voyage rerank-2.5 + call graph expansion
|
|
5
|
+
Project-URL: Homepage, https://github.com/huawang1258/semantic-code-mcp
|
|
6
|
+
Project-URL: Repository, https://github.com/huawang1258/semantic-code-mcp
|
|
7
|
+
Project-URL: Issues, https://github.com/huawang1258/semantic-code-mcp/issues
|
|
8
|
+
Author: huawang1258
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: code-search,embeddings,mcp,rag,semantic-search,tree-sitter
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: cohere>=5.13.0
|
|
23
|
+
Requires-Dist: mcp>=1.2.0
|
|
24
|
+
Requires-Dist: numpy>=1.26.0
|
|
25
|
+
Requires-Dist: pathspec>=0.12.0
|
|
26
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
27
|
+
Requires-Dist: requests>=2.31.0
|
|
28
|
+
Requires-Dist: sqlite-vec>=0.1.6
|
|
29
|
+
Requires-Dist: tree-sitter-bash>=0.23.0
|
|
30
|
+
Requires-Dist: tree-sitter-c-sharp>=0.23.0
|
|
31
|
+
Requires-Dist: tree-sitter-c>=0.23.0
|
|
32
|
+
Requires-Dist: tree-sitter-cpp>=0.23.0
|
|
33
|
+
Requires-Dist: tree-sitter-go>=0.23.0
|
|
34
|
+
Requires-Dist: tree-sitter-java>=0.23.0
|
|
35
|
+
Requires-Dist: tree-sitter-javascript>=0.23.0
|
|
36
|
+
Requires-Dist: tree-sitter-php>=0.23.0
|
|
37
|
+
Requires-Dist: tree-sitter-python>=0.23.0
|
|
38
|
+
Requires-Dist: tree-sitter-ruby>=0.23.0
|
|
39
|
+
Requires-Dist: tree-sitter-rust>=0.23.0
|
|
40
|
+
Requires-Dist: tree-sitter-typescript>=0.23.0
|
|
41
|
+
Requires-Dist: tree-sitter>=0.23.0
|
|
42
|
+
Requires-Dist: voyageai>=0.3.0
|
|
43
|
+
Requires-Dist: watchdog>=4.0.0
|
|
44
|
+
Provides-Extra: local
|
|
45
|
+
Requires-Dist: sentence-transformers>=3.0.0; extra == 'local'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# semantic-code-mcp
|
|
49
|
+
|
|
50
|
+
自建代码语义检索 MCP Server —— 自然语言查询 → 相关代码片段。
|
|
51
|
+
|
|
52
|
+
「效果优先」技术栈:**Tree-sitter AST 切分 + voyage-code-3 embedding(int8 量化)+ sqlite-vec 向量库 + BM25 全文 + RRF 融合 + Voyage rerank-2.5 重排 + Call Graph 图扩展**。一个 `VOYAGE_API_KEY` 跑通 embedding + rerank 全链路。
|
|
53
|
+
|
|
54
|
+
工程特性:**watchdog 文件实时监控 + 多工作区 LRU 管理 + MCP progress notification + cancel signal**。
|
|
55
|
+
|
|
56
|
+
## 架构
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
codebase_search(query, dir)
|
|
60
|
+
│
|
|
61
|
+
▼
|
|
62
|
+
WorkspaceManager ── LRU(max 8) ── FileWatcher(watchdog + 2s debounce)
|
|
63
|
+
│
|
|
64
|
+
▼
|
|
65
|
+
Indexer ── 全量扫描/watcher增量(O(变更数)) ── Chunker(Tree-sitter AST) ── Embedder(voyage-code-3)
|
|
66
|
+
│ │
|
|
67
|
+
│ Store(sqlite-vec + FTS5 + 文件hash)
|
|
68
|
+
▼
|
|
69
|
+
Retriever ── 向量召回 + BM25召回 ── RRF融合 ── rerank(Voyage/Cohere)── Call Graph扩展 ── top_n 代码片段
|
|
70
|
+
│
|
|
71
|
+
▼
|
|
72
|
+
MCP Server ── async tools + progress notification + cancel signal
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
| 模块 | 职责 |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `chunker.py` | Tree-sitter 按函数/类切分(16 语言 + md/yaml/json 等文档配置按行切),提取调用关系构建 call graph |
|
|
78
|
+
| `store.py` | sqlite-vec 向量(float/int8)+ FTS5 全文 + 文件指纹 + call graph 边表 |
|
|
79
|
+
| `embedder.py` | voyage-code-3,document/query 双模式,int8 量化,限流重试 |
|
|
80
|
+
| `retriever.py` | 向量 + BM25 → RRF → rerank → 意图感知打分(测试/文档/调用链意图)→ 文件多样性截断 → 图扩展 |
|
|
81
|
+
| `indexer.py` | 目录扫描 + 文件 hash 增量同步 + watcher dirty 增量同步 |
|
|
82
|
+
| `watcher.py` | watchdog 文件监控 + 2s debounce + 50 变更立即 flush |
|
|
83
|
+
| `workspace.py` | 多工作区 LRU 管理器(创建/淘汰/状态追踪) |
|
|
84
|
+
| `server.py` | MCP 封装,async 工具 + progress + cancel + WorkspaceManager |
|
|
85
|
+
|
|
86
|
+
## 安装
|
|
87
|
+
|
|
88
|
+
发布包名为 `semcode-mcp`(PyPI 上 `semantic-code-mcp` 已被同名项目占用):
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# 方式一(推荐):uv 环境零安装,MCP 客户端配置里直接 uvx 启动
|
|
92
|
+
uvx semcode-mcp
|
|
93
|
+
|
|
94
|
+
# 方式二:npx(要求已装 uv,该 npm 包是透传 uvx 的薄壳)
|
|
95
|
+
npx -y semcode-mcp
|
|
96
|
+
|
|
97
|
+
# 方式三:pip
|
|
98
|
+
pip install semcode-mcp
|
|
99
|
+
|
|
100
|
+
# 源码开发
|
|
101
|
+
pip install -e .
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## 配置
|
|
105
|
+
|
|
106
|
+
复制 `.env.example` 为 `.env` 并填入 key:
|
|
107
|
+
|
|
108
|
+
| 变量 | 必需 | 说明 |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| `VOYAGE_API_KEY` | 是 | Voyage embedding + rerank(同一个 key 双用),申请:https://dash.voyageai.com/ |
|
|
111
|
+
| `COHERE_API_KEY` | 否 | 可选 rerank 后备后端;默认用 Voyage rerank-2.5,无需此 key |
|
|
112
|
+
|
|
113
|
+
### 高级配置
|
|
114
|
+
|
|
115
|
+
| 变量 | 默认值 | 说明 |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| `SCM_EMBED_MODEL` | `voyage-code-3` | Embedding 模型 |
|
|
118
|
+
| `SCM_EMBED_DTYPE` | `float` | 向量精度:`float`(最高精度)/ `int8`(省 71% 存储) |
|
|
119
|
+
| `SCM_EMBED_MAX_RETRIES` | `4` | API 限流/错误时自动重试次数 |
|
|
120
|
+
| `SCM_EMBED_MIN_INTERVAL` | `0` | 请求最小间隔秒数(未绑卡 3 RPM 限制时设 `21`) |
|
|
121
|
+
| `SCM_EMBED_CONCURRENCY` | voyage `3` / local `1` | 索引时 embedding 并发请求数(实测 3 路≈提速 3 倍) |
|
|
122
|
+
| `SCM_EMBED_CHAR_BUDGET` | `200000` | 单批最大字符数(未绑卡时可调小) |
|
|
123
|
+
| `SCM_RERANK_BACKEND` | `auto` | rerank 后端:`auto`(有 VOYAGE key 用 Voyage,其次 Cohere)/ `voyage` / `cohere` / `off` |
|
|
124
|
+
| `SCM_RERANK_MODEL` | 按后端 | voyage → `rerank-2.5`,cohere → `rerank-v3.5` |
|
|
125
|
+
| `SCM_DB_DIR` | `~/.semantic-code-mcp` | 索引数据库存放目录 |
|
|
126
|
+
| `SCM_TOP_K` | `50` | 向量召回候选数 |
|
|
127
|
+
| `SCM_TOP_N` | `10` | 最终返回结果数 |
|
|
128
|
+
| `HTTPS_PROXY` | — | Cohere API 代理(国内需配) |
|
|
129
|
+
| `SCM_MAX_WORKSPACES` | `8` | 最大同时管理的工作区数(LRU 淘汰) |
|
|
130
|
+
| `SCM_WATCH` | `1` | 文件监控:`1` 启用(默认),`0` 禁用 |
|
|
131
|
+
|
|
132
|
+
## 在 MCP 客户端注册
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"mcpServers": {
|
|
137
|
+
"semantic-code": {
|
|
138
|
+
"command": "uvx",
|
|
139
|
+
"args": ["semcode-mcp"],
|
|
140
|
+
"env": {
|
|
141
|
+
"VOYAGE_API_KEY": "your-voyage-key"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
npx 用法把 `command/args` 换成 `"npx", ["-y", "semcode-mcp"]`;
|
|
149
|
+
源码开发用 `pip install -e .` 后配 `"semcode-mcp", []`(包采用相对 import,
|
|
150
|
+
不支持 `python server.py` 直接跑,需用 console script 或 `python -m semantic_code_mcp.server`)。
|
|
151
|
+
|
|
152
|
+
## 工具
|
|
153
|
+
|
|
154
|
+
### codebase_search
|
|
155
|
+
|
|
156
|
+
| 参数 | 类型 | 说明 |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| `information_request` | string | 自然语言查询,如"用户登录鉴权逻辑在哪里" |
|
|
159
|
+
| `directory_path` | string | 代码库绝对路径 |
|
|
160
|
+
|
|
161
|
+
唯一工具,首次调用自动全量索引,之后 watcher 驱动增量同步(O(变更数),极速)。支持 MCP progress notification 实时回报索引进度。需要强制重建索引时删除 `~/.semantic-code-mcp/` 下对应 `.db` 文件即可。
|
|
162
|
+
|
|
163
|
+
## 工作原理
|
|
164
|
+
|
|
165
|
+
1. **切分**:Tree-sitter 解析 AST,按函数/类边界切块,保留 `file_path / symbol / 行号` 元数据。
|
|
166
|
+
2. **向量化**:voyage-code-3 对代码块生成 1024 维向量(`input_type=document`)。
|
|
167
|
+
3. **存储**:向量入 sqlite-vec(vec0 虚拟表),同时入 FTS5 全文索引;`blob_hash = SHA256(path+code)` 实现内容寻址去重。
|
|
168
|
+
4. **检索**:查询同时走向量 KNN 与 BM25,用 RRF 融合排名,再用 rerank(默认 Voyage rerank-2.5)精排出 top_n。
|
|
169
|
+
5. **图扩展**:主结果沿 call graph 扩展 1 跳,把调用者/被调用者连带召回(附 `relation` 标记)。
|
|
170
|
+
6. **实时监控**:watchdog 监控文件变更(2s debounce),**后台主动增量同步**(O(变更数)),查询时零等待;后台失败不丢变更,下次查询前兜底。
|
|
171
|
+
7. **LRU 管理**:多工作区并发(最多 8 个),超限自动淘汰最久未用的 workspace。
|
|
172
|
+
|
|
173
|
+
## 索引存储
|
|
174
|
+
|
|
175
|
+
每个工作区按目录路径哈希存为 `~/.semantic-code-mcp/<hash>.db`(可用 `SCM_DB_DIR` 改)。删除该目录即清空所有索引。
|
|
176
|
+
|
|
177
|
+
## 隐私与数据边界
|
|
178
|
+
|
|
179
|
+
本工具的完整数据流向,用于评估能否用于敏感/闭源仓库:
|
|
180
|
+
|
|
181
|
+
### 会出网的数据(默认配置)
|
|
182
|
+
|
|
183
|
+
| 接收方 | 发送内容 | 时机 |
|
|
184
|
+
|---|---|---|
|
|
185
|
+
| Voyage AI | 代码块全文(embedding + rerank 候选)+ 查询文本 | 索引时 + 每次检索 |
|
|
186
|
+
| Cohere(可选后端) | 查询文本 + top-50 候选代码块全文 | 仅 `SCM_RERANK_BACKEND=cohere` 时;默认零发送 |
|
|
187
|
+
| 自配 LLM 端点(可选,默认关) | 仅查询文本(不含代码) | `SCM_QUERY_EXPANSION=on` 时 |
|
|
188
|
+
|
|
189
|
+
供应商对 API 数据的保留/训练策略请以其当前条款为准自行评估(Voyage/Cohere 均声明 API 数据默认不用于训练,本项目不替其背书)。
|
|
190
|
+
|
|
191
|
+
### 始终留在本地的
|
|
192
|
+
|
|
193
|
+
- 索引库全部落盘本机 `~/.semantic-code-mcp/`(向量 + 代码原文 + call graph),不上传任何服务
|
|
194
|
+
- 无遥测、无统计上报,除上表 API 外零网络请求
|
|
195
|
+
|
|
196
|
+
### 索引范围控制
|
|
197
|
+
|
|
198
|
+
- 全层级遵守 `.gitignore`(含否定模式):`.env`、构建产物等被忽略的文件不会进索引
|
|
199
|
+
- 例外:`AGENTS.md`/`.windsurfrules` 等 agent 指导文件即使被 gitignore 也会索引(有意设计,它们对检索架构问题价值极高)
|
|
200
|
+
- ⚠️ **硬编码在代码里的密钥会随代码块发往上表供应商**,敏感仓库索引前请先清理或用全本地模式
|
|
201
|
+
|
|
202
|
+
### 全本地模式(代码零出网)
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
pip install sentence-transformers
|
|
206
|
+
SCM_EMBED_BACKEND=local # 本地 embedding(默认 Qwen/Qwen3-Embedding-0.6B)
|
|
207
|
+
# 不配 COHERE_API_KEY # rerank 自动跳过,用 RRF 融合排序
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
检索质量会下降(参考公开评测中自托管 0.6B 方案的差距),但数据完全不离开本机。
|
|
211
|
+
|
|
212
|
+
## 路线
|
|
213
|
+
|
|
214
|
+
- **阶段 1** ✅:Tree-sitter + voyage-code-3 + hybrid + rerank —— 第一梯队 RAG
|
|
215
|
+
- **阶段 2** ✅:Call Graph 图扩展(caller/callee 连带召回)+ int8 量化向量(存储省 71%,一致率 95%)
|
|
216
|
+
- **阶段 3** ✅:工程化 —— watchdog 文件监控 + 多工作区 LRU + progress + cancel
|
|
217
|
+
- **阶段 4** ✅(部分):意图感知排序(调用链直查 edges / 测试意图 / 文档意图)+ 文档配置索引(AGENTS.md 豁免 gitignore)+ 50 条分类评测集
|
|
218
|
+
- **阶段 5** ✅:单工具化 + 后台主动增量同步 + 分阶段进度条日志 + Java 调用链(接收者边/构造类型名/泛型剥离)+ 配置意图(yaml 反转 boost)
|
|
219
|
+
+ 并发 embedding 流水线(worker 只跑网络调用,sqlite 写回留在调用线程,顺序写回;CLIProxyAPI 9067 块全量 77s,≈串行 3 倍)
|
|
220
|
+
- **HyDE 已评测,结论默认关**:Top-1 86%→82%、延迟 2.9s→10.4s、Recall@5 98%→100%;架构类 +40 分但配置/SDK 类 -40(变体稀释精确标识符信号)。
|
|
221
|
+
改进线:选择性扩展——仅对不含精确标识符的模糊查询开 HyDE
|
|
222
|
+
- **后续候选**:选择性 HyDE、本地后端对照评测、超大仓库 ANN 索引
|
|
223
|
+
|
|
224
|
+
## 评测(eval_golden.py,CLIProxyAPI 778 文件 / 9067 块)
|
|
225
|
+
|
|
226
|
+
50 条 query × 10 类(符号定位/调用链/架构职责/配置schema/同名干扰/SDK边界/协议契约/测试/中文/细节),
|
|
227
|
+
机械化打分可复现(期望文件 + must_contain 关键字):
|
|
228
|
+
|
|
229
|
+
| 指标 | Voyage rerank-2.5(默认) | Cohere v3.5 基线 | 参考(自托管 0.6B 方案公开数据) |
|
|
230
|
+
|---|---|---|---|
|
|
231
|
+
| Top-1 精确命中 | **88%** | 84% | 32% |
|
|
232
|
+
| Recall@5 | 98% | 100% | 54% |
|
|
233
|
+
| 答案可用性 | 100% | 100% | 80% |
|
|
234
|
+
| MRR | **0.916** | 0.897 | — |
|
|
235
|
+
| 平均延迟 | **0.96s** | 6.2s(试用 key 节流) | — |
|
|
236
|
+
|
|
237
|
+
附加 **K 类私有业务仓库探针**(不计入主总分):在真实业务仓库上验证复合意图拆分/
|
|
238
|
+
子查询分数混合/保底、trigram 中文召回、实现意图降权、`expand_graph=True` 全链路。
|
|
239
|
+
探针定义在 gitignore 的 `eval_local_probes.py`(`PROBE_TARGET` + `PROBE_GOLDEN`,
|
|
240
|
+
写法见 `eval_golden.py` 的 K 类加载段),不存在自动跳过(`--skip-java` 显式跳过)——
|
|
241
|
+
你可以对自己的仓库建一组同格式探针作为私有回归安全网。
|
|
242
|
+
|
|
243
|
+
复测:`python eval_golden.py --json`;回归测试:`python test_fixes.py`
|
|
244
|
+
|
|
245
|
+
### 模型选型说明
|
|
246
|
+
|
|
247
|
+
- **embedding 为什么是 voyage-code-3 而非 Voyage 4 系列**:4 系列(2026-01)是通用文本模型,
|
|
248
|
+
**没有 voyage-code-4**;官方文档代码检索场景仍推荐 code-3。想试通用旗舰可
|
|
249
|
+
`SCM_EMBED_MODEL=voyage-4-large`(需重建索引),与 code-3 的对比评测列入后续。
|
|
250
|
+
- **rerank 为什么默认 Voyage**:与 embedding 同一个 key 零额外配置;rerank-2.5 公开基准
|
|
251
|
+
优于 Cohere v3.5(官方数据 +7.94%,本项目评测 Top-1 +4);免费额度 200M token 且无
|
|
252
|
+
试用 key 10 次/分钟限速(评测提速 6.5×)。Cohere 保留为可选后端。
|
|
253
|
+
|
|
254
|
+
### 工程边界(已知成本)
|
|
255
|
+
|
|
256
|
+
- **rerank 限速**:未绑卡/试用 key 限速低(Cohere 试用 10 次/分钟)。密集调用设
|
|
257
|
+
`SCM_RERANK_MIN_INTERVAL` 节流;429 自动退避重试兜底。
|
|
258
|
+
- **复合 query 额外延迟**:中文双动作查询("生成…并清理…")每个子查询多发一次
|
|
259
|
+
rerank(+200~400ms/次,最多 2 次)。仅复合措辞触发,普通查询零开销。
|
|
260
|
+
- **阈值标定范围**:子查询分数门槛 0.2、两段拆分等参数按 **Cohere 分数分布**在中文
|
|
261
|
+
Java 仓库 + Go 仓库双评测集上标定;切换 rerank 后端(分数分布不同)或其它语言/
|
|
262
|
+
仓库表现异常时,优先复核 `_COMPOUND_SUB_MIN_SCORE`。
|
|
263
|
+
|
|
264
|
+
## 性能数据(42 块 / 9 文件)
|
|
265
|
+
|
|
266
|
+
| 指标 | float32 | int8 |
|
|
267
|
+
|---|---|---|
|
|
268
|
+
| 索引耗时 | 2.9s | 2.4s |
|
|
269
|
+
| DB 大小 | 4328 KB | 1252 KB(节省 71%) |
|
|
270
|
+
| 检索延迟 | 0.3–0.8s | 0.3–0.8s |
|
|
271
|
+
| Top5 一致率 | — | 95%(19/20) |
|
|
272
|
+
| Rerank 排序 | score 0.1–0.7 | — |
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
# semantic-code-mcp
|
|
2
|
+
|
|
3
|
+
自建代码语义检索 MCP Server —— 自然语言查询 → 相关代码片段。
|
|
4
|
+
|
|
5
|
+
「效果优先」技术栈:**Tree-sitter AST 切分 + voyage-code-3 embedding(int8 量化)+ sqlite-vec 向量库 + BM25 全文 + RRF 融合 + Voyage rerank-2.5 重排 + Call Graph 图扩展**。一个 `VOYAGE_API_KEY` 跑通 embedding + rerank 全链路。
|
|
6
|
+
|
|
7
|
+
工程特性:**watchdog 文件实时监控 + 多工作区 LRU 管理 + MCP progress notification + cancel signal**。
|
|
8
|
+
|
|
9
|
+
## 架构
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
codebase_search(query, dir)
|
|
13
|
+
│
|
|
14
|
+
▼
|
|
15
|
+
WorkspaceManager ── LRU(max 8) ── FileWatcher(watchdog + 2s debounce)
|
|
16
|
+
│
|
|
17
|
+
▼
|
|
18
|
+
Indexer ── 全量扫描/watcher增量(O(变更数)) ── Chunker(Tree-sitter AST) ── Embedder(voyage-code-3)
|
|
19
|
+
│ │
|
|
20
|
+
│ Store(sqlite-vec + FTS5 + 文件hash)
|
|
21
|
+
▼
|
|
22
|
+
Retriever ── 向量召回 + BM25召回 ── RRF融合 ── rerank(Voyage/Cohere)── Call Graph扩展 ── top_n 代码片段
|
|
23
|
+
│
|
|
24
|
+
▼
|
|
25
|
+
MCP Server ── async tools + progress notification + cancel signal
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
| 模块 | 职责 |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `chunker.py` | Tree-sitter 按函数/类切分(16 语言 + md/yaml/json 等文档配置按行切),提取调用关系构建 call graph |
|
|
31
|
+
| `store.py` | sqlite-vec 向量(float/int8)+ FTS5 全文 + 文件指纹 + call graph 边表 |
|
|
32
|
+
| `embedder.py` | voyage-code-3,document/query 双模式,int8 量化,限流重试 |
|
|
33
|
+
| `retriever.py` | 向量 + BM25 → RRF → rerank → 意图感知打分(测试/文档/调用链意图)→ 文件多样性截断 → 图扩展 |
|
|
34
|
+
| `indexer.py` | 目录扫描 + 文件 hash 增量同步 + watcher dirty 增量同步 |
|
|
35
|
+
| `watcher.py` | watchdog 文件监控 + 2s debounce + 50 变更立即 flush |
|
|
36
|
+
| `workspace.py` | 多工作区 LRU 管理器(创建/淘汰/状态追踪) |
|
|
37
|
+
| `server.py` | MCP 封装,async 工具 + progress + cancel + WorkspaceManager |
|
|
38
|
+
|
|
39
|
+
## 安装
|
|
40
|
+
|
|
41
|
+
发布包名为 `semcode-mcp`(PyPI 上 `semantic-code-mcp` 已被同名项目占用):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# 方式一(推荐):uv 环境零安装,MCP 客户端配置里直接 uvx 启动
|
|
45
|
+
uvx semcode-mcp
|
|
46
|
+
|
|
47
|
+
# 方式二:npx(要求已装 uv,该 npm 包是透传 uvx 的薄壳)
|
|
48
|
+
npx -y semcode-mcp
|
|
49
|
+
|
|
50
|
+
# 方式三:pip
|
|
51
|
+
pip install semcode-mcp
|
|
52
|
+
|
|
53
|
+
# 源码开发
|
|
54
|
+
pip install -e .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 配置
|
|
58
|
+
|
|
59
|
+
复制 `.env.example` 为 `.env` 并填入 key:
|
|
60
|
+
|
|
61
|
+
| 变量 | 必需 | 说明 |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `VOYAGE_API_KEY` | 是 | Voyage embedding + rerank(同一个 key 双用),申请:https://dash.voyageai.com/ |
|
|
64
|
+
| `COHERE_API_KEY` | 否 | 可选 rerank 后备后端;默认用 Voyage rerank-2.5,无需此 key |
|
|
65
|
+
|
|
66
|
+
### 高级配置
|
|
67
|
+
|
|
68
|
+
| 变量 | 默认值 | 说明 |
|
|
69
|
+
|---|---|---|
|
|
70
|
+
| `SCM_EMBED_MODEL` | `voyage-code-3` | Embedding 模型 |
|
|
71
|
+
| `SCM_EMBED_DTYPE` | `float` | 向量精度:`float`(最高精度)/ `int8`(省 71% 存储) |
|
|
72
|
+
| `SCM_EMBED_MAX_RETRIES` | `4` | API 限流/错误时自动重试次数 |
|
|
73
|
+
| `SCM_EMBED_MIN_INTERVAL` | `0` | 请求最小间隔秒数(未绑卡 3 RPM 限制时设 `21`) |
|
|
74
|
+
| `SCM_EMBED_CONCURRENCY` | voyage `3` / local `1` | 索引时 embedding 并发请求数(实测 3 路≈提速 3 倍) |
|
|
75
|
+
| `SCM_EMBED_CHAR_BUDGET` | `200000` | 单批最大字符数(未绑卡时可调小) |
|
|
76
|
+
| `SCM_RERANK_BACKEND` | `auto` | rerank 后端:`auto`(有 VOYAGE key 用 Voyage,其次 Cohere)/ `voyage` / `cohere` / `off` |
|
|
77
|
+
| `SCM_RERANK_MODEL` | 按后端 | voyage → `rerank-2.5`,cohere → `rerank-v3.5` |
|
|
78
|
+
| `SCM_DB_DIR` | `~/.semantic-code-mcp` | 索引数据库存放目录 |
|
|
79
|
+
| `SCM_TOP_K` | `50` | 向量召回候选数 |
|
|
80
|
+
| `SCM_TOP_N` | `10` | 最终返回结果数 |
|
|
81
|
+
| `HTTPS_PROXY` | — | Cohere API 代理(国内需配) |
|
|
82
|
+
| `SCM_MAX_WORKSPACES` | `8` | 最大同时管理的工作区数(LRU 淘汰) |
|
|
83
|
+
| `SCM_WATCH` | `1` | 文件监控:`1` 启用(默认),`0` 禁用 |
|
|
84
|
+
|
|
85
|
+
## 在 MCP 客户端注册
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcpServers": {
|
|
90
|
+
"semantic-code": {
|
|
91
|
+
"command": "uvx",
|
|
92
|
+
"args": ["semcode-mcp"],
|
|
93
|
+
"env": {
|
|
94
|
+
"VOYAGE_API_KEY": "your-voyage-key"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
npx 用法把 `command/args` 换成 `"npx", ["-y", "semcode-mcp"]`;
|
|
102
|
+
源码开发用 `pip install -e .` 后配 `"semcode-mcp", []`(包采用相对 import,
|
|
103
|
+
不支持 `python server.py` 直接跑,需用 console script 或 `python -m semantic_code_mcp.server`)。
|
|
104
|
+
|
|
105
|
+
## 工具
|
|
106
|
+
|
|
107
|
+
### codebase_search
|
|
108
|
+
|
|
109
|
+
| 参数 | 类型 | 说明 |
|
|
110
|
+
|---|---|---|
|
|
111
|
+
| `information_request` | string | 自然语言查询,如"用户登录鉴权逻辑在哪里" |
|
|
112
|
+
| `directory_path` | string | 代码库绝对路径 |
|
|
113
|
+
|
|
114
|
+
唯一工具,首次调用自动全量索引,之后 watcher 驱动增量同步(O(变更数),极速)。支持 MCP progress notification 实时回报索引进度。需要强制重建索引时删除 `~/.semantic-code-mcp/` 下对应 `.db` 文件即可。
|
|
115
|
+
|
|
116
|
+
## 工作原理
|
|
117
|
+
|
|
118
|
+
1. **切分**:Tree-sitter 解析 AST,按函数/类边界切块,保留 `file_path / symbol / 行号` 元数据。
|
|
119
|
+
2. **向量化**:voyage-code-3 对代码块生成 1024 维向量(`input_type=document`)。
|
|
120
|
+
3. **存储**:向量入 sqlite-vec(vec0 虚拟表),同时入 FTS5 全文索引;`blob_hash = SHA256(path+code)` 实现内容寻址去重。
|
|
121
|
+
4. **检索**:查询同时走向量 KNN 与 BM25,用 RRF 融合排名,再用 rerank(默认 Voyage rerank-2.5)精排出 top_n。
|
|
122
|
+
5. **图扩展**:主结果沿 call graph 扩展 1 跳,把调用者/被调用者连带召回(附 `relation` 标记)。
|
|
123
|
+
6. **实时监控**:watchdog 监控文件变更(2s debounce),**后台主动增量同步**(O(变更数)),查询时零等待;后台失败不丢变更,下次查询前兜底。
|
|
124
|
+
7. **LRU 管理**:多工作区并发(最多 8 个),超限自动淘汰最久未用的 workspace。
|
|
125
|
+
|
|
126
|
+
## 索引存储
|
|
127
|
+
|
|
128
|
+
每个工作区按目录路径哈希存为 `~/.semantic-code-mcp/<hash>.db`(可用 `SCM_DB_DIR` 改)。删除该目录即清空所有索引。
|
|
129
|
+
|
|
130
|
+
## 隐私与数据边界
|
|
131
|
+
|
|
132
|
+
本工具的完整数据流向,用于评估能否用于敏感/闭源仓库:
|
|
133
|
+
|
|
134
|
+
### 会出网的数据(默认配置)
|
|
135
|
+
|
|
136
|
+
| 接收方 | 发送内容 | 时机 |
|
|
137
|
+
|---|---|---|
|
|
138
|
+
| Voyage AI | 代码块全文(embedding + rerank 候选)+ 查询文本 | 索引时 + 每次检索 |
|
|
139
|
+
| Cohere(可选后端) | 查询文本 + top-50 候选代码块全文 | 仅 `SCM_RERANK_BACKEND=cohere` 时;默认零发送 |
|
|
140
|
+
| 自配 LLM 端点(可选,默认关) | 仅查询文本(不含代码) | `SCM_QUERY_EXPANSION=on` 时 |
|
|
141
|
+
|
|
142
|
+
供应商对 API 数据的保留/训练策略请以其当前条款为准自行评估(Voyage/Cohere 均声明 API 数据默认不用于训练,本项目不替其背书)。
|
|
143
|
+
|
|
144
|
+
### 始终留在本地的
|
|
145
|
+
|
|
146
|
+
- 索引库全部落盘本机 `~/.semantic-code-mcp/`(向量 + 代码原文 + call graph),不上传任何服务
|
|
147
|
+
- 无遥测、无统计上报,除上表 API 外零网络请求
|
|
148
|
+
|
|
149
|
+
### 索引范围控制
|
|
150
|
+
|
|
151
|
+
- 全层级遵守 `.gitignore`(含否定模式):`.env`、构建产物等被忽略的文件不会进索引
|
|
152
|
+
- 例外:`AGENTS.md`/`.windsurfrules` 等 agent 指导文件即使被 gitignore 也会索引(有意设计,它们对检索架构问题价值极高)
|
|
153
|
+
- ⚠️ **硬编码在代码里的密钥会随代码块发往上表供应商**,敏感仓库索引前请先清理或用全本地模式
|
|
154
|
+
|
|
155
|
+
### 全本地模式(代码零出网)
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
pip install sentence-transformers
|
|
159
|
+
SCM_EMBED_BACKEND=local # 本地 embedding(默认 Qwen/Qwen3-Embedding-0.6B)
|
|
160
|
+
# 不配 COHERE_API_KEY # rerank 自动跳过,用 RRF 融合排序
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
检索质量会下降(参考公开评测中自托管 0.6B 方案的差距),但数据完全不离开本机。
|
|
164
|
+
|
|
165
|
+
## 路线
|
|
166
|
+
|
|
167
|
+
- **阶段 1** ✅:Tree-sitter + voyage-code-3 + hybrid + rerank —— 第一梯队 RAG
|
|
168
|
+
- **阶段 2** ✅:Call Graph 图扩展(caller/callee 连带召回)+ int8 量化向量(存储省 71%,一致率 95%)
|
|
169
|
+
- **阶段 3** ✅:工程化 —— watchdog 文件监控 + 多工作区 LRU + progress + cancel
|
|
170
|
+
- **阶段 4** ✅(部分):意图感知排序(调用链直查 edges / 测试意图 / 文档意图)+ 文档配置索引(AGENTS.md 豁免 gitignore)+ 50 条分类评测集
|
|
171
|
+
- **阶段 5** ✅:单工具化 + 后台主动增量同步 + 分阶段进度条日志 + Java 调用链(接收者边/构造类型名/泛型剥离)+ 配置意图(yaml 反转 boost)
|
|
172
|
+
+ 并发 embedding 流水线(worker 只跑网络调用,sqlite 写回留在调用线程,顺序写回;CLIProxyAPI 9067 块全量 77s,≈串行 3 倍)
|
|
173
|
+
- **HyDE 已评测,结论默认关**:Top-1 86%→82%、延迟 2.9s→10.4s、Recall@5 98%→100%;架构类 +40 分但配置/SDK 类 -40(变体稀释精确标识符信号)。
|
|
174
|
+
改进线:选择性扩展——仅对不含精确标识符的模糊查询开 HyDE
|
|
175
|
+
- **后续候选**:选择性 HyDE、本地后端对照评测、超大仓库 ANN 索引
|
|
176
|
+
|
|
177
|
+
## 评测(eval_golden.py,CLIProxyAPI 778 文件 / 9067 块)
|
|
178
|
+
|
|
179
|
+
50 条 query × 10 类(符号定位/调用链/架构职责/配置schema/同名干扰/SDK边界/协议契约/测试/中文/细节),
|
|
180
|
+
机械化打分可复现(期望文件 + must_contain 关键字):
|
|
181
|
+
|
|
182
|
+
| 指标 | Voyage rerank-2.5(默认) | Cohere v3.5 基线 | 参考(自托管 0.6B 方案公开数据) |
|
|
183
|
+
|---|---|---|---|
|
|
184
|
+
| Top-1 精确命中 | **88%** | 84% | 32% |
|
|
185
|
+
| Recall@5 | 98% | 100% | 54% |
|
|
186
|
+
| 答案可用性 | 100% | 100% | 80% |
|
|
187
|
+
| MRR | **0.916** | 0.897 | — |
|
|
188
|
+
| 平均延迟 | **0.96s** | 6.2s(试用 key 节流) | — |
|
|
189
|
+
|
|
190
|
+
附加 **K 类私有业务仓库探针**(不计入主总分):在真实业务仓库上验证复合意图拆分/
|
|
191
|
+
子查询分数混合/保底、trigram 中文召回、实现意图降权、`expand_graph=True` 全链路。
|
|
192
|
+
探针定义在 gitignore 的 `eval_local_probes.py`(`PROBE_TARGET` + `PROBE_GOLDEN`,
|
|
193
|
+
写法见 `eval_golden.py` 的 K 类加载段),不存在自动跳过(`--skip-java` 显式跳过)——
|
|
194
|
+
你可以对自己的仓库建一组同格式探针作为私有回归安全网。
|
|
195
|
+
|
|
196
|
+
复测:`python eval_golden.py --json`;回归测试:`python test_fixes.py`
|
|
197
|
+
|
|
198
|
+
### 模型选型说明
|
|
199
|
+
|
|
200
|
+
- **embedding 为什么是 voyage-code-3 而非 Voyage 4 系列**:4 系列(2026-01)是通用文本模型,
|
|
201
|
+
**没有 voyage-code-4**;官方文档代码检索场景仍推荐 code-3。想试通用旗舰可
|
|
202
|
+
`SCM_EMBED_MODEL=voyage-4-large`(需重建索引),与 code-3 的对比评测列入后续。
|
|
203
|
+
- **rerank 为什么默认 Voyage**:与 embedding 同一个 key 零额外配置;rerank-2.5 公开基准
|
|
204
|
+
优于 Cohere v3.5(官方数据 +7.94%,本项目评测 Top-1 +4);免费额度 200M token 且无
|
|
205
|
+
试用 key 10 次/分钟限速(评测提速 6.5×)。Cohere 保留为可选后端。
|
|
206
|
+
|
|
207
|
+
### 工程边界(已知成本)
|
|
208
|
+
|
|
209
|
+
- **rerank 限速**:未绑卡/试用 key 限速低(Cohere 试用 10 次/分钟)。密集调用设
|
|
210
|
+
`SCM_RERANK_MIN_INTERVAL` 节流;429 自动退避重试兜底。
|
|
211
|
+
- **复合 query 额外延迟**:中文双动作查询("生成…并清理…")每个子查询多发一次
|
|
212
|
+
rerank(+200~400ms/次,最多 2 次)。仅复合措辞触发,普通查询零开销。
|
|
213
|
+
- **阈值标定范围**:子查询分数门槛 0.2、两段拆分等参数按 **Cohere 分数分布**在中文
|
|
214
|
+
Java 仓库 + Go 仓库双评测集上标定;切换 rerank 后端(分数分布不同)或其它语言/
|
|
215
|
+
仓库表现异常时,优先复核 `_COMPOUND_SUB_MIN_SCORE`。
|
|
216
|
+
|
|
217
|
+
## 性能数据(42 块 / 9 文件)
|
|
218
|
+
|
|
219
|
+
| 指标 | float32 | int8 |
|
|
220
|
+
|---|---|---|
|
|
221
|
+
| 索引耗时 | 2.9s | 2.4s |
|
|
222
|
+
| DB 大小 | 4328 KB | 1252 KB(节省 71%) |
|
|
223
|
+
| 检索延迟 | 0.3–0.8s | 0.3–0.8s |
|
|
224
|
+
| Top5 一致率 | — | 95%(19/20) |
|
|
225
|
+
| Rerank 排序 | score 0.1–0.7 | — |
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# semcode-mcp (npm wrapper)
|
|
2
|
+
|
|
3
|
+
Thin `npx` wrapper for the [semantic-code-mcp](https://github.com/huawang1258/semantic-code-mcp) Python MCP server (published as `semcode-mcp`). It launches the PyPI package via `uvx` (or a `pip`-installed console script).
|
|
4
|
+
|
|
5
|
+
**Prerequisite**: [uv](https://docs.astral.sh/uv/getting-started/installation/) or `pip install semcode-mcp`.
|
|
6
|
+
|
|
7
|
+
## MCP client config
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"semantic-code": {
|
|
13
|
+
"command": "npx",
|
|
14
|
+
"args": ["-y", "semcode-mcp"],
|
|
15
|
+
"env": {
|
|
16
|
+
"VOYAGE_API_KEY": "your-voyage-key"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Full docs: https://github.com/huawang1258/semantic-code-mcp
|