MR

molaco/rust-code-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

32 stars 5 forks 质量 60 趋势 19

用于 Rust 代码语义混合搜索的 MCP 服务器 BM25 + 嵌入,包含树置、GPU 加速索引和 Merkle 树更新

概览

一个用于搜索和分析Rust代码库的MCP服务器。结合了混合的BM25 + 矢量搜索与基于Rust-analyzer的HIR驱动工作区,提供了45+工具,用于符号导航、呼号图遍历、结构审计和语义邻域查询。 网站 ·Discord ——欢迎分享你的使用情况;我们想听听大家的工作流程。 请参见 .docs/ARCHITECTURE.md 了解每个模块的分解,完整的 MCP 工具参考 TOOLS.md,.docs/configure-models-guide.md 了解嵌入模型配置,以及 THEORY.md 查看每个诊断映射的原理。

概述(AI 翻译)

一个用于搜索和分析Rust代码库的MCP服务器。结合了混合的BM25+向量搜索与基于Rust-analyzer的HIR驱动的工作区hypergraph,提供了45+工具,用于符号导航、呼号图遍历、结构审计和语义邻域查询。

链接: 网站 ·Discord ——欢迎分享你的使用情况;我们想听听大家的工作流程。

建筑

请参见 .docs/ARCHITECTURE.md 了解每个模块的分解,完整的 MCP 工具参考 TOOLS.md,.docs/configure-models-guide.md 了解嵌入模型配置,以及 THEORY.md 查看每个诊断映射的原理。

特色

  • 混合搜索 - BM25关键词搜索 + 语义向量相似度(RRF融合)
  • 可插拔嵌入模型 - 本地GPU(通过Candle/CUDA的Qwen3)、本地CPU(通过ONNX的BGE)或API支持的(OpenRouter);新API模型通过配置文件添加,无需重新编译
  • 符号导航 - Rust-analyzer 支持 find_definition / find_references / rename_symbol(重命名返回预览;不修改文件)

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

rust-code-mcp

An MCP server for searching and analyzing Rust codebases. Combines hybrid BM25 + vector search with a HIR-driven workspace hypergraph built on rust-analyzer, exposing 45+ tools for symbol navigation, call-graph traversal, structural audits, and semantic neighborhood queries.

Links: Website · Discord — come share how you’re using it; we want to hear about people’s workflows.

Architecture

See .docs/ARCHITECTURE.md for the per-module breakdown, TOOLS.md for the full MCP tool reference, .docs/configure-models-guide.md for embedding-model configuration, and THEORY.md for the principles each diagnostic maps to.

Features

  • Hybrid search - BM25 keyword search + semantic vector similarity (RRF fusion)
  • Pluggable embedding models - local GPU (Qwen3 via Candle/CUDA), local CPU (BGE via ONNX), or API-backed (OpenRouter); new API models are added through a config file with no recompile
  • Symbol navigation - rust-analyzer–backed find_definition / find_references / rename_symbol (rename returns a preview; no files are modified)
  • Persisted hypergraph - HIR-driven workspace snapshot (LMDB) with cross-crate imports, exports, re-exports, call edges, attributes, signatures, statics, and unsafe blocks
  • Call-graph traversal - who_calls / calls_from / call_graph / callers_in_crate / recursive_callers_count
  • Structural audits - dead public items, name collisions, module shadowing, forbidden cross-crate edges, Robert Martin instability/abstractness
  • Safety audits - unsafe_audit, mut_static_audit, recursion_check, channel_capacity_audit, fn_body_audit (unwrap/panic/lock-across-await detection)
  • Doc & API hygiene audits - missing_docs_audit, derive_audit, pub_use_pub_type_audit, re_export_chain
  • Semantic neighbors - similar_to_item and workspace-wide semantic_overlaps clustering via cached embeddings
  • Codemap - build_codemap produces a task-conditioned subgraph (seeded by symbols, expanded over hypergraph edges) with Mermaid + outline rendering
  • Complexity metrics - LOC, cyclomatic complexity, function counts
  • Incremental indexing - Merkle-tree change detection; background re-sync every 5 minutes

Tools

45+ MCP tools grouped by category. Full parameter reference in TOOLS.md.

Category Tools
Query search, get_similar_code, read_file_content
Symbol analysis find_definition, find_references, rename_symbol, get_dependencies, get_call_graph, analyze_complexity
Index lifecycle index_codebase, health_check, clear_cache
Hypergraph build build_hypergraph
Imports / exports get_imports, get_exports, get_reexports, get_declared_reexports
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "rust-code-mcp": { "command": "/absolute/path/to/rust-code-mcp" } } }