{
  "markdown": "<p align=\"center\">\n  <h1 align=\"center\">@codeweave/mcp</h1>\n  <p align=\"center\">\n    <strong>Give your AI agent structured code understanding — not just file dumps.</strong>\n  </p>\n  <p align=\"center\">\n    <a href=\"https://www.npmjs.com/package/@codeweave/mcp\"><img src=\"https://img.shields.io/npm/v/@codeweave/mcp.svg\" alt=\"npm version\"></a>\n    <a href=\"https://github.com/semihkayan/codeweave-mcp/blob/main/LICENSE\"><img src=\"https://img.shields.io/npm/l/@codeweave/mcp.svg\" alt=\"license\"></a>\n    <img src=\"https://img.shields.io/badge/node-%3E%3D20-brightgreen\" alt=\"node version\">\n    <img src=\"https://img.shields.io/badge/languages-7-blue\" alt=\"supported languages\">\n    <img src=\"https://img.shields.io/badge/status-active%20development-orange\" alt=\"status\">\n  </p>\n</p>\n\n---\n\nCodeWeave 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.\n\n**Less tokens. More relevant context. Better decisions.**\n\nThe 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.\n\n> **Actively developed.** New tools and improvements ship regularly. Contributions and feedback are welcome.\n\n## Quick Start\n\n```bash\ncd your-project\nnpx @codeweave/mcp\n```\n\nThat's it. The setup wizard handles everything:\n\n1. Installs `@codeweave/mcp` globally\n2. Installs [Ollama](https://ollama.com) if needed\n3. Downloads the embedding model\n4. Configures your MCP client (Claude Code, VS Code)\n5. Indexes your project\n\n> **Note:** The first run requires a one-time download of Ollama and the embedding model. This takes a few minutes but only happens once.\n\nOpen your project in Claude Code or VS Code and start asking questions.\n\n## Tools\n\n3 tools organized around the code understanding workflow:\n\n| Tool | Purpose |\n|------|---------|\n| `semantic_search` | Search by meaning — finds functions even when you don't know exact names. Hybrid vector + keyword search with density-based reranking. |\n| `reindex` | Manually trigger index update. Usually unnecessary — file watcher auto-reindexes on changes. |\n| `get_index_status` | Index health dashboard: file/function counts, embedding status, call graph stats, language breakdown. |\n\n## How It Works\n\n```\nSource Code\n    │\n    ▼\ntree-sitter AST  ───>  Function Index (in-memory)\n                              │\n                   ┌──────────┼──────────┐\n                   ▼          ▼          ▼\n              Call Graph  Type Graph  Embeddings\n              (JSON)      (JSON)     (LanceDB)\n                   │          │          │\n                   └──────────┼──────────┘\n                              ▼\n                       3 MCP Tools  ───>  AI Agent\n```\n\n1. **Parse** — tree-sitter extracts every function, class, method, and interface across 7 languages\n2. **Embed** — Qwen3-Embedding-0.6B generates vector embeddings for semantic search\n3. **Index** — LanceDB stores vectors with BM25 full-text index alongside\n4. **Graph** — Call graph tracks who-calls-whom with type-aware resolution; type graph tracks inheritance and implementations (powers ranking and index-status reporting)\n5. **Watch** — File watcher detects changes and incrementally reindexes affected files\n6. **Serve** — 3 tools exposed over MCP protocol (stdio), ready before indexing completes\n\n## Semantic Search\n\nThe 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:\n\n**6-Stage Pipeline:**\n\n1. **Exact name match** — Fast path for known function names (score 0.95+)\n2. **Vector search** — Embed the query, find semantically similar functions (over-fetches 3x for reranking headroom)\n3. **Full-text search** — BM25 keyword matching catches what embeddings miss\n4. **RRF merge** — Reciprocal Rank Fusion combines both result lists without needing score calibration\n5. **Exact match boost** — Functions whose name matches the query get priority\n6. **Density reranking** — Structural signals determine information density, pushing trivial code down\n\n**Density Scoring** uses 7 language-agnostic structural signals:\n\n| Signal | What it measures |\n|--------|-----------------|\n| Body size | Larger functions carry more behavior (log-scaled) |\n| Docstring presence | Documented code is more likely to be important |\n| Docstring richness | Tags, deps, side effects indicate well-maintained code |\n| Parameter count | More params = more complex behavior |\n| Call graph centrality | Functions called by many others are architectural anchors |\n| Visibility | Public > protected > private |\n| Kind | Classes > methods/functions > interfaces |\n\n**Penalties** prevent noise from dominating results:\n- **Accessors** (getters/setters) — pure data access, no behavior\n- **Constructors** — many params inflate scores, but they're just assignments\n- **Test files** — large bodies don't mean important behavior (unless you're searching for tests)\n\n**Graceful degradation:** If Ollama is unavailable, search falls back to full-text only.\n\n## Why These Technologies\n\nEvery technology choice serves the core goal: **local, fast, zero-config code understanding.**\n\n| Technology | Why |\n|-----------|-----|\n| **tree-sitter** | One parsing framework for all 7 languages. Mature, fast, battle-tested. Gives us full AST access without writing 7 different parsers from scratch. |\n| **LanceDB** | Embedded 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. |\n| **Qwen3-Embedding-0.6B** | The 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. |\n| **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. |\n| **MCP Protocol** | Standard interface for AI tool integration. One server works with Claude Code, VS Code, Cursor, and any MCP-compatible client. |\n\n## Supported Languages\n\n| Language | Functions | Calls | Imports | Types | Test Detection |\n|----------|-----------|-------|---------|-------|---------------|\n| Python | functions, methods, classes | call sites | import/from-import | class inheritance, type hints | pytest, unittest |\n| TypeScript | functions, arrows, methods, classes, interfaces | call sites | named/default/namespace imports | implements, extends, member types | jest, vitest, playwright |\n| JavaScript | (same as TypeScript) | (same as TypeScript) | (same as TypeScript) | (same as TypeScript) | jest, vitest, mocha |\n| Go | functions, methods (receiver), structs | call sites | import specs | implicit interfaces, structs | testing, testify |\n| Rust | functions, methods (impl), structs, enums | call sites | use declarations | impl Trait for Type | #[test], #[cfg(test)] |\n| Java | methods, constructors, classes, interfaces | method invocations | import declarations | extends, implements | JUnit, Mockito, AssertJ |\n| C# | methods, constructors, classes, structs, interfaces, records | invocations | using directives | base types, interface impl | NUnit, xUnit, Moq |\n\nEvery language parser also provides:\n- **Noise filtering** — built-in lists of standard library calls (e.g., `console.log`, `fmt.Println`, `System.out.println`) that get filtered from dependency analysis\n- **Structural hints** — AST-confirmed classifications (constructor, abstract, getter/setter, test) that feed into density scoring\n\n## Configuration\n\nCodeWeave works zero-config out of the box. For customization, create `.code-context/config.yaml`:\n\n```yaml\nworkspaces:\n  - .                                  # Root workspace\n  - clients/web                        # Web client\n  - clients/mobile                     # Mobile client\n\nembedding:\n  model: \"qwen3-embedding:0.6b\"     # Embedding model name\n  ollamaUrl: \"http://localhost:11434\" # Ollama API endpoint\n  dimensions: 1024                    # Vector dimensions\n  batchSize: 50                       # Embedding batch size\n\nparser:\n  sourceRoot: \"src\"                   # Strip this prefix from module paths\n  ignore:\n    - \"**/*.generated.*\"              # Additional ignore patterns\n    - \"**/vendor/**\"\n\nsearch:\n  rrfK: 60                           # RRF smoothing constant\n  expandCamelCase: true               # Expand camelCase in search chunks\n  density:\n    enabled: true                     # Density-based reranking\n    accessorPenalty: 0.6              # Penalty for getters/setters\n    constructorPenalty: 0.7           # Penalty for constructors\n    testFilePenalty: 0.5              # Penalty for test files\n\nwatcher:\n  debounceMs: 500                     # File change debounce\n  minIntervalMs: 2000                 # Minimum reindex interval\n\nindexing:\n  maxFileSizeKb: 500                  # Skip files larger than this\n```\n\n## CLI Tools\n\n```bash\n# Full project initialization (AST + embeddings + graphs)\ncodeweave-init [path] [--force] [--no-embed]\n\n# Incremental reindex (only changed files)\ncodeweave-reindex [--all] [--files=path1,path2] [--stdin]\n```\n\n## Manual Setup\n\nIf you prefer step-by-step instead of `npx @codeweave/mcp`:\n\n```bash\n# 1. Install globally\nnpm install -g @codeweave/mcp\n\n# 2. Install Ollama and pull the embedding model\n# macOS\nbrew install ollama\n# Linux\ncurl -fsSL https://ollama.com/install.sh | sh\n\nollama pull qwen3-embedding:0.6b\n\n# 3. Index your project\ncd your-project\ncodeweave-init\n```\n### 4. Configure your MCP client\n\n**Claude Code** — add `.mcp.json` to your project root:\n\n```json\n{\n  \"mcpServers\": {\n    \"codeweave\": {\n      \"command\": \"codeweave-server\"\n    }\n  }\n}\n```\n\n**VS Code** — add `.vscode/mcp.json`:\n\n```json\n{\n  \"servers\": {\n    \"codeweave\": {\n      \"command\": \"codeweave-server\"\n    }\n  }\n}\n```\n\n## Monorepo Support\n\nCodeWeave auto-detects workspaces in monorepos by scanning for manifest files (`package.json`, `build.gradle`, `pom.xml`, `go.mod`, `Cargo.toml`, `pyproject.toml`, etc.):\n\n```\nmy-project/\n├── backend/build.gradle    → workspace \"backend\"\n├── mobile/package.json     → workspace \"mobile\"\n└── shared/package.json     → workspace \"shared\"\n```\n\nEach 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.\n\n## Git Worktree Support\n\nCodeWeave 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.\n\n- **Automatic** — no configuration needed\n- **Isolated** — worktree changes don't affect the main repo's cache\n- **Incremental** — only files that differ from the main branch are re-parsed and re-embedded\n\n## Requirements\n\n- **Node.js 20+**\n- **Ollama** — for semantic search embeddings. Install via the setup wizard or manually from [ollama.com](https://ollama.com). Without Ollama, semantic search falls back to full-text only.\n\n## Status\n\nCodeWeave is under **active development**. The core indexing pipeline and all 3 tools are stable and tested across production codebases in all 7 supported languages.\n\nFeedback, bug reports, and contributions are welcome — open an issue at [github.com/semihkayan/codeweave-mcp](https://github.com/semihkayan/codeweave-mcp/issues).\n\n## License\n\n[Apache 2.0](LICENSE)\n",
  "bytes": 12167,
  "sha": "b07eb572e153110c6ab16011380bfce8237d02bfa68feaa40a0fe749077be2f3",
  "repo_slug": "semihkayan/codeweave-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_semihkayan_codeweave_516c724a/readme"
}