RustDev-Intellisense-Harness
A specialized Model Context Protocol (MCP) extension granting LLMs immediate access to contemporary Rust project data, including current type definitions from Rust Analyzer, repository documentation, symbol inspection capabilities, and direct execution of Cargo build/test tasks. This ensures the AI operates with verifiable, up-to-the-minute Rust ecosystem knowledge.
Author

terhechte
Quick Info
Actions
Tags
RustDev-Intellisense-Harness
A custom MCP (Model Context Protocol) service engineered to bridge the gap between the LLM environment within Cursor and essential local Rust development infrastructure: Rust Analyzer (for code introspection), external crate documentation repositories, and invocation of Cargo tooling.
Features an integrated graphical interface for system setup and monitoring.
Core Capabilities
Traditional AI models struggle when they cannot resolve precise type signatures, forcing them to rely on potentially outdated or inferred knowledge. This tool eliminates that ambiguity.
RustDev-Intellisense-Harness exposes this crucial context via MCP, yielding:
- Retrieval of official documentation for any specified dependency crate or for individual public symbols within those crates (e.g., querying documentation for the
serdecrate or theserde::Deserializetrait). - Detailed type resolution and contextual descriptions (hover data) for symbols found within the active source files.
- Enumeration of all references pointing to a particular symbol within the project codebase.
- Extraction of the full source code location where a specific symbol is implemented.
- Direct lookup of a symbol's definition across the entire project structure, returning associated metadata.
- Execution and capture of the output from
cargo test. - Execution and capture of the output from
cargo check.
Operational Flow
For Language Server Protocol (LSP) interactions (handled in src/lsp), a dedicated instance of Rust Analyzer is launched. This ensures isolation from the editor's existing LSP instance, which often has exclusive binding constraints.
Documentation fetching involves executing cargo docs against required crates, parsing the resulting HTML artifacts, and locally transforming them into Markdown format. This cached data resides in the project's .docs-cache directory for rapid access.
Deployment Instructions
Installation via Cargo:
sh cargo install --git https://github.com/terhechte/cursor-rust-tools
Launching with Configuration Interface
sh cursor-rust-tools
This initiates the service alongside a user interface for project registration, automatic mcp.json provisioning, and real-time activity logging.
Headless Operation
If project configurations are pre-established in ~/.cursor-rust-tools, the tool can be run silently:
sh cursor-rust-tools --no-ui
Configuration Management
Configuration can bypass the graphical interface by manually structuring ~/.cursor-rust-tools:
toml [[projects]] root = "/path/to/project/one" ignore_crates = ["very/large/dependency"]
[[projects]] root = "/path/to/project/two" ignore_crates = []
ignore_crates permits exclusion of dependency packages from documentation indexing, typically for extremely large or redundant libraries.
Integrating with Cursor IDE
Once the harness is operational, integrate it into Cursor:
- Provision a configuration file at
project-dir/.cursor/mcp.json. The built-in UI offers a utility button for this step; otherwise, the terminal output of the non-UI launch will display the required JSON content. - Upon saving this file within the project directory, Cursor prompts the user to activate the newly discovered MCP service.
- Verify connectivity status within Cursor's settings panel under the 'MCP' section.
- Test functionality by enabling 'Agent Mode' in the chat interface and invoking one of the exposed commands, such as the
cargo_checktool. - (Optional) Review or implement Cursor's intrinsic rules to bias the LLM towards utilizing these newly available tools proactively. (Reference: Cursor Context Rules Guide)
Crucially, the content of the mcp.json file remains invariant across all projects. The harness dynamically ascertains the correct project context based on the file path associated with the LLM's query.
Future Development Backlog
- [ ] Development of a complementary extension for the Zed editor.
- [ ] Implementation of cleaner, non-erroneous service termination sequences.
- [ ] Refinement of the project removal process (currently somewhat fragile in the UI).
- [ ] Expansion to expose a wider array of standard LSP functionalities.
- [ ] Integration enabling the LLM to initiate automated code transformations via Grit operations
