Codeweave

io.github.semihkayan由 GitHub 帳號 semihkayan 發布v0.1.20更新於 Oct 27, 2026

Save tokens while coding — your AI agent gets structured code context, not file dumps.

已驗證STDIO僅桌面知識與記憶開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,為程式碼庫建立索引,讓 AI 助理以語意檢索取得程式碼脈絡,而不是把整份檔案塞進上下文。

可以做什麼
  • 依語意檢索已索引的函式、類別與方法,結合向量、關鍵字與結構密度排序
  • 手動觸發或更新專案索引,通常檔案監看會自動增量重建
  • 查看索引健康狀態:檔案與函式數量、嵌入狀態、呼叫圖統計與語言分布
  • 在 monorepo 中依工作區檢索,或一次跨所有工作區搜尋
適用情境
適合助理在較大的 Python、TypeScript、JavaScript、Go、Rust、Java 或 C# 程式碼庫上工作,希望用更少 token 找到相關函式而非通讀檔案時。主要用於 Claude Code、VS Code 等 MCP 用戶端上的本機開發情境。
執行需求
以本機程序執行,透過 npx 或全域 npm 安裝;需要 Node.js 20 以上。語意檢索需要 Ollama 與 qwen3-embedding:0.6b 模型,首次執行會下載;沒有 Ollama 時僅回退為全文檢索。專案需先建立索引,並在 MCP 用戶端設定啟動此伺服器。
安裝前請注意
安裝精靈會全域安裝此套件、安裝 Ollama 並下載嵌入模型,會變更本機環境。建立索引會讀取原始碼並在磁碟保存索引與快取,git worktree 情境下還會複製主儲存庫快取。此伺服器自述仍在積極開發中。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Codeweave,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

@codeweave/mcp

Give your AI agent structured code understanding — not just file dumps.

[npm version] [license] [node version] [supported languages] [status]


CodeWeave is an MCP server that gives AI agents cheap, precise code intelligence. Instead of dumping entire files into context, your agent queries local indexes — AST, call graph, type graph, hybrid semantic search — and gets back only what it needs.

Less tokens. More relevant context. Better decisions.

The semantic search pipeline is the heart of the system: a 6-stage hybrid engine combining vector embeddings, full-text search, and structural density scoring. Tested extensively across large production codebases — Java monoliths, TypeScript monorepos, Python ML pipelines, Go microservices — with consistently strong retrieval accuracy.

Actively developed. New tools and improvements ship regularly. Contributions and feedback are welcome.

Quick Start

bash
cd your-projectnpx @codeweave/mcp

That's it. The setup wizard handles everything:

  1. Installs @codeweave/mcp globally
  2. Installs Ollama if needed
  3. Downloads the embedding model
  4. Configures your MCP client (Claude Code, VS Code)
  5. Indexes your project

Note: The first run requires a one-time download of Ollama and the embedding model. This takes a few minutes but only happens once.

Open your project in Claude Code or VS Code and start asking questions.

Tools

3 tools organized around the code understanding workflow:

ToolPurpose
semantic_searchSearch by meaning — finds functions even when you don't know exact names. Hybrid vector + keyword search with density-based reranking.
reindexManually trigger index update. Usually unnecessary — file watcher auto-reindexes on changes.
get_index_statusIndex health dashboard: file/function counts, embedding status, call graph stats, language breakdown.

How It Works

Source Code    │    ▼tree-sitter AST  ───>  Function Index (in-memory)                              │                   ┌──────────┼──────────┐                   ▼          ▼          ▼              Call Graph  Type Graph  Embeddings              (JSON)      (JSON)     (LanceDB)                   │          │          │                   └──────────┼──────────┘                              ▼                       3 MCP Tools  ───>  AI Agent
  1. Parse — tree-sitter extracts every function, class, method, and interface across 7 languages
  2. Embed — Qwen3-Embedding-0.6B generates vector embeddings for semantic search
  3. Index — LanceDB stores vectors with BM25 full-text index alongside
  4. Graph — Call graph tracks who-calls-whom with type-aware resolution; type graph tracks inheritance and implementations (powers ranking and index-status reporting)
  5. Watch — File watcher detects changes and incrementally reindexes affected files
  6. Serve — 3 tools exposed over MCP protocol (stdio), ready before indexing completes

Semantic Search

The search pipeline is where CodeWeave really shines. It's not just vector similarity — it's a multi-stage system designed to surface the most relevant and important code:

6-Stage Pipeline:

  1. Exact name match — Fast path for known function names (score 0.95+)
  2. Vector search — Embed the query, find semantically similar functions (over-fetches 3x for reranking headroom)
  3. Full-text search — BM25 keyword matching catches what embeddings miss
  4. RRF merge — Reciprocal Rank Fusion combines both result lists without needing score calibration
  5. Exact match boost — Functions whose name matches the query get priority
  6. Density reranking — Structural signals determine information density, pushing trivial code down

Density Scoring uses 7 language-agnostic structural signals:

SignalWhat it measures
Body sizeLarger functions carry more behavior (log-scaled)
Docstring presenceDocumented code is more likely to be important
Docstring richnessTags, deps, side effects indicate well-maintained code
Parameter countMore params = more complex behavior
Call graph centralityFunctions called by many others are architectural anchors
VisibilityPublic > protected > private
KindClasses > methods/functions > interfaces

Penalties prevent noise from dominating results:

  • Accessors (getters/setters) — pure data access, no behavior
  • Constructors — many params inflate scores, but they're just assignments
  • Test files — large bodies don't mean important behavior (unless you're searching for tests)

Graceful degradation: If Ollama is unavailable, search falls back to full-text only.

Why These Technologies

Every technology choice serves the core goal: local, fast, zero-config code understanding.

