Get the FREE Ultimate OpenClaw Setup Guide →

rust-docs

MCP server from laptou/rust-docs-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio laptou-rust-docs-mcp-server node build/server.js \
  --env PORT="Port the server will listen on" \
  --env LOG_LEVEL="Logging level (e.g., info, debug)" \
  --env DOCSRS_API_URL="Docs.rs API base URL (default: https://docs.rs)"

How to use

The rust-docs MCP server exposes a suite of MCP tools that interface with docs.rs to provide Rust crate documentation, type information, feature flags, versions, and source code. Once running, clients can perform searches for crates, fetch crate documentation for specific versions, retrieve struct/enum/trait information, discover feature flags, list available crate versions, and obtain source code for symbols or items within a crate. This enables AI assistants and code tools to answer questions about Rust crates with precise references to docs and source when available. Tools include search_crates, get_crate_documentation, get_type_info, get_feature_flags, get_crate_versions, get_source_code, and search_symbols, each designed to return structured metadata and searchable content from docs.rs.

To use it with an MCP client, point the client at the server's address (for example http://localhost:PORT) and invoke the desired tool by name with the appropriate parameters (crate name, version, symbol, etc.). The server will translate requests into docs.rs queries and return results in a structured MCP response format that includes documentation, type information, and, when requested, links to source code.

How to install

Prerequisites:

  • Git installed
  • Bun installed (for development) and Node.js runtime available for the built server
  • A working Rust toolchain is optional if you need to build examples locally

Step-by-step installation:

  1. Clone the repository:
git clone https://github.com/yourusername/rust-docs-mcp-server.git
cd rust-docs-mcp-server
  1. Install dependencies (using Bun as per the project README):
bun install
  1. Build the server (produces a build directory with the compiled server):
bun run build
  1. Run the development server (hot-reloads or dev server):
bun run dev
  1. Alternatively, run the built server directly with Node.js (from the build directory):
node build/server.js

Notes:

  • Bun is used for development; the built server can run with Node.js. Ensure the runtime you use matches your environment.
  • Expose the server on a desired port by setting the PORT environment variable if needed.

Additional notes

Tips and common issues:

  • If the server fails to start, verify Bun is installed or that the build directory exists (bun run build).
  • Set DOCSRS_API_URL to a reachable docs.rs API endpoint if you need a custom mirror or proxy.
  • Increase verbosity with LOG_LEVEL=debug during troubleshooting.
  • When integrating with MCP clients, ensure the client sends the correct tool names (e.g., search_crates, get_crate_documentation) and parameter payloads as defined by the MCP protocol.
  • For large crate sets, consider caching frequent queries or limiting rate to avoid hitting docs.rs rate limits.

Related MCP Servers

Sponsor this space

Reach thousands of developers