# code-index [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/Regsorm/code-index-mcp  
**GitHub Stars:** 161  
**npm Downloads (last month):** 5074  
**Views:** 9  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/code-index

## Description
Быстрый индексатор кода для AI-моделей. Rust + tree-sitter + SQLite. Мгновенный поиск по символам.

## Tools
Capabilities this server exposes over MCP:

- **search_function** — Full-text search across functions (name, docstring, body)
- **search_class** — Full-text search across classes
- **get_function** — Get function by exact name (case-insensitive fallback; **(v0.44.0)** on 0 matches returns `did_you_mean` with similar names)
- **get_class** — Get class by exact name (case-insensitive fallback; **(v0.44.0)** on 0 matches returns `did_you_mean` with similar names)
- **get_object_structure** — Structure of a 1C object. **v0.63.0:** object templates are now in the registry — a row `Catalog.X.Template.Y` with the owner, the template kind and a `content_indexed` flag (large templates stay out of the index, yet the template itself is visible and findable by name)
- **get_callers** — Who calls this function? **(v0.35.0)** each row carries the caller's source `path` (distinguishes same-named callers from different files). **v0.62.0:** for 1C configurations, form event handler bindings (`kind: form_binding`) are added to the code callers — such a procedure is run by the platform…
- **get_callees** — What does this function call? **(v0.35.0)** each row carries the source `path
- **find_path** — (v0.23.0)** Shortest path in the call graph between two functions `from`→`to` (iterative cycle-safe BFS over unique `calls` nodes, `max_depth=5`, any language). Returns path edges `[{caller, callee, line}]`. **v0.57.0:** an empty answer carries walk cut-off flags `walk_depth_exhausted` / `walk_node…
- **get_call_tree** — (v0.23.0)** Call tree from a `root` function up to `max_depth` (default 3). `direction`: `callees`/`down` (downstream) or `callers`/`up`. Flat edge list `[{caller, callee, line, depth, path}]` (**(v0.35.0)** `path` = source file of each edge) + nested `{name, children}` tree; `max_nodes` cap
- **find_symbol** — Search everywhere (functions, classes, variables, imports)
- **get_imports** — Imports by module or file
- **get_file_summary** — Complete file map without reading source
- **get_stats** — Index statistics
- **search_text** — Full-text search across text files
- **grep_body** — Substring or regex search in function/class bodies. Returns `match_lines` (first 3 line numbers) and `match_count` (total, if > 3). v0.7.0: optional `path_glob`, `context_lines
- **stat_file** — (v0.7.0)** Metadata of a single file: exists, size, mtime, language, lines_total, content_hash, indexed_at, category (`text`/`code`). **(v0.8.0)** adds `oversize: bool` for code files
- **list_files** — (v0.7.0)** Flat file listing with optional `pattern` (glob like `**/*.py`), `path_prefix`, `language`, `limit`. **v0.49.8:** `limit` defaults to 500; when more files match, the response carries `{truncated, total, shown, limit}` — previously the listing was cut off silently and looked complete
- **read_file** — (v0.7.0)** Read content of a file. Optional `line_start`/`line_end` (1-based, inclusive). Soft-cap 5000 lines or 500 KB, hard-cap 2 MB. **(v0.8.0)** works for **code files** too (`.py`, `.bsl`, `.rs`, `.ts`, etc.) — content stored in `file_contents` table (zstd). Oversize files (default > 5 MB) ret…
- **grep_text** — (v0.7.0)** Regex search over text-file content (REGEXP). Closes the FTS5 special-character gap. Optional `path_glob`, `language`, `context_lines`. Hard-cap 1 MB on response size
- **grep_code** — (v0.8.0)** Regex search over **code-file** content (`.py`, `.bsl`, `.rs`, `.ts`, etc.) via `file_contents` table (zstd-decode in Rust). Same parameters as `grep_text`: `regex`, `path_glob?`, `language?`, `limit?`, `context_lines?`. Since v0.66.0 both tools also accept `pattern` — a literal, case-in…
- **health** — MCP server health and connected repos
- **get_form_handlers** — Managed-form event handlers by `(owner_full_name, form_name)`. Owner accepted in both formats — `Document.X` and export-folder `Documents.X` (v0.31.0). **v0.54.0:** returns `(event, handler, element)` triples — `element` is the form item the handler belongs to (absent for form-level handlers); an o…
- **get_event_subscriptions** — All event subscriptions from `EventSubscriptions/*.xml`. Filters: handler module, event (Russian or English platform enum — `OnWrite`→`ПриЗаписи`), `source` — by source object (`Document.X`/`DocumentObject.X`/short name, v0.31.0). Unknown parameters are rejected with the list of valid filters; defa…
- **find_path_bsl** — Call-chain between two procedures via `proc_call_graph` (recursive CTE, max_depth=3). BSL-specific variant of the universal `find_path` — `proc_call_graph` carries `call_type` and procedure keys. **(v0.35.0)** `from`/`to` and procedure keys are `<rel_path>::<name>` (a bare name is accepted for unre…
- **search_terms** — Meaning-based procedure search (v0.30.0):** terms are filled mechanically at index time — words of the procedure name (CamelCase split), the owner object's name and synonym, the comment above the procedure; no LLM needed. Trigram FTS: word forms and 3+ character substrings work, case and ё/е are ir…
- **get_data_links** — Data-links graph (v0.10.0):** what an object references / what references it, via reference-typed attributes, register dimensions and tabular-section attributes (`data_links` table). `direction=out\
- **find_data_path** — Data-links graph (v0.10.0):** chain of reference links from one object to another (BFS over `data_links`, like `find_path` but for data, not calls). **v0.57.0:** on failure the answer distinguishes «no path» from «not enough hops» — flags `depth_exhausted`, `visited_nodes` and a ready call with a l…
- **get_register_writers** — Register recorders / document movements (v0.16.0):** for a register (`AccumulationRegister.Stock`) returns `writers` — documents writing movements; for a document — `writes_to` (target registers). From the declarative `<RegisterRecords>` set (recorder edges of `data_links`). One call covers both di…
- **get_object_profile** — Object passport in one call (v0.21.0):** the full portrait of an object — structure + forms + modules + data links — instead of a series of `get_object_structure`/`get_form_handlers`/`get_data_links`. The `sections` parameter (`['structure'\
- **find_references** — Impact map (v0.21.0):** everything that references an object, in one call — reverse `data_links` (structural refs from metadata) + `metadata_code_usages` (usages in `.bsl` code) + `role_rights` (roles holding rights on it), broken down by kind with samples (`limit`). **v0.55.0:** `section` (`data_r…
- **bsl_sql** — Arbitrary read-only SQL (v0.21.0):** a `SELECT`/`WITH` query over the repo's `index.db` for the long tail of metadata/graph questions that have no dedicated tool (roles/RLS, joins, aggregations). Guard: `SELECT`/`WITH` only + `Statement::readonly()` + row cap + timeout. Tables: `metadata_objects`,…

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

```json
"mcpServers": {
  "code-index": {
    "command": "npx",
    "args": ["-y","@regsorm/code-index-mcp"],
    "env": {
      "CODE_INDEX_HOME": ""
    }
  }
}
```

**Requires environment variables:** `CODE_INDEX_HOME` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What code-index does

code-index turns a repository into a searchable index for AI agents. It stores symbols, source text, relationships, and file metadata in SQLite, then serves query results over the Model Context Protocol. The index includes functions, classes, variables, imports, file summaries, and call relationships. Search can cover function names, documentation, bodies, classes, symbols, text files, or code-file contents.

The project also has an extended build for 1C:Enterprise 8.3 exports. It can analyze metadata objects, forms, event handlers, subscriptions, data links, register writers, object profiles, references, and BSL procedure relationships. The core package is intended for repositories without the 1C-specific enrichment layer.

## How it works

A background daemon builds and updates the index while the MCP serving process reads it. The server can expose one index across multiple sessions and repositories; each tool call accepts a repository alias. Initial indexing parses the source tree, while later changes are picked up incrementally. The indexer uses file metadata to check an existing index before starting work.

The server supports stdio, where an MCP client launches a process for a session, and HTTP through an embedded endpoint. The default HTTP listener binds to `127.0.0.1` and uses `/mcp`; network-facing deployments require allowed host names. HTTP is useful when several sessions or projects should share one server process.

Call-graph tools provide callers, callees, shortest paths, and bounded call trees. Data-oriented tools provide related object references and paths through 1C metadata links. File-reading tools include line ranges and response limits, while listing and grep tools support path, language, glob, regex, and context filters where applicable.

## Setup and configuration

On Windows, the project provides an installation script that downloads the latest release, creates a settings-file template, and can configure user-level autostart. Release archives are available for Windows, Linux, and macOS ARM64. The npm package installs a platform-specific binary and can start the server with:

```bash
npm install -g @regsorm/code-index-mcp
npx @regsorm/code-index-mcp serve --path /path/to/repository
```

The npm wrapper contains the build without 1C support. Its serving process requires the background daemon to be running with `npx @regsorm/code-index-mcp daemon run`, and `CODE_INDEX_HOME` must identify the installation or data location. Source builds require Rust 1.77 or newer. The 1C-enabled binary is built separately with the `bsl-indexer` package and its enrichment feature.

A stdio client configuration can launch `serve` directly. For HTTP, configure the MCP client with `http://127.0.0.1:8011/mcp` unless the listener port or host has been changed. When binding beyond loopback, configure allowed hosts through the server settings or `CODE_INDEX_ALLOWED_HOSTS`.

## Tools and capabilities

- Search functions, classes, symbols, text files, and code bodies with full-text, substring, or regular-expression queries.
- Retrieve exact functions and classes, with case-insensitive fallback and similar-name suggestions when available.
- Inspect file listings, file metadata, bounded file contents, imports, summaries, and index statistics.
- Traverse callers, callees, shortest call paths, and bounded call trees across indexed code.
- Query 1C forms, event subscriptions, object structures, data links, register writers, profiles, and references with the 1C-enabled build.
- Check server health and the connected repositories.

## Limitations and notes

The serving process reads the index; the background daemon is responsible for building it. If the daemon is offline, tools return a `daemon_offline` condition. File-reading responses have size limits: the soft cap is 5,000 lines or 500 KB, with a 2 MB hard cap. File listings default to 500 results and report truncation when more matches exist.

Large code files can be marked as oversized, and large 1C templates may remain outside the content index while still appearing as discoverable template records. Call-tree, call-path, and data-path queries are bounded by depth or node limits, so results can be incomplete when those limits are reached. The optional `code-index-guard` hook can direct Claude Code and Codex CLI toward indexed reads instead of ordinary file operations.

_Full upstream README: https://allmcps.com/mcp/code-index/readme_

