Token导航 LogoToken导航TokenDH.com
Rustools MCP logo
开发工具未说明官方级别未说明来源级核验

Rustools MCP

MCP Server

一个上下文感知、学习型的 Rust 专家服务器,通过实时项目知识图谱和智能工作流编排,帮助开发者更快更好地编写 Rust 代码。

工具数

16

提示词数

0

GitHub Stars

3

资源数

0
代码分析RustClaudeClaude DesktopClaudeCursor

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

Zakarialabib

提供方

Zakarialabib

最后核验

2026/5/17 20:22

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

🧠 Rust AI助手MCP服务器

了解您项目的自主Rust合作伙伴。 🚀

rust-ai-assistant 不是另一个工具服务器,而是 具备情境感知和学习能力的Rust专家 它与您的AI编辑器集成。虽然现有的MCP服务器公开了工具,但该服务器构建了一个 实时项目知识图,主动识别问题,并编排智能工作流,以帮助您更快地编写更好的Rust代码。

🎯 问题与我们的解决方案

当前的Rust MCP服务器充当 被动工具箱:他们给法学硕士一个扳手,但不是蓝图。你的人工智能助手缺乏项目背景,无法从你的模式中学习,每一步都需要手动提示。

这个项目改变了范式。 这是一个 自主开发代理 基于三个核心层构建:

┌─────────────────────────────────────────────────────────┐
│                 AI Editor (Claude, Cursor)              │
└──────────────────────────────────┬──────────────────────┘
                                   │
┌──────────────────────────────────▼──────────────────────┐
│            REASONING & ORCHESTRATION LAYER              │
│  • Problem decomposition & tool chaining                │
│  • Context-aware suggestions & proactive monitoring     │
│  • Learning from developer patterns & decisions         │
└──────────────────────────────────┬──────────────────────┘
                                   │
┌──────────────────────────────────▼──────────────────────┐
│              UNIFIED CORE SERVICE LAYER                 │
│  • Single, robust connection to rust-analyzer           │
│  • Isolated dependency & documentation analysis         │
│  • Safe, sandboxed Cargo operation execution           │
└──────────────────────────────────┬──────────────────────┘
                                   │
┌──────────────────────────────────▼──────────────────────┐
│               PROJECT CONTEXT ENGINE                    │
│  • Live code analysis & knowledge graph                 │
│  • Architectural pattern recognition                    │
│  • Historical issue & solution tracking                 │
└─────────────────────────────────────────────────────────┘

✨ 革命性特征

🧩 智能项目环境(游戏规则改变者)

  • analyze_project_context:在一次调用中生成一个全面的项目知识图——架构、热点、依赖模式和定制建议。
  • 主动热点检测:自动标记复杂函数、常见错误模式和性能陷阱 *之前* 它们变成了问题。
  • 建筑模式识别:确定您是否正在构建REST API、CLI工具、游戏引擎或库,并相应地调整建议。

🤖 自主辅助模式

  • 连续监控:手表 cargo 输出、CI结果和文件更改,以提供上下文相关的帮助。
  • 思维链工具编排:The solve_problem 元工具分解复杂的请求,执行正确的工具序列,并合成连贯的解决方案。
  • 交互式REPL模式:会话界面,记住上下文,提出澄清问题,并提供教育性解释。

🛠️ 统一工具集成(全球最佳)

  • 稳定的锈蚀分析仪基础:使用经过实战测试的LSP客户端(受Zeenix方法的启发)进行可靠的代码分析。
  • 实时、版本锁定文档:独立的文档提取器(如Terhechte的),提供准确的、特定于项目的板条箱文档。
  • 安全货物编排:通过智能输出解析沙盒执行构建、测试和审计命令。
  • 智能高速缓存:多层缓存(moka +项目感知失效),以实现即时响应而不会过时。

