[package]
name = "heliosdb-codekb-mcp"
version = "0.2.6"
edition = "2021"
description = "Local MCP server for code+docs knowledge bases, embedding HeliosDB-Nano as a library."
license = "Apache-2.0"
repository = "https://github.com/HeliosDatabase/HeliosDB-CodeKB-MCP"
exclude = [
    "bench/__pycache__/**",
    "docs/**",
]

# Standalone — explicit empty workspace so Cargo doesn't try to attach
# this crate to any parent workspace (helps when sitting next to a
# git checkout that has its own workspace).
[workspace]

[[bin]]
name = "heliosdb-codekb-mcp"
path = "src/main.rs"

[features]
default = ["native-binary-docs"]

# Pure-Rust binary-doc decoders (pdf-extract / docx-rs / calamine).
# On by default; opt out with `--no-default-features` for a leaner
# binary on hosts that only ingest code + markdown + plain text.
native-binary-docs = ["dep:pdf-extract", "dep:docx-rs", "dep:calamine"]

# Routes PDF / Office / audio / image ingestion through the engine's
# graph_rag::ingest_pdf / _office / _audio / _image, which POST to
# a docling-serve HTTP endpoint. Adds layout-aware tables, OCR, and
# audio transcription. Compatible with `native-binary-docs` (Docling
# wins for the formats it supports; native handles fallbacks).
docling = []

# Enables the `helios_semantic_filter` wrapper. Today a no-op flag —
# the wrapper handler is stubbed with an explanatory error until the
# engine publishes the `vector-persist` feature on crates.io (branch
# `feat/persistent-pq-hnsw`, validated in
# NANO_PERSISTENT_PQ_HNSW_ADOPTION.md). Once the engine publishes,
# re-declare this feature as `["heliosdb-nano/vector-persist"]` and
# rewrite `wrappers::semantic_filter_handler` to call the live API.
wrappers-semantic = []

[dependencies]
# Version requirement: any 3.x ≥ 3.22.2 (caret-style). Pinned to the
# 3.x major because the engine's MCP/code-graph/graph-rag surface
# is a 3.x-stable contract. Run `cargo update -p heliosdb-nano` to
# refresh the lockfile to the latest compatible publish.
heliosdb-nano = { version = ">=3.22.2, <4", features = [
    "code-graph",
    "graph-rag",
    "mcp-endpoint",
    "code-embed",
] }

clap = { version = "4", features = ["derive"] }
tokio = { version = "1", features = ["macros", "rt-multi-thread", "io-std", "sync", "net", "signal"] }
# HTTP transport for the MCP server (Cursor / Continue / non-stdio
# clients).  Version locked to the engine's axum so the `Router`
# returned by `mcp_router` can be bound directly.
axum = "0.7"
serde = { version = "1", features = ["derive"] }
toml = "0.8"
anyhow = "1"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
directories = "5"
serde_json = "1"

# Source-tree walker that respects .gitignore + skips hidden dirs.
# Same crate ripgrep uses.
ignore = "0.4"

# Glob matcher for `.gitattributes linguist-generated` patterns.
# Already in our tree via `ignore`; promoted to a direct dep so we
# can build our own GlobSet from gitattributes lines.
globset = "0.4"

# Native ingestion tier (no Docling). Pure Rust, no system deps.
# Each is `optional` so building with --no-default-features omits
# them entirely.
pdf-extract = { version = "0.7", optional = true }
docx-rs     = { version = "0.4", optional = true }
calamine    = { version = "0.24", optional = true }

# Tiny synchronous HTTP client for `status --mcp-url` (live cache
# stats from a running `serve --http ...`) and the http_transport
# contract test. Already in our tree via fastembed; pinned without
# default features (no TLS — loopback only).
ureq = { version = "2", default-features = false, features = ["json"] }

# Used by `crate::linker` to stream multi-row INSERT batches to a
# bounded-memory tempfile before the bulk-apply pass. Also pulled in
# transitively by the engine for its own temp scratch, so we're not
# adding a new build-graph cost — just promoting from dev-deps.
tempfile = "3"

# `setsid(2)` for the background-quality child detach + `kill(pid, 0)`
# liveness probe for the status reporter. Direct dep; the engine
# already pulls libc transitively.
[target.'cfg(unix)'.dependencies]
libc = "0.2"

# Force vendored OpenSSL on Linux so cross-compilation (e.g. the
# release.yml `aarch64-unknown-linux-gnu` matrix entry, run via
# `cross`) doesn't need an arch-specific `libssl-dev:arm64` to be
# installed inside the cross container.  Cargo's feature unification
# pulls this `vendored` flag through to the transitive `openssl-sys`
# brought in by `reqwest` from the engine.  macOS uses Security
# framework (no openssl-sys), Windows uses schannel — neither
# affected.
[target.'cfg(target_os = "linux")'.dependencies]
openssl-sys = { version = "0.9", features = ["vendored"] }

[dev-dependencies]

[profile.release]
opt-level = 3
lto = true
codegen-units = 1
