GR

govcraft/rust-docs-mcp-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

300 stars 37 forks 质量 69 趋势 19MIT

govcraft/rust-docs-mcp-server 是从 https://github.com/govcraft/rust-docs-mcp-server. 导入的 MCP 服务器候选服务器。

概览

govcraft/rust-docs-mcp-server 是从 https://github.com/govcraft/rust-docs-mcp-server. 导入的 MCP 服务器候选服务器。

概述(AI 翻译)

⭐ 喜欢这个项目吗?拜托 将仓库加星 GitHub 支持并保持更新! ⭐

动机

现代AI驱动的编码助手(如Cursor、Cline、Roo Code等)表现出色 理解代码结构和语法方面,但经常在细节上遇到困难 快速演进的库和框架,尤其是在像Rust这样的生态系统中 箱子经常更新。它们的训练数据截止时间意味着它们可能 缺乏对最新 API 的了解,导致代码错误或过时 建议。

该MCP服务器通过提供聚焦且最新的服务来应对这一挑战 针对特定Rust箱的知识源。通过运行实例 服务器对一个箱子(例如,serde、tokio、reqwest),你给出你的LLM编码 助手工具(query_rust_docs))它可以在编写与 那个箱子。

当被指示使用该工具时,LLM可以提出关于 Crate的API或使用情况,以及直接从_current_中获得的答案 文档。这显著提高了 生成代码,减少了手动修正的需求,加快了速度 发展。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Rust Docs MCP Server

⭐ Like this project? Please star the repository on GitHub to show your support and stay updated! ⭐

Motivation

Modern AI-powered coding assistants (like Cursor, Cline, Roo Code, etc.) excel at understanding code structure and syntax but often struggle with the specifics of rapidly evolving libraries and frameworks, especially in ecosystems like Rust where crates are updated frequently. Their training data cutoff means they may lack knowledge of the latest APIs, leading to incorrect or outdated code suggestions.

This MCP server addresses this challenge by providing a focused, up-to-date knowledge source for a specific Rust crate. By running an instance of this server for a crate (e.g., serde, tokio, reqwest), you give your LLM coding assistant a tool (query_rust_docs) it can use before writing code related to that crate.

When instructed to use this tool, the LLM can ask specific questions about the crate’s API or usage and receive answers derived directly from the current documentation. This significantly improves the accuracy and relevance of the generated code, reducing the need for manual correction and speeding up development.

Multiple instances of this server can be run concurrently, allowing the LLM assistant to access documentation for several different crates during a coding session.

This server fetches the documentation for a specified Rust crate, generates embeddings for the content, and provides an MCP tool to answer questions about the crate based on the documentation context.

Features

  • Targeted Documentation: Focuses on a single Rust crate per server instance.
  • Feature Support: Allows specifying required crate features for documentation generation.
  • Semantic Search: Uses OpenAI’s text-embedding-3-small model to find the most relevant documentation sections for a given question.
  • LLM Summarization: Leverages OpenAI’s gpt-4o-mini-2024-07-18 model to generate concise answers based only on the retrieved documentation context.
  • Caching: Caches generated documentation content and embeddings in the user’s XDG data directory (~/.local/share/rustdocs-mcp-server/ or similar) based on crate, version, and requested features to speed up subsequent launches.
  • MCP Integration: Runs as a standard MCP server over stdio, exposing tools and resources.

Prerequisites

  • OpenAI API Key: Needed for generating embeddings and summarizing answers. The server expects this key to be available in the OPENAI_API_KEY environment variable. (The server also requires network access to download crate dependencies and interact with the OpenAI API).

Installation

The recommended way to install is to download the pre-compiled binary for your operating system from the

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "rust-docs-reqwest": { "command": "/path/to/your/rustdocs_mcp_server", "args": [ "[email protected]" ], "env": { "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY_HERE" }, "disabled": false, "alwaysAllow": [] }, "rust-docs-async-stripe": { "command": "rustdocs_mcp_server", "args": [ "[email protected]", "-F", " runtime-tokio-hyper-rustls" ], "env": { "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY_HERE" }, "disabled": false, "alwaysAllow": [] } } }