rust-analyzer MCP Server - Rust code intelligence for AI assistants.
Beyond standard LSP features, ra-mcp provides:
| Feature |
Description |
| Macro Expansion |
ra_expand_macro to analyze macro output, ra_view_hir for IR inspection |
| Symbol Index |
Build persistent index with ra_build_index, fast queries with ra_query_index |
| Concurrent Access |
Thread-safe design supports multiple AI agents simultaneously |
| Extended Analysis |
ra_runnables, ra_related_tests, ra_ssr structural search-replace |
| Test Relations |
ra_related_tests finds tests for any function |
git clone https://github.com/your-org/ra-mcp.git
cd ra-mcp
cargo build --release
Configure in MCP client:
{
"mcpServers": {
"ra-mcp": {
"command": "target/release/ra-mcp",
"args": ["--workspace", "/path/to/rust/project"]
}
}
}
| Argument |
Default |
--workspace <PATH> |
Current directory |
--log-level <LEVEL> |
info |
--timeout <MS> |
30000 |
| Tool |
Parameters |
ra_hover |
file_path, line, character |
ra_definition |
file_path, line, character |
ra_type_definition |
file_path, line, character |
ra_implementation |
file_path, line, character |
ra_references |
file_path, line, character, include_declaration? |
ra_call_hierarchy |
file_path, line, character |
ra_parent_module |
file_path, line, character |
| Tool |
Parameters |
ra_completion |
file_path, line, character |
ra_signature_help |
file_path, line, character |
ra_inlay_hints |
file_path, start_line, start_character, end_line, end_character |
| Tool |
Parameters |
ra_document_symbols |
file_path, limit?, kind? |
ra_outline |
file_path |
ra_find |
file_path, query, kind?, limit? |
ra_workspace_symbols |
query, kind?, limit? |
| Tool |
Parameters |
ra_rename |
file_path, line, character, new_name |
ra_code_actions |
file_path, start_line, start_character, end_line, end_character |
| Tool |
Parameters |
ra_diagnostics |
file_path |
ra_workspace_diagnostics |
- |
| Tool |
Parameters |
ra_expand_macro |
file_path, line, character |
ra_runnables |
file_path, line?, character? |
ra_related_tests |
file_path, line, character |
ra_open_docs |
file_path, line, character |
ra_ssr |
query, parse_only? |
ra_syntax_tree |
file_path |
ra_view_hir |
file_path, line, character |
ra_crate_graph |
full? |
| Tool |
Parameters |
ra_build_index |
- |
ra_query_index |
query, kind?, limit? |
ra_clear_index |
- |
file, module, namespace, package, class, method, property, field, constructor, enum, interface, function, variable, constant, struct, enum_member, trait, type_parameter, operator, event
MIT