Sunstone Weave: Local Semantic Code Search
io.github.space-bacon由 GitHub 账号 space-bacon 发布v0.1.2更新于 Oct 24, 2026
Semantic search over local folders of code and docs, with a code-search encoder running on your CPU.
概览
一个本地 MCP 服务器,在 CPU 上对代码和文档文件夹建立语义索引,让助手用自然语言或代码查询找到相关片段
- 可以做什么
- 索引文件夹或增量更新其索引,耗时较长时在后台继续运行。在已编织的文件夹中按自然语言或代码查询检索最相近的片段,返回文件路径、行范围和分数。列出已编织的文件夹及其文件与片段数量,以及仍在运行的编织任务。删除某个文件夹的索引,但不改动其文件。
- 适用场景
- 适合让助手按语义而非精确文本在本地代码库和文档中定位内容,例如回答某个值在哪里被解析。由于检索完全在本地 CPU 上运行,也适合离线或注重隐私的场景。
- 运行要求
- 通过 npx 作为本地 stdio 进程运行,需要 Node 20 或更高版本,支持 macOS、Linux 和 Windows;应先从终端安装一次再加入客户端。需传入一个或多个 --folder 路径,或让模型调用 weave_folder。首次运行会从 huggingface.co 下载约 134 MB 的编码器文件到缓存目录,可用 BLACKWINDOW_WEAVE_CACHE 或 --cache 配置。在 Linux x64 上安装时还可能下载并未使用的 CUDA 库。
安装
在 SourceWeft 中
- 打开 控制台中的 Sunstone Weave: Local Semantic Code Search,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
blackwindow-weave-mcp
Semantic search over the folders on your machine, for any MCP client. The server cuts source code and documentation into passages, embeds them with Motherlode, a 33M-parameter code-search encoder, on your CPU, and answers questions such as "where is a pairing line parsed into url, key and name" with file paths, line ranges and the passages themselves.
The only network requests are to huggingface.co on the first run: six requests, which leave five files, 133,752,819 bytes, in the cache. With the files cached, a run makes none.
This is the weave from Black Window and the Sunstone VS Code extension, packaged for clients that speak the Model Context Protocol. It runs on macOS, Linux and Windows with Node 20 or later.
Install
Install it once from a terminal, before adding it to a client. This installs the package and ONNX Runtime and prints the version once the runtime has loaded:
On GitHub's hosted runners, from an empty npm cache, this first install took 7 to 13 s on Linux and macOS and 55 to 69 s on Windows. Clients wait a limited time for a server to start (the MCP SDK's default is 60 s), and a client that stops waiting in the middle of an install can leave a broken copy in npm's cache (see Troubleshooting). Once installed, the server starts in under 3 s.
Keep the version in the client's configuration the same as here. With a version given, npx starts the copy it installed; with the bare name, npx (npm 11) looks for a newer version on every start and installs it while the client waits.
On Linux x64, ONNX Runtime also downloads 236 MB of CUDA libraries during the install. This server runs on the CPU and never loads them, so you can skip them:
Add it to a client
macOS and Linux
Claude Code:
VS Code, in .vscode/mcp.json:
Cursor, Claude Desktop, Windsurf and most other clients:
Windows
On Windows npx is a batch file, which a client can only start through cmd /c. Claude Code:
Cursor, Claude Desktop, Windsurf and most other clients:
In VS Code the same command and args go under servers in .vscode/mcp.json, with "type": "stdio".
Installed globally
npm install -g [email protected] installs a blackwindow-weave-mcp command, which a client can start
directly (cmd /c blackwindow-weave-mcp on Windows). To run from this repository instead of npm, replace
[email protected] in the arguments with github:space-bacon/blackwindow-weave-mcp.
Platforms
Every push runs CI on Linux (x64 and arm64), Windows (x64) and macOS (Apple silicon),
each with Node 20, 22 and 24. Each job runs the stdio smoke test below from a checkout. It then installs the packed
package through npx from an empty npm cache, starts it the way a client does and weaves a folder. On Windows it also
starts it through cmd /c. Last, it installs the package globally and starts it by its command. Other platforms,
such as Windows on Arm, Intel Macs and Alpine Linux, are not tested.
Troubleshooting
The client times out when it first starts the server, or the server stops with Cannot find module ... transformers.node.mjs. A first install was interrupted, usually by a client that stopped waiting, and npm kept the
half-installed copy. Delete npm's npx cache and install again from a terminal with the line under Install:
- macOS and Linux:
rm -rf ~/.npm/_npx - Windows (PowerShell):
Remove-Item -Recurse -Force "$env:LOCALAPPDATA\npm-cache\_npx"
Updating. Install the new version from a terminal as above, then change the version in the client's configuration.
Tools
Measured
On an Apple M2 Ultra (24 CPU cores, Node 24.4.1), through the MCP SDK's own stdio client, in test/smoke.mjs:
Embedding runs at about 68 passages a second on that machine, so a repository of 10,000 passages takes about two and a half minutes the first time. Those figures are one run each on one machine. The smoke test's three questions about this package's own source each return the expected file first; they are a check that the pieces are wired together, not a measure of retrieval quality. For retrieval quality see the model card.
How it works
- Files. A git work tree is listed by git, so
.gitignoreholds. Any other folder is walked, skippingnode_modules, build output, virtual environments, lock files and minified files. Files over 1 MB and files that read as binary are skipped. JSON and XML are left out: in the Sunstone repository, result files underbench/results/took ranks 2 and 3 of the question above when they were included. - Passages. Code is cut at definitions into passages of about 700 characters, each labelled with the nearest definition. Prose is cut at paragraphs and sentences into passages of about 420 characters. The chunkers are Black Window's.
- Encoder.
onnx/model.onnx(fp32) through transformers.js and ONNX Runtime on the CPU, CLS pooling. - Centring. Every vector has the model's shipped mean (
centring/mean_shipped.json) subtracted and is brought back to unit length, so a score is a cosine after centring. - Search. Exact: every passage is scored. Before answering, a folder not checked in the last 30 s is brought up to date if fewer than 200 of its files changed; otherwise the answer says the index is stale.
- Index. One per folder under
<cache>/index/: a Float32 matrix and a JSONL of passages, named by a manifest that is written to a temporary file and renamed into place, so an interrupted write leaves the previous index. An index that cannot be read is moved aside rather than overwritten.
Licence
Business Source License 1.1 with an internal-use grant. You may use it for any internal purpose, including commercial development on your own or your employer's code, with no limit on seats. You may not offer it to others as a hosted search service or ship it inside a product you supply. On 15 September 2030 it becomes Apache-2.0. The encoder is downloaded under its own licence, which has the same shape. For other terms, write to [email protected].
来源:README.md,提交 4acc79d
工具
0版本历史
3- v0.1.2最新Oct 1, 2026
- v0.1.1Sep 30, 2026
- v0.1.0Sep 30, 2026
评分
已满足适用检查项的 40%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分
请在仓库或注册中心条目中声明许可证。