For anyone else trying to configure Mistral's Vibe CLI combined with the Rust Analyzer MCP server (or any MCP server that runs into the naming conflict that the Rust Analyzer does) - hopefully this guide will save you the 5 hours it stole from my life.
This comprehensive guide documents all the steps required to get the Rust MCP server working with Vibe CLI, including fixes for naming conflicts, JSON parsing issues, and tool discovery problems.
Table of Contents
- Prerequisites
- Initial Setup
- Issue 1: Conflicting Binary
- Issue 2: JSON Parsing Errors
- Issue 3: Tool Name Prefixing
- Final Configuration
- Testing the Setup
- Troubleshooting
- Complete File Changes
Prerequisites
Before starting, ensure you have:
- Rust toolchain installed (rustup, cargo)
- Node.js 22.x+ (for some MCP servers)
- Docker (for containerized MCP servers)
- Vibe CLI installed
- Git
Initial Setup
1. Clone the Rust MCP Server Repository
cd /Users/jordanhudgens/code/dashtrack/tools
git clone https://github.com/dexwritescode/rust-mcp
cd rust-mcp
2. Build the Server
cargo build --release
The binary will be located at: /Users/jordanhudgens/code/dashtrack/tools/rust-mcp/target/release/rustmcp
Issue 1: Conflicting Binary
Problem
Vibe CLI auto-discovers MCP servers in your PATH. If you have the official rust-analyzer-mcp binary installed via cargo, it will conflict with your custom server. I'm assuming it's happening with other MCP servers, this is just the one I ran into.
Symptoms
- Tools appear with
rust-analyzer_*prefix - Naming conflicts between auto-discovered and configured servers
- "Unknown tool" errors
Solution
Rename the conflicting binary:
mv ~/.cargo/bin/rust-analyzer-mcp ~/.cargo/bin/rust-analyzer-mcp-backup
Verification
which rust-analyzer-mcp # Should return "rust-analyzer-mcp not found"
ls ~/.cargo/bin/rust-analyzer-mcp-backup # Should show the renamed binary
Issue 2: JSON Parsing Errors
Problem
The Rust MCP server outputs plain text startup messages that break Vibe's JSON-RPC parser.
Symptoms
Failed to parse JSONRPC message from server
pydantic_core._pydantic_core.ValidationError: 1 validation error for JSONRPCMessage
Invalid JSON: expected value at line 1 column 1 [type=json_invalid, input_value='Starting Rust MCP Server', input_type=str]
Solution
Remove the println! statements from src/main.rs:
File: /Users/jordanhudgens/code/dashtrack/tools/rust-mcp/src/main.rs
// BEFORE (lines 12-13):
println!("Starting Rust MCP Server");
println!("Server running on stdio transport...");
// AFTER (remove these lines completely):
// No startup messages - MCP servers should only output JSON-RPC
Complete Fixed main.rs
use anyhow::Result;
use rmcp::{ServiceExt, transport::stdio};
use rustmcp::server::RustMcpServer;
#[tokio::main]
async fn main() -> Result<()> {
// Initialize the rust-analyzer integration
let mut rust_server = RustMcpServer::new();
rust_server.start().await?;
// Note: The #[tool] macros generate additional tools beyond our manual list
// Start the MCP server using the ServiceExt trait
let service = rust_server.serve(stdio()).await?;
service.waiting().await?;
Ok(())
}
Issue 3: Tool Name Prefixing
Problem
Initial assumption was that Vibe prefixes tool names with the server name (e.g., rustmcp_workspace_symbols), but this turned out to be incorrect.
Discovery Process
- Initial hypothesis: Vibe prefixes tools with server name
-
Implemented stripping: Added
splitn(2, '_').nth(1).unwrap_or(name) -
Found issue: Tools were being called as just
symbolsinstead ofworkspace_symbols - Realization: Vibe does NOT prefix tool names
- Final fix: Removed the prefix stripping logic entirely
Solution
Remove the prefix stripping logic from src/tools/types.rs:
File: /Users/jordanhudgens/code/dashtrack/tools/rust-mcp/src/tools/types.rs
// BEFORE:
pub async fn execute_tool(
name: &str,
args: Value,
analyzer: &mut RustAnalyzerClient,
) -> Result<ToolResult> {
// Strip any MCP host prefix (e.g. "rustmcp_analyze_manifest" → "analyze_manifest")
let name = name.splitn(2, '_').nth(1).unwrap_or(name);
match name {
// AFTER:
pub async fn execute_tool(
name: &str,
args: Value,
analyzer: &mut RustAnalyzerClient,
) -> Result<ToolResult> {
// Strip any MCP host prefix (e.g. "rustmcp_analyze_manifest" → "analyze_manifest")
// Vibe doesn't actually prefix tool names, so we don't need to strip anything
match name {
Final Configuration
1. Update Vibe Config
File: /Users/jordanhudgens/.vibe/config.toml
Add the Rust MCP server configuration:
[[mcp_servers]]
name = "rustmcp"
transport = "stdio"
command = "/Users/jordanhudgens/code/dashtrack/tools/rust-mcp/target/release/rustmcp"
args = []
startup_timeout_sec = 30.0
2. Rebuild the Server
cd /Users/jordanhudgens/code/dashtrack/tools/rust-mcp
cargo build --release
3. Restart Terminal
Close and reopen your terminal to ensure all environment changes take effect.
Testing the Setup
Test Basic Functionality
vibe
The Vibe CLI should start without JSON parsing errors.
Test Specific Tools
Workspace Symbols
rustmcp_workspace_symbols
With parameters:
{"query": "test"}
Find Definition
rustmcp_find_definition
With parameters:
{"file_path": "/path/to/file.rs", "line": 10, "character": 5}
Get Diagnostics
rustmcp_get_diagnostics
With parameters:
{"file_path": "/path/to/file.rs"}
Expected Results
- No JSON parsing errors
- Tools should execute and return proper responses
- No "Unknown tool" errors
- Server should be discovered as
rustmcpwith all available tools
Troubleshooting
"Unknown tool" Errors
Cause: Tool name mismatch or server not properly initialized.
Solution:
- Verify the server is running:
ps aux | grep rustmcp - Check tool names in the server code
- Ensure no prefix stripping logic is active
JSON Parsing Errors
Cause: Server outputting non-JSON text.
Solution:
- Remove all
println!,eprintln!, andprint!statements - Ensure only JSON-RPC messages are output
- Check for any debug statements that might output to stdout
Server Not Discovered
Cause: Configuration issue or binary path incorrect.
Solution:
- Verify the binary path in config.toml
- Ensure the binary is executable:
chmod +x /Users/jordanhudgens/code/dashtrack/tools/rust-mcp/target/release/rustmcp - Check for typos in the server name
Conflicting Tools
Cause: Multiple MCP servers with overlapping tool names.
Solution:
- Ensure no other
rust-analyzer-mcpbinary exists in PATH - Check for auto-discovered servers with
vibe --debug - Remove or rename conflicting binaries
Complete File Changes
1. /Users/jordanhudgens/code/dashtrack/tools/rust-mcp/src/main.rs
Before:
use anyhow::Result;
use rmcp::{ServiceExt, transport::stdio};
use rustmcp::server::RustMcpServer;
#[tokio::main]
async fn main() -> Result<()> {
// Initialize the rust-analyzer integration
let mut rust_server = RustMcpServer::new();
rust_server.start().await?;
// Note: The #[tool] macros generate additional tools beyond our manual list
println!("Starting Rust MCP Server");
println!("Server running on stdio transport...");
// Start the MCP server using the ServiceExt trait
let service = rust_server.serve(stdio()).await?;
service.waiting().await?;
Ok(())
}
After:
use anyhow::Result;
use rmcp::{ServiceExt, transport::stdio};
use rustmcp::server::RustMcpServer;
#[tokio::main]
async fn main() -> Result<()> {
// Initialize the rust-analyzer integration
let mut rust_server = RustMcpServer::new();
rust_server.start().await?;
// Note: The #[tool] macros generate additional tools beyond our manual list
// Start the MCP server using the ServiceExt trait
let service = rust_server.serve(stdio()).await?;
service.waiting().await?;
Ok(())
}
Changes: Removed lines 12-13 (println! statements)
2. /Users/jordanhudgens/code/dashtrack/tools/rust-mcp/src/tools/types.rs
Before:
pub async fn execute_tool(
name: &str,
args: Value,
analyzer: &mut RustAnalyzerClient,
) -> Result<ToolResult> {
match name {
After:
pub async fn execute_tool(
name: &str,
args: Value,
analyzer: &mut RustAnalyzerClient,
) -> Result<ToolResult> {
// Strip any MCP host prefix (e.g. "rustmcp_analyze_manifest" → "analyze_manifest")
// Vibe doesn't actually prefix tool names, so we don't need to strip anything
match name {
Changes: Added comment explaining that no prefix stripping is needed
3. /Users/jordanhudgens/.vibe/config.toml
Added:
[[mcp_servers]]
name = "rustmcp"
transport = "stdio"
command = "/Users/jordanhudgens/code/dashtrack/tools/rust-mcp/target/release/rustmcp"
args = []
startup_timeout_sec = 30.0
4. Renamed Binary
mv ~/.cargo/bin/rust-analyzer-mcp ~/.cargo/bin/rust-analyzer-mcp-backup
Available Rust MCP Tools
The Rust MCP server provides the following tools:
Analysis Tools
-
find_definition- Find the definition of a symbol -
find_references- Find all references to a symbol -
get_diagnostics- Get compiler diagnostics for a file -
get_type_hierarchy- Get type hierarchy for a symbol -
validate_lifetimes- Validate and suggest lifetime annotations
Navigation Tools
-
workspace_symbols- Search for symbols in the workspace -
find_definition- Find symbol definitions
Refactoring Tools
-
rename_symbol- Rename a symbol with scope awareness -
extract_function- Extract selected code into a new function -
inline_function- Inline a function call -
change_signature- Change the signature of a function -
organize_imports- Organize and sort import statements
Code Generation Tools
-
generate_struct- Generate a struct with specified fields -
generate_enum- Generate an enum with specified variants -
generate_trait_impl- Generate a trait implementation -
generate_tests- Generate unit tests for a function
Project Tools
-
analyze_manifest- Parse and analyze Cargo.toml -
run_cargo_check- Execute cargo check -
suggest_dependencies- Suggest crate dependencies -
create_module- Create a new Rust module -
move_items- Move code items between files
Formatting Tools
-
format_code- Apply rustfmt formatting -
apply_clippy_suggestions- Apply clippy lint suggestions
Maintenance
Updating the Server
cd /Users/jordanhudgens/code/dashtrack/tools/rust-mcp
git pull origin main
cargo build --release
Reapplying Fixes After Update
If you update the server and the issues reappear, reapply the fixes:
- Remove startup messages (if they were re-added):
# Edit src/main.rs and remove any println! statements
- Ensure no prefix stripping (if it was re-added):
# Edit src/tools/types.rs and remove any prefix stripping logic
- Rebuild:
cargo build --release
Conclusion
This guide documents the complete process to get the Rust MCP server working with Vibe CLI. The key issues were:
- Conflicting binary in PATH causing auto-discovery conflicts
- JSON parsing errors from startup messages breaking the protocol
- Incorrect assumption about tool name prefixing leading to unnecessary stripping logic
With these issues resolved, the Rust MCP server provides full Rust analysis capabilities directly within Vibe CLI.
Top comments (0)