Skip to main content

Crate crates_docs

Crate crates_docs 

Source
Expand description

Crates Docs MCP Server

A high-performance Rust crate documentation query MCP server, supporting multiple transport protocols and OAuth authentication.

§Main Features

  • Crate Documentation Query: Fetch complete documentation for a crate from docs.rs
  • Crate Search: Search Rust crates from crates.io
  • Item Documentation Lookup: Find specific types, functions, or modules in a crate
  • Health Check: Check server and external service status

§Transport Protocol Support

  • stdio: Standard input/output (suitable for MCP client integration)
  • http: HTTP transport (Streamable HTTP)
  • sse: Server-Sent Events
  • hybrid: Hybrid mode (HTTP + SSE)

§Cache Support

  • Memory Cache: High-performance memory cache based on moka, supporting TinyLFU eviction strategy and per-entry TTL
  • Redis Cache: Supports distributed deployment (requires cache-redis feature)

§Example

use crates_docs::{AppConfig, CratesDocsServer};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create server with default configuration
    let config = AppConfig::default();
    let server = CratesDocsServer::new(config)?;

    // Run HTTP server
    server.run_http().await?;

    Ok(())
}

Re-exports§

pub use crate::config::AppConfig;
pub use crate::config::ServerConfig;
pub use crate::error::Error;
pub use crate::error::Result;
pub use crate::server::CratesDocsServer;

Modules§

cache
Cache module
cli
CLI module
config
Configuration module
config_reload
Configuration hot-reload functionality
error
Error handling module
metrics
Metrics module for Prometheus monitoring
server
Server module
tools
MCP tool module
utils
Utility functions module

Constants§

NAME
Server name
VERSION
Server version

Functions§

init_logging_with_config
Initialize logging system with configuration