Skip to main content

Local Codebase Indexer

English | 繁體中文 | 简体中文

Which C# code and pages reach this SQL Server table?

Trace tables and stored procedures to repositories, controller actions, and Razor pages in a local source tree. Use the CLI yourself or give your AI assistant the same evidence through MCP. Especially useful when maintaining C# / SQL Server applications with Dapper, ADO.NET, or Entity Framework.

A 32-second walkthrough tracing SQL Server access to C# and a Razor page

Case study and raw results · CLI reference · PyPI · MIT license

Try it in three steps

Python 3.10+. Run these in a virtual environment; no SQL Server, .NET runtime, model download, or API key is needed for the demo.

1. Install

python -m pip install --upgrade local-codebase-indexer

If Python reports an externally managed environment, create and activate a virtual environment first. See the reference for isolated installation alternatives.

2. Run the bundled example

local-codebase-indexer demo

This creates a temporary synthetic source tree, indexes it, and checks four expected relationships. It does not index your current directory. The animation uses this command's actual output, with reading pauses added. An excerpt:

table Sales_OrderHeader
  WRITTEN BY (2)
    [confirmed] procedure dbo.usp_ApproveOrder
    [confirmed] method Shop.Data.OrderRepository.Approve ... via usp_ApproveOrder
  READ BY (1)
    [confirmed] method Shop.Data.OrderRepository.Get
  USED BY PROGRAMS (1)
    [probable] Orders ... (Approve, Details)
        pages: Views/Orders/Details.cshtml
Verified 4/4 expected relationships: PASS

Use local-codebase-indexer demo --output demo-orders to keep a copy in a new or empty folder, or demo --json for the complete report.

3. Point it at your source tree

local-codebase-indexer --root "/path/to/project" data-access YourTable

Replace the path and table name. The first query builds the index; subsequent queries refresh it incrementally. SQL definitions must be present in source files for procedure bodies to be analyzed. There is no connection to a live database.

Give the same evidence to your assistant

For Claude Code, after installing the package:

claude mcp add local-indexer -- local-codebase-indexer --root "/absolute/path/to/project" serve

Ask: “Which code writes YourTable, and which controller actions and pages reach it? Show paths and confidence levels.” Restart/reconnect the MCP client if needed. For other stdio MCP clients, use command local-codebase-indexer and arguments --root, your absolute project path, serve.

Codex / Copilot can use the CLI. AGENTS.md contains assistant instructions. The reference also covers the Claude Code plugin, seven MCP tools, ONNX models, aliases, and configuration.

More maintenance questions

local-codebase-indexer --root "/path/to/project" relations OrderRepository.Approve --direction upstream
local-codebase-indexer --root "/path/to/project" impact main...HEAD
local-codebase-indexer --root "/path/to/project" search "order approval" --explain --limit 5
local-codebase-indexer --root "/path/to/project" doctor

Relations show callers; impact compares Git snapshots; search combines identifiers, text, and local embeddings. C#, Python, JavaScript, and TypeScript have symbol parsing; T-SQL and C# have additional data-access analysis. Add --json for structured output.

What to verify

  • This is static analysis, with confidence labels. Interface dispatch can be probable; name-only candidates and dynamic SQL require source verification. There is no Roslyn overload resolution or runtime execution proof.
  • The default hashing embedder is best at identifiers and related terms. Natural-language paraphrases can miss results. Benchmarks and the case study explain what was measured; four demo checks do not establish general accuracy or time savings.
  • The index is local at <project>/.ai_context/indexer.db. Indexing needs no remote service after dependencies are installed. Your MCP client's model provider controls where returned context is sent.
  • Start with a table or procedure that you know. If files are missing, run doctor --path path/to/file.cs; check .gitignore and .ai_context/ignore. See known limitations and planned work.

Found a wrong edge or missing result? Open a reproducible issue. Contributions are welcome. Licensed under MIT.

SQL / Unicode / VB6 support and upgrade notes

Metadata

Release files for local-codebase-indexer 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for local-codebase-indexer 0.9.0
File Size Uploaded Provenance Actions
local_codebase_indexer-0.9.0.tar.gz 373.1 kB With provenance Details for local_codebase_indexer-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for local-codebase-indexer 0.9.0
File Interpreter ABI Platform Actions
local_codebase_indexer-0.9.0-py3-none-any.whl Python 3 none any Details for local_codebase_indexer-0.9.0-py3-none-any.whl

Total release size: 480.3 kB

Release files / local_codebase_indexer-0.9.0.tar.gz

Download URL local_codebase_indexer-0.9.0.tar.gz
Size 373.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f5045eec80b037426a5f4457c7b6fbafbb44b745d634a600f6c26bf76adc76ac
BLAKE2b-256 checksum
How to use checksums
bb658efc15f71488d245cacd39a2221c662bcd1e7c59c4b319192bf2c8de9e1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / local_codebase_indexer-0.9.0-py3-none-any.whl

Download URL local_codebase_indexer-0.9.0-py3-none-any.whl
Size 107.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
570cb78da1b019ae9ebb2cfa34109b2e7b0d7b2a8122f2af90cce6612bcbf85f
BLAKE2b-256 checksum
How to use checksums
fa5b22af5a8d893cc06914306cb122ff9de601ab5df726e5d493928dc60e1f5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for local-codebase-indexer 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for local_codebase_indexer-0.9.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page