Skip to main content

CodeScry local codebase index with MCP retrieval tools

Project description

CodeScry logo

CodeScry

CodeScry is a local codebase retrieval tool for coding agents. It indexes committed code from local git repos into a local SQLite database, then exposes ranked snippets through a CLI and MCP stdio server.

Install

From PyPI with pipx:

pipx install codescry

With npm/npx, after installing uv:

npx codescry doctor

The npm package is a thin wrapper around the Python package. It does not bundle local SQLite index data.

For development:

python -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'

Check local readiness:

codescry doctor

First success path

For a deterministic five-minute smoke test, see docs/getting-started.md.

Index this repo or another local git repo:

codescry index /path/to/git/repo

Query it:

codescry query "where is request retry handled" -k 5

Lookup a symbol:

codescry get-symbol RepoIndex --repo /path/to/git/repo

Discover and index every git repo under a root:

codescry index-root ~/code

Show indexed repos and freshness:

codescry status

MCP setup

Run the MCP server over stdio:

codescry serve

Agent config example:

{
  "mcpServers": {
    "codescry": {
      "type": "stdio",
      "command": "/Users/YOU/.local/bin/codescry",
      "args": ["--db", "/Users/YOU/.codescry/index.sqlite", "serve"],
      "env": {}
    }
  }
}

npm/npx config example:

{
  "mcpServers": {
    "codescry": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "codescry", "--db", "/Users/YOU/.codescry/index.sqlite", "serve"],
      "env": {}
    }
  }
}

Use which codescry to find the absolute command path for your machine when using direct CLI installs.

Freshness hooks

Install hooks for one repo or a repo root:

codescry install-hooks /path/to/git/repo
codescry install-hooks ~/code --recursive

Hooks run best-effort after commit/merge:

codescry --db <db> reindex "$PWD"

They preserve the selected DB path and must not fail git commands.

Docs

  • docs/getting-started.md — install to first useful query.
  • docs/mcp-clients.md — MCP config examples.
  • docs/troubleshooting.md — common setup/query/freshness issues.
  • docs/cli-reference.md — command reference.
  • docs/output-schema.md — JSON fields.
  • docs/evals.md — eval authoring and gate.
  • docs/pilot.md — 5-engineer pilot measurement plan and local reporting commands.
  • docs/language-support.md — parser/regex/window support matrix.
  • docs/recipes.md — common operations.
  • docs/upgrade-uninstall.md — lifecycle commands.
  • docs/release.md — PyPI-first and npm-wrapper release flow.

Evals

Phase 0 eval docs live in docs/phase-0-baseline.md. The seed golden set lives in evals/golden.codescry.jsonl.

Run the eval gate:

codescry eval evals/golden.codescry.jsonl . -k 10 --fail-under 0.85

Pilot proof

Pilot task/activation/miss events are recorded in ~/.codescry/usage.jsonl without snippets. Passive query logging is opt-in with CODESCRY_ENABLE_USAGE_LOG=1. Use:

codescry pilot report

See docs/pilot.md for activation, timing, miss capture, and decision gates.

Retrieval behavior

  • Python functions/classes/methods get parser-backed symbol metadata.
  • TS/JS/Go/Java/Rust/C/C++/SQL get Tree-sitter parser-backed symbol metadata.
  • Other common declaration patterns get regex-backed symbol metadata.
  • get_symbol uses stored symbol metadata before search fallback.
  • Search blends vector, lexical, symbol, and path scores.
  • Results include stale/dirty flags.

Data boundary and safety

  • Default embeddings are local deterministic hash vectors.
  • Default configuration does not send source code to external APIs.
  • Index data is local SQLite derived data and can be deleted/rebuilt.
  • Files matching high-confidence secret patterns are skipped and prior chunks for those paths are removed.
  • Secret skipping is a best-effort local guardrail, not a guarantee. See SECURITY.md.

Current limits

  • Python uses stdlib AST parser chunks; TS/JS/Go/Java/Rust/C/C++/SQL use Tree-sitter parser chunks; other languages use regex-backed symbol hints plus line windows.
  • Local deterministic hash embeddings, not quality-tuned semantic embeddings.
  • SQLite storage scans/scoring in Python, no ANN/vector extension yet.
  • Freshness is committed-code freshness; dirty working-tree edits are reported but not indexed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codescry-0.2.4.tar.gz (80.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codescry-0.2.4-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

Details for the file codescry-0.2.4.tar.gz.

File metadata

  • Download URL: codescry-0.2.4.tar.gz
  • Upload date:
  • Size: 80.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for codescry-0.2.4.tar.gz
Algorithm Hash digest
SHA256 ce9a4a89bb87511558906a6536daee6695313dfd63ef0f29e4fe07334a2d94d1
MD5 cbf0f1437c016c38f24ebba2d73008a0
BLAKE2b-256 851dfd0355a354fcb6ff54d7ae2c474d8b7694413143455fcfb4e2a1c72faf59

See more details on using hashes here.

File details

Details for the file codescry-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: codescry-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 40.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for codescry-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0a95e7fc316857a89a89d98a8b0a4161046e10b85e860c73f1df6e03f99f0c65
MD5 e1ce6525c5432528c339641dcab9f196
BLAKE2b-256 ec414bdf67067471bb2c0e4d47a26cc9daccfaa877b633a05432f5db406deb67

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page