1. Conduid
  2. Developer Tools
  3. Rust Analyzer
MCP server · Developer Tools

Rust Analyzer

MCP server for Rust language intelligence via rust-analyzer integration

Unclaimed last commit a year ago devtools
34Low

Scored 7 months ago · breakdown

About Rust Analyzer

Rust Analyzer is an MCP server published by pedrozoalencar in the Developer Tools category: mCP server for Rust language intelligence via rust-analyzer integration.

The repository has 3 stars and 0 forks, with the last commit a year ago. Six months or more without a commit doesn't mean the server is broken, but check the open issues before depending on it in production.

Install

From source
git clone https://github.com/pedrozoalencar/mcp-rust-analyzer

This server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.

Tools (14)

analyze_dependenciesView dependency graph

Parameters not published.

analyze_symbolAnalyze a symbol by name

Parameters not published.

code_metricsGet code statistics and metrics

Parameters not published.

completeGet code completions at a position

Parameters not published.

expand_snippetExpand code snippets

Parameters not published.

find_dead_codeDetect unused code

Parameters not published.

find_implementationsFind trait implementations

Parameters not published.

find_referencesFind all symbol references

Parameters not published.

get_diagnosticsGet compiler diagnostics

Parameters not published.

get_hoverGet type/documentation info

Parameters not published.

Show all 14 tools
project_structureAnalyze project module organization

Parameters not published.

renameRename symbols safely

Parameters not published.

signature_helpGet function signature help

Parameters not published.

suggest_improvementsGet optimization suggestions

Parameters not published.

Ask AI

✦

Ask AI about Rust Analyzer

Powered by Claude · Grounded in docs

I know everything about Rust Analyzer. Ask me about installation, configuration, usage, or troubleshooting.

Security checks

  • ✓README presentThe repository ships documentation.

5 checks have not been run yet.

README

MCP Rust Analyzer

🦀 An intelligent Model Context Protocol (MCP) server that provides comprehensive Rust code analysis, refactoring, and navigation capabilities through rust-analyzer integration.

Rust MCP

✨ Features

🔍 Code Analysis

  • Hover Information: Get detailed type information and documentation
  • Find References: Locate all usage of symbols across your project
  • Go to Implementation: Navigate to trait implementations
  • Symbol Analysis: Deep dive into symbol definitions and relationships

⚡ Auto-completion & Navigation

  • Smart Completions: Context-aware code completions
  • Signature Help: Function parameter assistance
  • Diagnostics: Real-time error detection and suggestions

🔧 Refactoring Tools

  • Rename Symbol: Safe rename across entire codebase
  • Extract Function: Extract code into reusable functions
  • Organize Imports: Clean up and optimize import statements

📊 Project Metrics

  • Code Statistics: Lines of code, complexity metrics
  • Dependency Analysis: Analyze Cargo.toml dependencies
  • Dead Code Detection: Find unused code in your project
  • Project Structure: Analyze module organization

🎯 Smart Templates

  • Code Snippets: Pre-built templates for common patterns
  • Match Expressions: Generate match arms automatically
  • Test Functions: Quick test function templates

🚀 Intelligent Operation Modes

  • Claude Code CLI: Automatic direct mode for maximum compatibility
  • Manual Terminal: Smart daemon/client system for optimal performance
  • TTY Detection: Automatically chooses the best mode based on context

🚀 Installation

Prerequisites

  • Rust toolchain (1.70+)
  • rust-analyzer component: rustup component add rust-analyzer

Install from Source

git clone https://github.com/pedrozoalencar/mcp-rust-analyzer.git
cd mcp-rust-analyzer
cargo build --release

# Add to PATH (permanent)
echo 'export PATH="/path/to/mcp-rust-analyzer/target/release:$PATH"' >> ~/.bashrc
source ~/.bashrc

📋 Usage

With Claude Code CLI

  1. Add MCP Server:
claude mcp add rust-analyzer mcp-rust-analyzer
  1. Verify Installation:
claude mcp list
claude mcp test rust-analyzer
  1. Use in Any Rust Project:
cd your-rust-project/
claude  # Automatically detects and analyzes Rust code!

Manual Usage (Advanced)