📚 学习与适应系统

  • 模式识别:学习团队的惯例、首选板条箱和错误处理模式。
  • 决策反馈循环:根据您接受或拒绝的修复程序改进建议。
  • 团队知识共享:可选择在整个组织内共享匿名模式,以提高集体代码质量。

______________________________________________________________________

🚀 快速开始

安装

# Install from crates.io
cargo install rust-ai-assistant

# Or build from source
git clone https://github.com/yourusername/rust-ai-assistant.git
cd rust-ai-assistant
cargo build --release

# The binary includes both MCP server and interactive REPL
rust-ai-assistant --help

编辑器配置

添加到您的MCP客户端配置(Claude Desktop、Cursor等):

{
  "mcpServers": {
    "rust-ai-assistant": {
      "command": "rust-ai-assistant",
      "args": ["server", "--project-path", "/path/to/your/project"],
      "env": {
        "RUST_LOG": "info",
        "RUST_AI_ASSISTANT_MODE": "autonomous"
      }
    }
  }
}

首轮-项目入职培训

# 1. Let the assistant analyze your project
curl -X POST http://localhost:8080/tools/analyze_project_context \
  -H "Content-Type: application/json" \
  -d '{"scan_depth": "deep", "include_suggestions": true}'

# Response includes architectural insights, hotspots, and initial recommendations

______________________________________________________________________

🧭 用法:自主工作流

场景1:您刚刚克隆了一个新的代码库

传统方法:手动浏览目录,运行 cargo check猜猜建筑。

使用Rust AI助手:

// Your AI assistant automatically runs:
1. analyze_project_context() → Gets architecture, key files, dependencies
2. cargo_check() → Identifies compilation issues  
3. detect_patterns() → Flags unusual patterns or potential bugs
4. generate_onboarding_summary() → Creates tailored project overview

// Before you even ask, you get:
"📋 Project Analysis Complete:
 • Architecture: Axum web server with SSE, JWT auth, PostgreSQL
 • Hotspots: `src/auth/jwt.rs` (high complexity), `src/api/mod.rs` (circular ref risk)
 • Dependencies: 3 outdated, 1 with security advisory (chrono)
 • Test Coverage: 68% - missing auth integration tests
 Ready to help you navigate!"

场景2:调试复杂的借用检查器错误

传统方法:手册 rustc 错误解密、试错修复。

使用Rust AI助手:

// When cargo check fails with E0597:
[ASSISTANT PROACTIVE INTERVENTION]
"⚠️  Detected lifetime error in `src/processor.rs:127`
 The issue: Cannot borrow `*self` as mutable because `self.queue` is also borrowed.

 Context: This pattern appears 3 times in your codebase.
 Previous solutions that worked for your team:
 1. Use `Rc>` for shared mutable state (used in `src/cache.rs`)
 2. Restructure to separate borrowing (used in `src/engine/mod.rs`)
 3. Use async-friendly mutex (recommended for Tokio context)

 Suggested fix for this context (Tokio + async):
   - let item = self.queue.pop_front().await;  // ← Change to async pop
   - self.process(item).await;

 Apply this fix? [Y/n/explain_more]"

场景3:添加具有依赖关系的新功能

// You: "I need to add JSON Web Token authentication"
[ASSISTANT ORCHESTRATION]
1. Searches crates: `find_crates("jwt auth async")` → Finds `jsonwebtoken`, `jwt-compact`
2. Checks compatibility: `analyze_dependency_compatibility("jsonwebtoken", current_dependencies)`
3. Reviews patterns: `find_similar_implementations("auth", "jwt")` in your org's codebase
4. Generates implementation: `generate_auth_module()` with your team's preferred error handling
5. Sets up monitoring: Adds watch for common JWT security pitfalls

// Result: Complete, context-appropriate implementation in 1 minute

______________________________________________________________________

🛠️ 可用工具和功能

核心智能工具

