A Model Context Protocol (MCP) server for docs.rs - enabling AI assistants to search and fetch Rust crate documentation.
- 🔍 Search Crates: Search for Rust crates on docs.rs by name or keyword
- 📦 Crate Information: Get detailed information about specific crates
- 📚 Documentation Access: Fetch documentation for specific modules, structs, functions, and more
- 📑 Module Listing: List all modules, structs, enums, functions, traits, and macros in a crate
- 📖 README Access: Retrieve crate README and metadata
Install globally via npm:
npm install -g rs-docsrs-mcpOr use with npx:
npx rs-docsrs-mcpAdd to your Claude Desktop configuration file:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"docsrs": {
"command": "npx",
"args": ["-y", "rs-docsrs-mcp"]
}
}
}If installed globally:
{
"mcpServers": {
"docsrs": {
"command": "rs-docsrs-mcp"
}
}
}Search for crates on docs.rs.
Parameters:
query(string, required): Crate name or keyword to searchlimit(number, optional): Maximum number of results (1-50, default: 10)
Example:
{
"query": "tokio",
"limit": 5
}Get homepage information for a specific crate.
Parameters:
crate(string, required): Crate name
Example:
{
"crate": "tokio"
}Get documentation for a specific path in a crate.
Parameters:
crate(string, required): Crate nameversion(string, optional): Version (default: "latest")path(string, optional): Documentation path (e.g., "tokio/runtime/index.html")
Examples:
{
"crate": "tokio",
"version": "latest",
"path": "tokio/runtime/struct.Runtime.html"
}{
"crate": "serde",
"path": "serde/trait.Serialize.html"
}List all modules and items in a crate.
Parameters:
crate(string, required): Crate nameversion(string, optional): Version (default: "latest")
Example:
{
"crate": "tokio",
"version": "1.35.0"
}Returns:
modules: List of modules with descriptionsstructs: List of structsenums: List of enumsfunctions: List of functionstraits: List of traitsmacros: List of macros
Get README and metadata for a crate.
Parameters:
crate(string, required): Crate nameversion(string, optional): Version (default: "latest")
Example:
{
"crate": "tokio"
}Once configured, you can ask Claude:
- "Search for HTTP client crates"
- "Show me the tokio runtime documentation"
- "List all modules in the serde crate"
- "Get the README for actix-web"
- "What structs are available in tokio?"
Clone the repository:
git clone https://github.com/lazhenyi/rs-docsrs-mcp.git
cd rs-docsrs-mcp
npm installRun locally:
npm start- Node.js >= 20.0.0
This MCP server scrapes documentation from docs.rs to provide structured information about Rust crates. It uses:
- cheerio: For HTML parsing
- node-fetch: For HTTP requests
- @modelcontextprotocol/sdk: For MCP protocol implementation
- zod: For parameter validation
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please open an issue on GitHub.