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 Eventshybrid: Hybrid mode (HTTP + SSE)
§Cache Support
- Memory Cache: High-performance memory cache based on
moka, supportingTinyLFUeviction strategy and per-entry TTL - Redis Cache: Supports distributed deployment (requires
cache-redisfeature)
§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§
Functions§
- init_
logging_ with_ config - Initialize logging system with configuration