工具输入输出自主触发
analyze_project_context{scan_depth, include_suggestions}ProjectKnowledgeGraph项目加载时的主要更改
solve_problem{description: "My async task is deadlocking"}Stepwise解决方案复杂的用户问题
proactive_suggestion_engine{context: current_file, recent_errors}SuggestionBatch文件保存,编译错误
learn_from_decision{issue, chosen_fix, rejected_fixes}UpdatedProfile用户接受/拒绝帮助后

统一开发工具

类别工具灵感来源
代码分析hover, definition, references, diagnostics, symbol_searchZeenix稳定的LSP客户
文档get_documentation, get_context_bundle, find_by_signature 版本锁定的文档。
货物作业cargo_check, cargo_test, cargo_clippy, cargo_audit, cargo_expand强大的沙盒执行
依赖关系管理dependency_graph, check_updates, security_audit, semver_checks综合情报

监控和警报工具

工具目的自主行动
watch_compilation监控构建输出自动解释新错误
track_performance配置文件回归标记>10%的减速
security_monitor关注新的建议警报+建议补丁
api_compatibility检测破坏性更改更新前发出警告

______________________________________________________________________

⚙️ 配置和定制

项目配置(rust-ai-assistant.toml)

[assistant]
mode = "autonomous"  # autonomous, interactive, or passive
intervention_level = "suggest"  # suggest, confirm, or auto_fix
learning_enabled = true
team_knowledge_sharing = false  # Enable for organizations

[project_context]
scan_on_startup = true
watch_for_changes = true
hotspot_threshold = 10  # Cyclomatic complexity threshold

[tools]
enable_cargo_operations = true
sandbox_level = "strict"  # strict, moderate, or permissive
timeout_seconds = 30

[cache]
strategy = "aggressive"
ttl_hours = 24
max_size_mb = 1024

团队知识库

在整个组织中共享模式:

# Export your team's successful patterns
rust-ai-assistant patterns export --output team-patterns.json

# Import into new projects
rust-ai-assistant patterns import --file team-patterns.json

______________________________________________________________________

🏗️ 建筑:构建未来

三层架构

1. Project Context Engine (Stateful)
   - In-memory knowledge graph of your project
   - Real-time AST analysis via rust-analyzer
   - Historical decision tracking
   
2. Unified Core Service Layer (Stateless)
   - Single point of truth for rust-analyzer
   - Isolated dependency analysis
   - Safe sandbox for Cargo operations
   
3. Reasoning & Orchestration Layer (Intelligent)
   - Problem decomposition engine
   - Tool chaining & workflow management
   - Learning & adaptation system

与现有MCP服务器集成

// Instead of replacing, we orchestrate
pub struct AssistantOrchestrator {
    lsp_client: ZeenixStyleClient,      // Stable analysis
    doc_fetcher: TerhechteStyleFetcher, // Accurate docs
    cargo_executor: SafeSandbox,        // Safe operations
    context_engine: ProjectKnowledgeGraph, // Our innovation
    learning_engine: PatternRecognizer,    // Our innovation
}

// The assistant chooses the best tool for each task
async fn handle_complex_request(&self, request: Problem) -> Solution {
    match request.category {
        ProblemCategory::CodeAnalysis => self.lsp_client.analyze(request),
        ProblemCategory::Dependency => self.doc_fetcher.fetch(request),
        ProblemCategory::Build => self.cargo_executor.execute(request),
        ProblemCategory::Architecture => self.context_engine.solve(request),
    }
}

可扩展性:插件系统

// Add your own analyzers
#[derive(AssistantPlugin)]
struct SecurityAnalyzer {
    rules: Vec,
}

impl ToolProvider for SecurityAnalyzer {
    fn tools(&self) -> Vec {
        vec![
            tool! { check_crypto_usage() },
            tool! { audit_unsafe_blocks() },
            tool! { detect_hardcoded_secrets() },
        ]
    }
}

// Register with the assistant
assistant.register_plugin(SecurityAnalyzer::new(rules));

______________________________________________________________________

