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.

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

一个本地 MCP 服务器,在 CPU 上对代码和文档文件夹建立语义索引,让助手用自然语言或代码查询找到相关片段

可以做什么
索引文件夹或增量更新其索引,耗时较长时在后台继续运行。在已编织的文件夹中按自然语言或代码查询检索最相近的片段,返回文件路径、行范围和分数。列出已编织的文件夹及其文件与片段数量,以及仍在运行的编织任务。删除某个文件夹的索引,但不改动其文件。
适用场景
适合让助手按语义而非精确文本在本地代码库和文档中定位内容,例如回答某个值在哪里被解析。由于检索完全在本地 CPU 上运行,也适合离线或注重隐私的场景。
运行要求
通过 npx 作为本地 stdio 进程运行,需要 Node 20 或更高版本,支持 macOS、Linux 和 Windows;应先从终端安装一次再加入客户端。需传入一个或多个 --folder 路径,或让模型调用 weave_folder。首次运行会从 huggingface.co 下载约 134 MB 的编码器文件到缓存目录,可用 BLACKWINDOW_WEAVE_CACHE 或 --cache 配置。在 Linux x64 上安装时还可能下载并未使用的 CUDA 库。
安装前请注意
首次安装可能超过客户端启动超时,并在 npm 缓存中留下损坏的副本,因此应先从终端安装并固定版本。weave_folder 会向缓存目录写入索引数据,weave_forget 会删除某文件夹的索引,但不会删除其文件。首次运行会访问 huggingface.co,之后运行不再发起网络请求。索引以文件形式保存在缓存路径下。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Sunstone Weave: Local Semantic Code Search,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

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:

sh
npx -y [email protected] --version

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:

sh
ONNXRUNTIME_NODE_INSTALL=skip npx -y [email protected] --version

Add it to a client

macOS and Linux

Claude Code:

sh
claude mcp add weave -- npx -y [email protected] --folder /path/to/your/repo

VS Code, in .vscode/mcp.json:

json
{  "servers": {    "weave": { "type": "stdio", "command": "npx", "args": ["-y", "[email protected]", "--folder", "${workspaceFolder}"] }  }}

Cursor, Claude Desktop, Windsurf and most other clients:

json
{  "mcpServers": {    "weave": { "command": "npx", "args": ["-y", "[email protected]", "--folder", "/path/to/your/repo"] }  }}

Windows

On Windows npx is a batch file, which a client can only start through cmd /c. Claude Code:

sh
claude mcp add weave -- cmd /c npx -y [email protected] --folder C:\path\to\your\repo

Cursor, Claude Desktop, Windsurf and most other clients:

json
{  "mcpServers": {    "weave": { "command": "cmd", "args": ["/c", "npx", "-y", "[email protected]", "--folder", "C:/path/to/your/repo"] }  }}

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.

optionmeaning
--folder <path>Weave this folder when the server starts. Repeatable. Optional: the model can call weave_folder itself.
--cache <dir>Where the encoder and the indexes live. Default ~/.cache/blackwindow-weave (on Windows %USERPROFILE%\.cache\blackwindow-weave), or BLACKWINDOW_WEAVE_CACHE.
--versionPrint the version and exit.

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

toolwhat it does
weave_folderIndex a folder, or bring its index up to date. Only files whose size or modification time changed are read again. A run longer than 25 s returns at once and continues in the background.
weave_searchThe passages nearest a plain-language or code query, with file, line range and score. Searches the folders woven in this session, or every woven folder if none was, or one folder when asked.
weave_listThe woven folders with their file and passage counts, and any weave still running.
weave_forgetDelete a folder's index. The folder's files are not touched.

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:

folderfilespassagesfirst weavesecond weavesearch
this package's src/6423.8 s, with the encoder's download0.013 s5 to 6 ms
the Sunstone repository571,36720.2 s0.014 s6 ms

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 .gitignore holds. Any other folder is walked, skipping node_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 under bench/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
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

3
  1. v0.1.2最新Oct 1, 2026
  2. v0.1.1Sep 30, 2026
  3. v0.1.0Sep 30, 2026

评分

已满足适用检查项的 40%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

    请在仓库或注册中心条目中声明许可证。