经 AI Skill Hub 精选评估,Vex代码搜索 获评「推荐使用」。这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.5 分,适合有一定技术背景的用户使用。
Vex代码搜索 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
Vex代码搜索 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/tenatarika/vex
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"vex----": {
"command": "npx",
"args": ["-y", "vex"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 Vex代码搜索 执行以下任务... Claude: [自动调用 Vex代码搜索 MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"vex____": {
"command": "npx",
"args": ["-y", "vex"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
Fast hybrid structural + semantic code search. Vector + index.
Why Vex? · How It Compares · Installation · Quick Start · Commands · Configuration · How Search Works · Benchmarks · Supported Languages · Integration · Testing · Architecture
$ vex check "TelemetryProcessor" # 4ms — does it exist? where? (exact name)
$ vex show "TelemetryProcessor" # extract the class body (not the whole file)
$ vex usages "Config" --strict # who references this symbol? (binder-resolved, no noise)
$ vex callers "process_event" # who calls this function? (~4ms; covers module-scope + Python/Java decorators)
$ vex implementations "BaseService" # who extends/implements this?
$ vex search "timeout retry" # fuzzy / multi-word — BM25 finds rare body terms
$ vex search "handle alert" --semantic # find by meaning, not just name
$ vex pattern 'fn $NAME($$$) -> Result' # AST pattern matching (like ast-grep)
$ vex similar "PaymentService" # semantically close symbols
$ vex duplicates --threshold 0.95 # near-duplicate pairs
$ vex bundle --mode symbol --symbol Foo # body + callers + callees + similar in 1 call
Pick the right tool: vex check for "does Foo exist?", vex search for "find me something about retries". search is a ranked blend — it surfaces neighbors (callers / imports) when no symbol literally matches, which is great for exploration and wrong for exact-name lookup. v1.15.0 prints a stderr hint when an identifier-shaped search returns 0 FST hits.
vex similar "PaymentService" --limit 5 --min-score 0.7 --explain
```bash
vex gpu # probes the compiled-in EP with strict registration vex gpu cuda # narrow to one EP vex gpu --enable # persist working device to VEX_DEVICE
brew tap tenatarika/tap && brew install vex
cargo build --release -p vex-mcp
```bash
vex usages "IndexReader" --strict
References stored in an FST (Finite State Transducer) — zero-copy lookup from mmap with prefix search support.
$ rg -w "PreAggregatedConfig" . ./models.py:3602:class PreAggregatedConfig(models.Model): ./models.py:3610: pre_aggregated_config = PreAggregatedConfig.objects.get(...) ./serializers.py:48:from .models import PreAggregatedConfig ./tests.py:12: config = PreAggregatedConfig(...) ... (16 more lines)
vex bundle --mode symbol --symbol PaymentService # body + callers + callees + similar vex bundle --mode pr-impact --base origin/main # changed symbols + transitive callers + tests vex bundle --mode project --top-n 30 # top-N by reverse call-graph indegree
Create a .vex.toml in your project root to customize vex behavior:
vex init # generates .vex.toml with commented defaults
```toml
Don't want a .vex.toml inside the repository (can't .gitignore it, shared checkout, etc.)? vex never creates one on its own — only vex init writes it — and you have two ways to keep config external:
- --config <path> / $VEX_CONFIG — point vex at a config file anywhere on disk. It replaces the in-repo lookup entirely, so the repo stays clean:
vex --config ~/vex/this-repo.toml search Foo
export VEX_CONFIG=~/vex/this-repo.toml # or set it once per shell
--config beats $VEX_CONFIG; a missing/invalid path is a hard error (vex won't silently fall back). Relative paths inside that file resolve against the file's own directory. - A parent directory — config lookup walks up from the project to the filesystem root, so a .vex.toml placed in any ancestor (e.g. ~/work/.vex.toml, or ~/.vex.toml for a machine-wide default) is picked up for every repo beneath it, with none living in the repos themselves.
The index itself is never written into the repo — it lives in the cache dir (--cache-dir / $VEX_CACHE_DIR / platform cache), so a clean repo is just a matter of config placement.
| Variable | Effect |
|---|---|
VEX_DEVICE | Global default device (cpu/auto/cuda/directml/coreml) for all projects. Below --device/--gpu and .vex.toml in precedence. |
VEX_EMBEDDER | Global default embedder id (e.g. jina-code). Below --embedder and .vex.toml. An unknown id falls back to the default embedder with a warning. |
VEX_GPU_STRICT=1 | Turn ORT's silent CPU fallback into a hard error — proves whether the GPU engaged. (vex gpu requests the same strict mode internally, without touching the environment.) |
VEX_GPU_MEM_LIMIT=<bytes> | Advanced: hard cap on the GPU arena VRAM. Set it generously (≥ working set) or it OOMs on long-context batches. |
VEX_GPU_ATTN_BUDGET=<n> | Advanced: tune length-aware batch sizing (the count × max_len² budget). |
vex search "Foo" --format json ```
Pin a different default in .vex.toml via format = "text" if you want the verbose multi-line view at the terminal.
Every --format json subcommand wraps its payload in the Phase 13 envelope. Single shape, easy to detect via protocol_version:
{
"protocol_version": "v1",
"capabilities": { /* see `vex capabilities` */ },
"_meta": { "vex.dev/index_age_ms": 1200, "ttlMs": 30000, "cacheScope": "project" },
"results": [ /* the actual data, shape depends on the subcommand */ ]
}
Pre-v1.11 only search and bundle returned this envelope; the other ~14 subcommands (show, usages, pattern, grep, implementations, callers, callees, paths, reachable, tests-for, check, similar, duplicates, diff, outline, index, update, status, eval) emitted bare arrays / objects. Migration: pre-1.11 jq '.[0].name' or data[0]['name'] now needs jq '.results[0].name' / data['results'][0]['name']. Detect the envelope via response.get('protocol_version') == 'v1' to support both shapes during a rollout window.
{ "mcpServers": { "vex": { "command": "/path/to/vex-mcp", "env": { "VEX_ROOT": "/path/to/your/project", "VEX_DEVICE": "auto" } } } } ```
VEX_DEVICE (v1.16.0) picks the GPU execution provider when the binary was built with gpu-cuda / gpu-directml / gpu-coreml — relevant when an MCP-driven index / update call rebuilds semantic embeddings on a large repo (51× CUDA / 29× DirectML over CPU on MiniLM-L6). auto is safe on CPU-only builds (degrades silently). Run vex gpu once to confirm the EP actually engages.
MCP Tools (27): - search — 3-way hybrid (structural + BM25 + semantic); accepts filter / include / exclude / kind / context_path / no_bm25 / --why / metadata filters / diff-scope (since / since_branched / changed_only) - find_symbol — exact name lookup - find_similar — semantic search by free-form description - similar — nearest neighbors of an existing symbol (explain adds Jaccard + diff); diff-scope - duplicates — near-duplicate symbol pairs (explain shows what differs); diff-scope - show — extract symbol body fr
vex implementations "Iterator"
vex pattern 'interface $N || class $N' --lang typescript
The recommended way to integrate vex with Claude Code is via CLAUDE.md rules (see below). Vex runs as a CLI tool — Claude Code calls it directly via Bash, no MCP server needed.
Setup:
```bash
| **vex** | **ripgrep** | **ast-index** | **ast-grep** | **Serena** | |
|---|---|---|---|---|---|
| **What it searches** | Symbol definitions | All text | Symbol definitions | AST patterns | Symbols (via LSP) |
| **Requires indexing?** | Yes (~0.3-1s) | No | Yes (faster build) | No | No |
| **Search speed** | **~4-5ms** (pre-built FST, constant) | scales w/ corpus (~8ms small → 100ms+ large) | ~8-12ms (SQLite) | ~30ms (scan) | LSP-dependent |
| **Semantic search** | HNSW + embeddings | -- | -- | -- | -- |
| **Pattern matching** | fn $NAME($$$) | regex only | -- | fn $NAME($$$) | regex only |
| **Index size** | **~1.5-2x smaller** than ast-index | no index | SQLite + FTS5 | no index | no index |
| **Token efficiency** | **6-88x** fewer than rg | baseline | ~3x fewer than rg | N/A | N/A |
| **Symbol body extraction** | vex show | -- | -- | -- | -- |
| **Languages** | 19 | any | 10+ | 10+ | 40+ (LSP) |
| **Refactoring** | -- | -- | -- | -- | rename, move, inline |
| **Runtime deps** | none | none | none | none | Python + LSP |
Note: vex search speed assumes a pre-built index. Ripgrep and ast-grep require no upfront indexing and work immediately on any directory. The tradeoff is amortized: if you search the same codebase many times (typical in agent workflows), the one-time indexing cost pays for itself.
Best for: fast symbol search in AI agent workflows where token efficiency matters. Not a replacement for LSP-based tools (no refactoring, no go-to-definition in dependencies).
Medium project (ast-index repo, 31K lines Rust, avg 10 runs):
| Query | vex | ast-index | rg -w | vex vs rg |
|---|---|---|---|---|
search | **4.7 ms** | 8.3 ms | 9.2 ms | **2.0x** |
SymbolKind | **4.6 ms** | 8.2 ms | 8.6 ms | **1.9x** |
parse_file | **4.6 ms** | 7.9 ms | 8.7 ms | **1.9x** |
IndexReader | **4.7 ms** | 11.7 ms | 8.6 ms | **1.8x** |
Key takeaway: vex search is constant ~4-5 ms (FST O(query_len)) regardless of project size — this is the win the slower index build pays for. The ripgrep comparison is not apples-to-apples: rg scans raw text with no index, so it scales with corpus size (single-digit ms on this 31K-line repo, 100 ms+ on large ones), while vex does a pre-built FST lookup. The durable advantage is amortized and qualitative: vex returns only symbol definitions (precise, token-efficient), while rg returns every text occurrence (noisy, expensive in LLM contexts).
The latency figures below were measured on an earlier build and not re-run in the v1.25.1 pass — read them as the scaling shape (HNSW stays flat, brute-force grows linearly), not current absolutes.
Semantic search embeds the query via ONNX (~55ms) then searches stored vectors. HNSW (usearch) replaces brute-force O(N) scan with O(log N) approximate nearest neighbor search:
| Symbols | Brute-force | HNSW | Speedup |
|---|---|---|---|
| 333 | ~3 ms | ~3 ms | 1x |
| 11K | ~8 ms | ~3 ms | **2.3x** |
| 20K | ~11 ms | ~3 ms | **4x** |
| 100K (projected) | ~55 ms | ~3 ms | **~18x** |
HNSW stays constant ~3ms regardless of index size. Brute-force grows linearly. Total semantic search latency is dominated by ONNX embedding (~55ms), so end-to-end speedup is modest for small codebases but critical at scale.
| Mode | Latency |
|---|---|
| Structural only | ~4 ms |
| Hybrid (structural + semantic) | ~58 ms (HNSW) / ~66 ms (brute-force) |
Vex 是一个 Rust 项目,用于分析和理解代码结构。它提供了多种功能,包括语义相似度分析、代码搜索和代码重构。
Vex 的主要功能包括语义相似度分析、代码搜索、代码重构和集成开发环境 (IDE) 支持。它可以帮助开发者快速找到代码中的问题和优化点。
Vex 需要 Rust 1.88 或更高版本来编译和运行。它还需要一个 MCP 服务器来提供语义相似度分析和代码搜索功能。
可以使用 Homebrew 安装 Vex:brew tap tenatarika/tap && brew install vex。也可以从源码编译 Vex:cargo build --release -p vex-mcp。
Vex 的使用方法包括使用命令行工具来分析和理解代码结构。例如,可以使用 vex usages 命令来找到一个符号的所有使用位置。
Vex 的配置文件是 .vex.toml,位于项目根目录下。它可以用来自定义 Vex 的行为和功能。
Vex 提供了多个 API,包括 find implementations、pattern matching 和 Claude Code 集成等。这些 API 可以帮助开发者快速找到代码中的问题和优化点。
Vex 的工作流包括代码分析、代码重构和集成开发环境 (IDE) 支持。它可以帮助开发者快速找到代码中的问题和优化点,并且可以提高开发效率和质量。
Vex 的常见问题包括如何安装 Vex、如何使用 Vex 等。还包括如何解决 Vex 的常见问题和错误。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ MIT 协议 — 最宽松的开源协议之一,可自由商用、修改、分发,仅需保留版权声明。
AI Skill Hub 点评:Vex代码搜索 的核心功能完整,质量良好。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | vex |
| 原始描述 | 开源MCP工具:Hybrid structural + semantic code search for LLMs — compact output, MCP server, 。⭐7 · Rust |
| Topics | mcpastclaudecode-searchrust |
| GitHub | https://github.com/tenatarika/vex |
| License | MIT |
| 语言 | Rust |
收录时间:2026-06-05 · 更新时间:2026-06-06 · License:MIT · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端