# contextweaver [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/wchiway/contextweaver-mcp  
**GitHub Stars:** 2  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/contextweaver-2

## Description
Semantic code retrieval engine with hybrid search, context expansion, and 40+ language support.

## Tools
Capabilities this server exposes over MCP:

- **codebase-retrieval** — Primary tool**: hybrid semantic + exact-match retrieval
- **list-files** — List indexed file structure (path/language/size)
- **find-references** — Find heuristic text references to a symbol
- **get-symbol-definition** — Find likely definition blocks for a symbol
- **stats** — Index/search/health statistics

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "contextweaver": {
    "command": "npx",
    "args": ["-y","@chiway/contextweaver"],
    "env": {
      "EMBEDDINGS_API_KEY": "",
      "EMBEDDINGS_BASE_URL": "",
      "EMBEDDINGS_MODEL": "",
      "EMBEDDINGS_MAX_CONCURRENCY": "",
      "EMBEDDINGS_DIMENSIONS": "",
      "RERANK_API_KEY": "",
      "RERANK_BASE_URL": "",
      "RERANK_MODEL": ""
    }
  }
}
```

**Requires environment variables:** `EMBEDDINGS_API_KEY`, `EMBEDDINGS_BASE_URL`, `EMBEDDINGS_MODEL`, `EMBEDDINGS_MAX_CONCURRENCY`, `EMBEDDINGS_DIMENSIONS`, `RERANK_API_KEY`, `RERANK_BASE_URL`, `RERANK_MODEL` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What contextweaver does

The contextweaver MCP server turns a local codebase into a searchable index for AI coding assistants. Its primary retrieval path combines vector similarity with lexical matching, then merges the result sets using reciprocal rank fusion. This supports both natural-language questions and exact technical terms such as class, function, or method names.

Code is divided into semantic chunks using Tree-sitter parsing. The project lists support for TypeScript, JavaScript, Python, Go, Java, Rust, C, C++, C#, and additional languages. Retrieved context can include neighboring chunks, related items under the same breadcrumb path, and files reached through imports when import expansion is enabled.

The MCP surface includes `codebase-retrieval`, `list-files`, `find-references`, `get-symbol-definition`, and `stats`. The latter four provide structure browsing, heuristic symbol lookup, and operational information alongside semantic search.

## How it works

Run indexing from a project root or provide a project path explicitly. The first query can trigger indexing automatically, while later changes can be handled incrementally. The optional watch command observes filesystem changes and starts debounced incremental scans.

Search uses embeddings, full-text matching, and reranking. A dynamic cutoff determines how many results to retain, while a total-character limit controls the size of the returned context. The retrieval pipeline also has an in-process LRU query cache; cache entries are invalidated when the index or relevant search configuration changes.

The index stores vectors and location metadata in LanceDB while source content remains in SQLite-backed file storage.

## Setup and configuration

Install the package globally with npm or pnpm, then run `contextweaver init` or `cw init` to create `~/.contextweaver/.env`. Node.js 20 or newer is required. Embedding and reranking configuration must be supplied, including API keys, service URLs, and model names. Search weights, result limits, character limits, import expansion, and ignored paths are configurable through environment variables.

Index a project with `contextweaver index`, optionally passing a path or `--force`. Start the MCP transport with `contextweaver mcp`. The repository shows a Claude Desktop configuration and VS Code installation links using the `contextweaver mcp` command.

## Tools and capabilities

- `codebase-retrieval`: searches with semantic and exact-match signals, reranking, context expansion, and result packing.
- `list-files`: reports indexed paths, languages, and file sizes, with CLI support for glob, language, and count filters.
- `find-references`: finds heuristic text references to a symbol and can exclude the definition.
- `get-symbol-definition`: locates likely definition blocks, with an optional path hint.
- `stats`: reports indexing, search, and health information through MCP or the CLI.

The contextweaver MCP server also provides command-line mirrors for search, file listing, symbol definitions, references, statistics, migration management, and filesystem watching.

## Limitations and notes

Retrieval quality depends on the configured embedding and reranking services, so those services and their credentials are needed for semantic search. Symbol references are described as heuristic text matches, and definitions are described as likely blocks rather than compiler-verified symbols. Import expansion is configurable and can add cross-file context.

The documented setup is local command-line indexing with a local MCP process. Ignored paths can be configured, and excluded paths do not trigger watch-mode scans.

_Full upstream README: https://allmcps.com/mcp/contextweaver-2/readme_

