Rust Docs MCP 服务器
一个MCP服务器,为AI工具提供对docs.rs上Rust文档的访问,支持搜索crates、文档、类型信息、特性标志、版本信息和源代码。
服务介绍
Rust 文档 MCP 服务器
一个提供来自 docs.rs 的 Rust 文档访问的 MCP(模型上下文协议)服务器。该服务器允许 AI 工具搜索文档、类型信息、特性标志、版本号以及符号定义/源代码。
特性
- 在 docs.rs 上搜索 crate
- 获取特定 crate 和版本的文档
- 获取类型信息(结构体、枚举、特征等)
- 获取 crate 的特性标志
- 获取 crate 的可用版本
- 获取特定项的源代码
- 在 crate 内搜索符号
安装
此项目使用 Bun 进行开发,但构建后的服务器可以使用 Node.js 运行。
# Clone the repository
git clone https://github.com/yourusername/rust-docs-mcp-server.git
cd rust-docs-mcp-server
# Install dependencies
bun install
构建
# Build the server
bun run build
这将创建一个包含编译后的 JavaScript 文件的构建目录。
运行
# Run the development server
bun run dev
# Or run the built server
bun run start
与 MCP 客户端一起使用
该服务器实现了模型上下文协议,并且可以与任何 MCP 客户端一起使用。要将其与 MCP 客户端一起使用,您需要配置客户端以连接到此服务器。
可用工具
服务器提供了以下工具:
search_crates:在 docs.rs 上搜索 crateget_crate_documentation:获取特定 crate 的文档get_type_info:获取特定项的类型信息get_feature_flags:获取 crate 的特性标志get_crate_versions:获取 crate 的可用版本get_source_code:获取特定项的源代码search_symbols:在 crate 内搜索符号
测试
# Run tests
bun test
许可证
MIT