
How to add Rust Docs MCP Server to Windsurf
Gives AI coding assistants up-to-date, crate-specific Rust documentation via semantic search and LLM summarization. Paste the config into ~/.codeium/windsurf/mcp_config.json and restart Windsurf.
Last updated June 14, 2026 · 281★ · stdio · apikey
Windsurf config for Rust Docs MCP Server
cargo build --release{
"mcpServers": {
"rust-docs-mcp-server": {
"command": "rustdocs_mcp_server",
"args": [
"serde@^1.0"
],
"env": {
"OPENAI_API_KEY": "YOUR_OPENAI_API_KEY_HERE"
}
}
}
}Setup steps
- 1Open Windsurf → Cascade → the hammer/MCP icon → Configure (or edit ~/.codeium/windsurf/mcp_config.json).
- 2Paste the Rust Docs MCP Server config below.
- 3Fill in placeholder secrets, then save.
- 4Click Refresh in the MCP panel.
- 5Rust Docs MCP Server's tools become available to Cascade.
Before you start
- OpenAI API key set in the OPENAI_API_KEY environment variable
- Network access to download crate dependencies and reach the OpenAI API
- The rustdocs_mcp_server binary (download a pre-compiled release, or build from source with the Rust toolchain via `cargo build --release`)
What Rust Docs MCP Server can do in Windsurf
query_rust_docsQuery documentation for the specific Rust crate the server was started for, using semantic search and LLM summarization. Takes a required `question` string about the crate's API or usage and returns a text answer derived only from the relevant documentation context, prefixed with `From <crate_name> docs:`.
Security
Requires an OpenAI API key supplied via the OPENAI_API_KEY environment variable; the key is used to call the OpenAI API for embedding generation and answer summarization. The server needs network access to download crate dependencies and reach the OpenAI API. First-run embedding generation incurs a small OpenAI cost (the README cites fractions of a US penny for most crates, up to $0.18 for a very large crate).
Rust Docs MCP Server + Windsurf FAQ
Where is the Windsurf config file?
Windsurf reads MCP servers from ~/.codeium/windsurf/mcp_config.json. Paste the Rust Docs MCP Server config there under the "mcpServers" key and restart the client.
Is Rust Docs MCP Server safe to use with Windsurf?
Requires an OpenAI API key supplied via the OPENAI_API_KEY environment variable; the key is used to call the OpenAI API for embedding generation and answer summarization. The server needs network access to download crate dependencies and reach the OpenAI API. First-run embedding generation incurs a small OpenAI cost (the README cites fractions of a US penny for most crates, up to $0.18 for a very large crate).
Do I need an OpenAI API key?
Yes. The server uses OpenAI's text-embedding-3-small model to generate embeddings and gpt-4o-mini-2024-07-18 to summarize answers. Provide the key via the OPENAI_API_KEY environment variable.
How much does it cost to run?
Only the first run for a given crate, version, and feature set incurs an OpenAI cost for generating embeddings — typically fractions of a US penny for most crates. The README notes that even a large crate like async-stripe (5000+ doc pages) cost about $0.18 USD during testing. Results are cached, so subsequent launches don't re-incur the cost.
Can one server handle multiple crates?
No — each server instance targets a single crate, specified by a Cargo Package ID (e.g. `serde@^1.0`). To cover several crates, configure multiple server instances, each with its own entry in your MCP client's mcpServers config.