1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// SQL Server 2025 - master/msdb/sandbox combined catalog MCP server.
//
// Single source of truth for embedding computation. bin/populate_embeddings.rs
// (indexing time) and tools/search_tool.rs (live query time) both call
// `embed()` from here, so the two are structurally guaranteed to share the
// same model and vector space.
//
// mcpify's originally-generated `all-mpnet-base-v2` at its native 768
// dimensions -- also mcpify's own generator hard-code for the
// `semantic_endpoints` vec0 table's column width (`mcpify/src/db/schema.rs`,
// not something this project's source controls), so this module's model
// and every `mcp_store*.db.zst` file mcpify produces always agree on
// dimension with no extra resize step needed between a `mcpify sync` and
// `populate_embeddings`.
//
// A smaller 384-dim model (`all-MiniLM-L6-v2`) was tried at one point to
// fit crates.io's 10 MiB package-size limit, back when this project's
// stores were committed uncompressed -- with 4 SQL Server versions each
// embedding ~700-800 operations, 768-dim float32 vectors alone pushed the
// packaged crate right to that limit. Since then the stores were switched
// to zstd-compressed (level 19) `.db.zst` embeds (see src/data/store.rs),
// and re-measuring `cargo package` at 768-dim against the current catalog
// came back at 8.5 MiB compressed -- comfortably under the limit again
// (embedding vectors themselves are close to incompressible, so the
// compression gain comes from the surrounding relational/schema data, not
// the vectors) -- so the switch back to the full 768-dim model for better
// `search` tool relevance was safe to make permanent.
use ;
use ;
/// Computes a 768-dim embedding vector for `text`, mean-pooled and
/// normalized (fastembed's default behavior for this model, replicating
/// the sentence-transformers reference implementation).