1. Conduid
  2. RAG
  3. Rust Code MCP
MCP server · RAG

Rust Code MCP

mcp server for rust code semantic hybrid search bm25 + embeddings with tree-sitter, gpu accelerated indexing and merkle tree updates

Unclaimed rag
39Low

Scored 6 months ago · breakdown

About Rust Code MCP

Rust Code MCP is an MCP server in the RAG category: mcp server for rust code semantic hybrid search bm25 + embeddings with tree-sitter, gpu accelerated indexing and merkle tree updates.

Install

From source
git clone https://github.com/molaco/rust-code-mcp

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.

Ask AI

✦

Ask AI about Rust Code MCP

Powered by Claude · Grounded in docs

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

Security checks

  • ✓README presentThe repository ships documentation.

5 checks have not been run yet.

README

rust-code-mcp

An MCP server for semantic code search in Rust codebases. Combines BM25 full-text search with vector embeddings for hybrid search, plus rust-analyzer based code analysis.

Architecture

Architecture

Features

  • Hybrid search - BM25 keyword search + semantic vector similarity
  • Symbol navigation - Find definitions and references across the codebase
  • Call graph analysis - Trace function call relationships
  • Complexity metrics - LOC, cyclomatic complexity, function counts
  • Incremental indexing - Merkle tree change detection for fast re-indexing
  • Background sync - Automatic index updates every 5 minutes

Tools

Tool Description
search Keyword search using hybrid BM25 + vectors
get_similar_code Find semantically similar code snippets
find_definition Locate where a symbol is defined (by name)
find_references Find all usages of a symbol (by name)
get_dependencies List imports for a file
get_call_graph Show function call relationships
analyze_complexity Calculate code complexity metrics
read_file_content Read file contents
index_codebase Manually trigger indexing
health_check Check system status

Installation

1. Build the binary

git clone https://github.com/molaco/rust-code-mcp.git
cd rust-code-mcp
cargo build --release

The binary is at target/release/file-search-mcp.

Optionally, copy it somewhere on your PATH:

cp target/release/file-search-mcp ~/.local/bin/

2. Add to Claude Code

In your Rust project directory, create .mcp.json:

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

Or add it globally in ~/.claude.json so it's available in all projects:

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

3. Index your codebase

Once Claude Code starts, the server is running. Use the index_codebase tool to index your project:

> index my codebase at /absolute/path/to/my-rust-project

Or call the tool directly with the directory parameter set to your project root. Indexing is incremental — subsequent runs only process changed files (via Merkle tree change detection). A background sync also re-indexes every 5 minutes automatically.

4. Start using it

All tools accept a directory parameter pointing to your project root. Examples:

  • Search code: search with a query like "error handling in parser"
  • Find definitions: find_definition for a symbol name
  • Find references: find_references to see all usages of a symbol
  • Call graph: get_call_graph to trace function relationships
  • Similar code: get_similar_code for semantic similarity search

Index data is stored in ~/Library/Application Support/dev.rust-code-mcp.search/ (macOS) or ~/.local/share/search/ (Linux), keyed by a hash of the project path — it never writes to your project directory.

Nix

A Nix flake is provided for easy setup:

# Enter dev shell with all dependencies
nix develop github:molaco/rust-code-mcp

# Build the binary
nix build github:molaco/rust-code-mcp

The dev shell includes nightly Rust and CUDA support.

GPU Acceleration

Embedding generation uses ONNX Runtime with CUDA support for 10-15x faster indexing on NVIDIA GPUs.

Requirements

  • NVIDIA GPU (Maxwell or newer)
  • CUDA 12.x + cuDNN 9.x
  • The ort crate downloads ONNX Runtime binaries to ~/.cache/ort.pyke.io/

MCP Server CUDA Configuration

For CUDA to work when the MCP server is spawned by Claude Code (or other MCP clients), the LD_LIBRARY_PATH must include:

  1. ORT cache - Contains libonnxruntime_providers_shared.so and libonnxruntime_providers_cuda.so
  2. CUDA libraries - libcudart.so, libcublas.so, libcublasLt.so
  3. cuDNN libraries - libcudnn.so

Option 1: Using flake.nix (recommended)

The included flake.nix automatically generates .mcp.json with the correct LD_LIBRARY_PATH:

nix develop
# Generates .mcp.json with dynamically discovered ORT cache path

Option 2: Manual configuration

First, find your ORT cache path:

find ~/.cache/ort.pyke.io/dfbin -name "libonnxruntime_providers_shared.so" -printf '%h\n' | head -1
# Example output: /home/user/.cache/ort.pyke.io/dfbin/x86_64-unknown-linux-gnu/8BBB.../onnxruntime/lib

Then configure your MCP client (e.g., ~/.claude.json for Claude Code):

{
  "mcpServers": {
    "rust-code-mcp": {
      "command": "/path/to/file-search-mcp",
      "args": [],
      "env": {
        "RUST_LOG": "info",
        "CUDA_HOME": "/usr/local/cuda",
        "CUDA_PATH": "/usr/local/cuda",
        "LD_LIBRARY_PATH": "/home/user/.cache/ort.pyke.io/dfbin/x86_64-unknown-linux-gnu/<HASH>/onnxruntime/lib:/usr/local/cuda/lib64:/usr/lib/x86_64-linux-gnu"
      }
    }
  }
}

Replace:

  • /path/to/file-search-mcp with your binary path
  • <HASH> with the hash from the find command above
  • CUDA paths with your system's CUDA installation

Note: The ORT cache hash changes when ONNX Runtime is updated. If CUDA stops working, re-run the find command to get the new path.

Performance

Mode Throughput
CPU only ~50 chunks/sec
GPU (RTX 3090) ~500 chunks/sec (full pipeline)
GPU isolated embedding ~8000 chunks/sec

Stack

Screenshots

Screenshot

Screenshot 2 Screenshot 3 Screenshot 4 Screenshot 5

License

MIT

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

Questions

About Rust Code MCP

How do I install Rust Code MCP?

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

Is Rust Code MCP safe to use with an AI agent?

Its trust score is 39 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 Code MCP still maintained?

Conduid hasn't recorded a commit date for this repository yet. Check the repository directly for recent activity.