TechnologyWhy
tree-sitterOne parsing framework for all 7 languages. Mature, fast, battle-tested. Gives us full AST access without writing 7 different parsers from scratch.
LanceDBEmbedded vector database — no external server, no Docker, no configuration. Just a directory on disk. Supports both vector search and BM25 full-text search in a single engine.
Qwen3-Embedding-0.6BThe secret weapon. Just 0.6B parameters but delivers embedding quality that rivals models 10x its size for code understanding. Tested across large production codebases — Java enterprise monoliths, TypeScript monorepos, Python data pipelines — with consistently excellent retrieval accuracy. Runs locally via Ollama, fast enough for real-time reindexing, lightweight enough for any developer machine.
RRF (Reciprocal Rank Fusion)Proven technique from information retrieval research. Merges ranked lists from different scoring systems (vector similarity vs. BM25 relevance) without needing score calibration. Simple, robust, effective.
MCP ProtocolStandard interface for AI tool integration. One server works with Claude Code, VS Code, Cursor, and any MCP-compatible client.

Supported Languages

LanguageFunctionsCallsImportsTypesTest Detection
Pythonfunctions, methods, classescall sitesimport/from-importclass inheritance, type hintspytest, unittest
TypeScriptfunctions, arrows, methods, classes, interfacescall sitesnamed/default/namespace importsimplements, extends, member typesjest, vitest, playwright
JavaScript(same as TypeScript)(same as TypeScript)(same as TypeScript)(same as TypeScript)jest, vitest, mocha
Gofunctions, methods (receiver), structscall sitesimport specsimplicit interfaces, structstesting, testify
Rustfunctions, methods (impl), structs, enumscall sitesuse declarationsimpl Trait for Type#[test], #[cfg(test)]
Javamethods, constructors, classes, interfacesmethod invocationsimport declarationsextends, implementsJUnit, Mockito, AssertJ
C#methods, constructors, classes, structs, interfaces, recordsinvocationsusing directivesbase types, interface implNUnit, xUnit, Moq

Every language parser also provides:

  • Noise filtering — built-in lists of standard library calls (e.g., console.log, fmt.Println, System.out.println) that get filtered from dependency analysis
  • Structural hints — AST-confirmed classifications (constructor, abstract, getter/setter, test) that feed into density scoring

Configuration

CodeWeave works zero-config out of the box. For customization, create .code-context/config.yaml:

yaml
workspaces:  - .                                  # Root workspace  - clients/web                        # Web client  - clients/mobile                     # Mobile client
embedding:  model: "qwen3-embedding:0.6b"     # Embedding model name  ollamaUrl: "http://localhost:11434" # Ollama API endpoint  dimensions: 1024                    # Vector dimensions  batchSize: 50                       # Embedding batch size
parser:  sourceRoot: "src"                   # Strip this prefix from module paths  ignore:    - "**/*.generated.*"              # Additional ignore patterns    - "**/vendor/**"
search:  rrfK: 60                           # RRF smoothing constant  expandCamelCase: true               # Expand camelCase in search chunks  density:    enabled: true                     # Density-based reranking    accessorPenalty: 0.6              # Penalty for getters/setters    constructorPenalty: 0.7           # Penalty for constructors    testFilePenalty: 0.5              # Penalty for test files
watcher:  debounceMs: 500                     # File change debounce  minIntervalMs: 2000                 # Minimum reindex interval
indexing:  maxFileSizeKb: 500                  # Skip files larger than this

CLI Tools

bash
# Full project initialization (AST + embeddings + graphs)codeweave-init [path] [--force] [--no-embed]
# Incremental reindex (only changed files)codeweave-reindex [--all] [--files=path1,path2] [--stdin]

Manual Setup

If you prefer step-by-step instead of npx @codeweave/mcp:

bash
# 1. Install globallynpm install -g @codeweave/mcp
# 2. Install Ollama and pull the embedding model# macOSbrew install ollama# Linuxcurl -fsSL https://ollama.com/install.sh | sh
ollama pull qwen3-embedding:0.6b
# 3. Index your projectcd your-projectcodeweave-init

4. Configure your MCP client

Claude Code — add .mcp.json to your project root:

json
{  "mcpServers": {    "codeweave": {      "command": "codeweave-server"    }  }}

VS Code — add .vscode/mcp.json:

json
{  "servers": {    "codeweave": {      "command": "codeweave-server"    }  }}

Monorepo Support

CodeWeave auto-detects workspaces in monorepos by scanning for manifest files (package.json, build.gradle, pom.xml, go.mod, Cargo.toml, pyproject.toml, etc.):

my-project/├── backend/build.gradle    → workspace "backend"├── mobile/package.json     → workspace "mobile"└── shared/package.json     → workspace "shared"

Each workspace gets its own isolated index, call graph, type graph, and vector store. Tools accept an optional workspace parameter — omit it to search across all workspaces.

Git Worktree Support

CodeWeave automatically detects git worktrees (including Claude Code's /worktree). On first start in a worktree, it copies the main repo's cache for a fast warm start (~2s instead of 30s+). After that, each worktree maintains its own fully isolated index.

  • Automatic — no configuration needed
  • Isolated — worktree changes don't affect the main repo's cache
  • Incremental — only files that differ from the main branch are re-parsed and re-embedded

Requirements

  • Node.js 20+
  • Ollama — for semantic search embeddings. Install via the setup wizard or manually from ollama.com. Without Ollama, semantic search falls back to full-text only.

Status

CodeWeave is under active development. The core indexing pipeline and all 3 tools are stable and tested across production codebases in all 7 supported languages.

Feedback, bug reports, and contributions are welcome — open an issue at github.com/semihkayan/codeweave-mcp.

License

Apache 2.0

來源:README.md,提交 c1de322

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.20最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分