# @backbencher/brain [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/backbencher-hq/backbencher-brain  
**GitHub Stars:** 19  
**npm Downloads (last month):** 3030  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/backbencher-brain

## Description
Universal code intelligence: index any project with 50 language analyzers, query via CLI or any MCP host (Claude Code, Cursor, VS Code).

## Claude Desktop Quick Installation
Install path inferred — verify against the README before running it. Uses `npx` (confidence: medium):

```json
"mcpServers": {
  "brain": {
    "command": "npx",
    "args": ["-y","@backbencher/brain"]
  }
}
```

## Documentation

## What @backbencher/brain does

@backbencher/brain, also called `bb`, builds a local code index for a repository and makes that index available to command-line workflows, MCP hosts, and library consumers. Its analyzers cover 50 languages through Tree-sitter. The resulting SQLite database records symbols, relationships, cross-language edges, complexity information, framework and security-flow inputs, and optionally embeddings.

The design is local-first. Indexing does not require a server, account, or telemetry service. Network access is limited to an embedding provider that you configure and the upgrade check. Each project gets its own database under the `~/.bb` data directory by default.

## How it works

Run `bb index <directory>` to parse a repository and populate its project database. Re-running the command processes changed files rather than reparsing everything; `--force` rebuilds the index, while `--changed` performs an incremental pass. The command reports parsed, skipped, and unchanged files, discovered symbols and relationships, phase timings, and final index health.

The index can be queried with `bb search`, including symbol, content, file, and individual-symbol search modes. `bb stats` reports counts and the database path, while `bb status` and `bb health` expose run state, phase timings, freshness, and index health. Semantic retrieval is available through the `bb_ask` tool after setup. Embeddings are labeled by model, and retrieval does not mix rows from different vector spaces; a forced re-index is required when changing models.

The MCP mode runs in the foreground over stdio for as long as the host keeps the process open. There is no daemon, systemd unit, or background service to manage.

## Setup and configuration

Install the package globally with Node.js 18 or newer:

```bash
npm install -g @backbencher/brain@latest
bb --version
```

Then index a project and start using its queries:

```bash
bb index ~/my-project
bb search "calculateTotal" --dir ~/my-project
bb stats ~/my-project
bb health ~/my-project
```

Run `bb setup` before using semantic retrieval. The optional `BB_DATA_DIR` variable moves the complete data directory, which is useful for containers, read-only home directories, or keeping indexes beside a repository. `BB_INDEX_CONCURRENCY` or `bb index --concurrency <n>` controls the parsing worker count.

The package also provides installer scripts for Linux, macOS, and Windows. Building from source requires `npm ci` and `npm run build`; Bun can run the source development path.

## Tools and capabilities

- Index repositories using 50 Tree-sitter language analyzers.
- Preserve symbols, relationships, cross-language links, complexity data, and selected analysis inputs in SQLite.
- Search symbols, content, files, or a specific symbol from the CLI.
- Query indexed code through the stdio MCP server, including the `bb_ask` semantic retrieval tool.
- Inspect project counts, database paths, run status, timing data, health, and file freshness.
- Re-index incrementally or rebuild from scratch with explicit indexing modes and controls.

## Limitations and notes

Node.js 18 or newer is required for the npm installation, which uses the native `better-sqlite3` module. Supported platforms include Linux, macOS, and Windows on x64 and arm64; WSL users should use the Linux path and index files within the Linux filesystem for better performance.

SQLite uses WAL mode, so the data directory must support creation, renaming, and locking of the database, WAL, and shared-memory files. Network filesystems with unreliable POSIX locking are not supported. Indexing runs in the foreground, and memory use increases with parser concurrency and file size.

A semantic query does not search embeddings written by another model as though they belonged to the same vector space. Re-run indexing with `--force` to re-embed when changing embedding models. The local fallback can provide semantic retrieval without an API key.

_Full upstream README: https://allmcps.com/mcp/backbencher-brain/readme_