Daemon Mode (Recommended for Manual Use)

# Start daemon for current project
mcp-rust-analyzer --daemon

# Check daemon status
mcp-rust-analyzer --status

# Stop daemon
mcp-rust-analyzer --stop

# Use client (auto-connects to daemon)
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | mcp-rust-analyzer

Direct Mode

# Direct stdin/stdout mode
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | mcp-rust-analyzer --server

🛠️ Architecture

Intelligent Mode Detection

  • Claude Code CLI: Automatically uses direct mode for maximum compatibility
  • Manual Terminal: Uses smart daemon/client system for optimal performance
  • TTY Detection: Automatically chooses the best mode based on context

Dual Operation Modes

Daemon/Client System (Manual Use)

  • Background Daemon: Persistent HTTP server per project
  • Auto-Port Selection: Finds available ports automatically
  • State Management: Tracks daemons across multiple projects
  • Auto-Start: Client automatically starts daemon if needed

Direct Mode (Claude Code CLI)

  • Zero Configuration: Works out-of-the-box
  • LSP Integration: Full rust-analyzer capabilities
  • Fast Startup: Optimized for MCP protocol

LSP Integration

  • Background Initialization: Non-blocking rust-analyzer startup
  • Smart Caching: Reuses LSP connections for performance
  • Error Handling: Graceful fallbacks when LSP unavailable

📚 Available Tools

Tool Description
project_structure Analyze project module organization
code_metrics Get code statistics and metrics
analyze_dependencies View dependency graph
complete Get code completions at a position
get_hover Get type/documentation info
find_references Find all symbol references
rename Rename symbols safely
signature_help Get function signature help
get_diagnostics Get compiler diagnostics
analyze_symbol Analyze a symbol by name
find_implementations Find trait implementations
expand_snippet Expand code snippets
find_dead_code Detect unused code
suggest_improvements Get optimization suggestions

Resources

The server exposes these resources:

  • rust-analyzer://project/structure - Project structure
  • rust-analyzer://project/diagnostics - All diagnostics
  • rust-analyzer://project/dependencies - Dependency graph
  • rust-analyzer://project/symbols - Workspace symbols

Prompts

Pre-configured prompts for common tasks:

  • analyze_code - Comprehensive code analysis
  • refactor_code - Guided refactoring
  • explain_error - Error explanation with fixes
  • optimize_code - Performance optimization

Architecture

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│   Claude Code   │────▶│   MCP Server    │────▶│  rust-analyzer  │
│      (Host)     │◀────│  (This Project) │◀────│      (LSP)      │
└─────────────────┘     └─────────────────┘     └─────────────────┘
        JSON-RPC              Rust API               LSP Protocol

Development

Project Structure

src/
├── main.rs           # Entry point
├── server.rs         # MCP server implementation
├── analyzer.rs       # rust-analyzer integration
├── lsp_client.rs     # LSP client for rust-analyzer
└── commands/         # Command handlers
    ├── analysis.rs   # Code analysis commands
    ├── completion.rs # IntelliSense commands
    ├── metrics.rs    # Metrics and structure
    └── refactor.rs   # Refactoring commands

Running Tests

# Run unit tests
cargo test

# Run integration tests
cargo test --test '*'

# Test MCP protocol compliance
./test_mcp_complete.sh

Debug Mode

# Run with debug logging
RUST_LOG=debug cargo run

# Test individual commands
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | cargo run

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Guidelines

  1. Follow Rust naming conventions
  2. Add tests for new features
  3. Update documentation
  4. Ensure all tests pass
  5. Format code with cargo fmt

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments


Made with ❤️ for the Rust community

README copy captured when this server was indexed; it may lag the repository. The original is authoritative.

Questions

About Rust Analyzer

How do I install Rust Analyzer?

No package has been published for this server, so install it from source: clone the repository and follow its README.

Is Rust Analyzer safe to use with an AI agent?

Its trust score is 34 out of 100 (low). It passes 1 of the 1 static security checks run so far. It has no ConduID identity yet, so agent calls to it are not receipted.

Is Rust Analyzer still maintained?

The last commit was a year ago. That's long enough that you should check whether the maintainer is responding to issues before depending on it.