📊 性能和可靠性

缓存策略

  • 一级缓存:内存中,项目特定(文件更改时清除)
  • 二级缓存:基于磁盘的版本化响应(TTL:24小时)
  • L3缓存:预取的普通板条箱文件
  • 智能失效:依赖关系更改时破坏缓存

资源管理

[resources]
max_memory_mb = 2048
max_concurrent_analyses = 4
rust_analyzer_memory_limit = "2GB"
network_timeout_seconds = 10
retry_attempts = 3

监控和指标

# Built-in observability
rust-ai-assistant metrics --format=prometheus
# Exposes: tool_call_count, cache_hit_rate, avg_response_time, proactive_interventions

# Health checks
rust-ai-assistant health
# Checks: rust-analyzer connection, cargo availability, cache health

______________________________________________________________________

🚀 贡献者入门

先决条件

# Required for development
rustup toolchain install nightly
cargo install cargo-watch
cargo install rust-analyzer

# For testing the full stack
cargo install mcp-cli  # MCP client for testing

开发设置

# 1. Clone and setup
git clone https://github.com/yourusername/rust-ai-assistant.git
cd rust-ai-assistant

# 2. Build with all features
cargo build --all-features

# 3. Run tests (including integration tests)
cargo test -- --test-threads=1

# 4. Start in development mode
cargo run -- server --dev --project-path examples/sample-project

项目结构

src/
├── context_engine/     # Project knowledge graph & analysis
├── reasoning_layer/    # Problem solving & tool orchestration  
├── core_services/      # Unified LSP, docs, cargo clients
├── learning/           # Pattern recognition & adaptation
├── plugins/            # Extensibility system
└── server/             # MCP server implementation

______________________________________________________________________

📈 路线图:自主发展之路

第一阶段:智能基础(当前)

  • ✅ 带有知识图的项目上下文引擎
  • ✅ 统一工具编排层
  • ✅ 从用户决策中学习基本知识

第二阶段:深度整合(未来3个月)

  • 🔄 跨存储库模式分析
  • 🔄 CI/CD管道集成
  • 🔄 实时协作功能

第三阶段:完全自主(6+个月)

  • ◻️ 基于模式的预测代码生成
  • ◻️ 具有安全保证的自动重构
  • ◻️ 自改进建议引擎

______________________________________________________________________

🤝 贡献与社区

我们正在用人工智能构建Rust开发的未来。加入我们:

  1. 报告问题:错误报告、功能请求和文档改进
  2. 共享模式:贡献团队成功的Rust模式
  3. 构建插件:使用特定领域的工具扩展助手
  4. 提高智力:帮助培训建议引擎

行为准则

该项目遵循Rust行为准则。我们正在建立一个包容、乐于助人的助手——让我们也建立一个包容性、乐于助助人的社区。

______________________________________________________________________

📄 许可与确认

许可证:麻省理工学院或Apache 2.0(由您选择)

建立在...之上:

  • Zeenix锈度分析仪mcp的稳定性
  • Terhechte文献系统的准确性
  • Dex综合工具集的愿景
  • Rust社区令人难以置信的生态系统

特别感谢致每一位希望他们的AI助手真正理解他们项目的Rust开发人员。这是给你的。

______________________________________________________________________

🚨 准备好改变你的Rust开发了吗?

# Start your autonomous Rust partner today
cargo install rust-ai-assistant
cd your-project
rust-ai-assistant init --mode=autonomous

体验Rust开发的未来——你的AI助手不仅可以运行工具,还可以理解你的项目,学习你的模式,并主动帮助你编写更好的代码。

______________________________________________________________________

*“最好的工具是能够理解你想要构建什么的工具。”*

目录标签

目录标签

代码分析RustClaudeRust开发本地部署AI编程助手智能建议项目知识图谱

支持客户端

Claude DesktopClaudeCursor

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

token

工具数量(toolCount,工具数)

16

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明token部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP