Cover image
Try Now
2025-03-17

Rust Crate文档的MCP服务器

3 years

Works with Finder

1

Github Watches

3

Github Forks

19

Github Stars

CrateDocs MCP

This is an MCP (Model Context Protocol) server that provides tools for Rust crate documentation lookup. It allows LLMs to look up documentation for Rust crates they are unfamiliar with.

Features

  • Lookup crate documentation: Get general documentation for a Rust crate
  • Search crates: Search for crates on crates.io based on keywords
  • Lookup item documentation: Get documentation for a specific item (e.g., struct, function, trait) within a crate

Installation

git clone https://github.com/d6e/cratedocs-mcp.git
cd cratedocs-mcp
cargo build --release

Running the Server

There are multiple ways to run the documentation server:

Using the Unified CLI

The unified command-line interface provides subcommands for all server modes:

# Run in STDIN/STDOUT mode
cargo run --bin cratedocs stdio

# Run in HTTP/SSE mode (default address: 127.0.0.1:8080)
cargo run --bin cratedocs http

# Run in HTTP/SSE mode with custom address
cargo run --bin cratedocs http --address 0.0.0.0:3000

# Enable debug logging
cargo run --bin cratedocs http --debug

Directly Testing Documentation Tools

You can directly test the documentation tools from the command line without starting a server:

# Get help for the test command
cargo run --bin cratedocs test --tool help

# Look up crate documentation
cargo run --bin cratedocs test --tool lookup_crate --crate-name tokio

# Look up item documentation
cargo run --bin cratedocs test --tool lookup_item --crate-name tokio --item-path sync::mpsc::Sender

# Look up documentation for a specific version
cargo run --bin cratedocs test --tool lookup_item --crate-name serde --item-path Serialize --version 1.0.147

# Search for crates
cargo run --bin cratedocs test --tool search_crates --query logger --limit 5

# Output in different formats (markdown, text, json)
cargo run --bin cratedocs test --tool search_crates --query logger --format json
cargo run --bin cratedocs test --tool lookup_crate --crate-name tokio --format text

# Save output to a file
cargo run --bin cratedocs test --tool lookup_crate --crate-name tokio --output tokio-docs.md

By default, the HTTP server will listen on http://127.0.0.1:8080/sse.

Available Tools

The server provides the following tools:

1. lookup_crate

Retrieves documentation for a specified Rust crate.

Parameters:

  • crate_name (required): The name of the crate to look up
  • version (optional): The version of the crate (defaults to latest)

Example:

{
  "name": "lookup_crate",
  "arguments": {
    "crate_name": "tokio",
    "version": "1.28.0"
  }
}

2. search_crates

Searches for Rust crates on crates.io.

Parameters:

  • query (required): The search query
  • limit (optional): Maximum number of results to return (defaults to 10, max 100)

Example:

{
  "name": "search_crates",
  "arguments": {
    "query": "async runtime",
    "limit": 5
  }
}

3. lookup_item

Retrieves documentation for a specific item in a crate.

Parameters:

  • crate_name (required): The name of the crate
  • item_path (required): Path to the item (e.g., 'std::vec::Vec')
  • version (optional): The version of the crate (defaults to latest)

Example:

{
  "name": "lookup_item",
  "arguments": {
    "crate_name": "serde",
    "item_path": "serde::Deserialize",
    "version": "1.0.160"
  }
}

Implementation Notes

  • The server includes a caching mechanism to prevent redundant API calls for the same documentation
  • It interfaces with docs.rs for crate documentation and crates.io for search functionality
  • Results are returned as plain text/HTML content that can be parsed and presented by the client

MCP Protocol Integration

This server implements the Model Context Protocol (MCP) which allows it to be easily integrated with LLM clients that support the protocol. For more information about MCP, visit the MCP repository.

License

MIT License

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • https://tovuti.be
  • Oede knorrepot die vasthoudt an de goeie ouwe tied van 't boerenleven

  • ANGEL LEON
  • A world class elite tech co-founder entrepreneur, expert in software development, entrepreneurship, marketing, coaching style leadership and aligned with ambition for excellence, global market penetration and worldy perspectives.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • Gil kaminski
  • Make sure you are post-ready before you post on social media

  • INFOLAB OPERATIONS 2
  • A medical specialist offering assistance grounded in clinical guidelines. Disclaimer: This is intended for research and is NOT safe for clinical use!

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

  • zhaoyunxing92
  • MCP(消息连接器协议)服务

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

    Reviews

    4 (1)
    Avatar
    user_68V7FYam
    2025-04-15

    The Unstructured API MCP Server for Research Paper Data Processing by HeetVekariya is an exceptional tool for handling complex research data. It streamlines the process, making data processing more efficient and less time-consuming. Highly recommended for researchers looking to enhance their workflow! Check it out [here](https://mcp.so/server/MCPHackathon/HeetVekariya).