rust-crate-src-mcp

Crates.iorust-crate-src-mcp
lib.rsrust-crate-src-mcp
version0.1.3
created_at2025-12-24 10:08:15.166053+00
updated_at2026-01-05 19:19:51.663336+00
descriptionAn MCP server for pulling the source of crate dependencies.
homepage
repositoryhttps://github.com/cbgbt/rust-crate-src-mcp
max_upload_size
id2002944
size92,354
Sean P. Kelly (cbgbt)

documentation

README

rust-crate-src

Fetch Rust crate source code from crates.io. Available as a library and MCP server.

Installing

Install via cargo:

cargo install rust-crate-src-mcp

Configure in your mcp.json:

{
  "mcpServers": {
    "rust-crate-src": {
      "command": "rust-crate-src-mcp"
    }
  }
}

Usage

As a Library

use rust_crate_src::get_crate_source;

let source = get_crate_source("serde", None).await?;
println!("Extracted to: {}", source.checkout_path.display());

// With version constraint
let source = get_crate_source("tokio", Some("^1.0")).await?;

MCP Tool

Exposes the get_rust_crate_source tool:

  • crate_name (required): Name of the crate to fetch
  • version (optional): Semver version constraint (e.g., "1.0", "^1.2", "~1.2.3")

Returns:

  • crate_name: Echo of requested crate
  • version: Resolved exact version
  • checkout_path: Path to extracted source
  • message: Human-readable summary

Development

make check    # Run all checks (test + lint + format) - REQUIRED before commits
make format   # Auto-format code
make test     # Run unit tests
make integ    # Run integration tests (requires network)

Architecture

Module Purpose
lib.rs Public API facade
version.rs Version resolution via crates.io API
extract.rs Download and extract .crate tarballs
bin/rust-crate-src-mcp.rs MCP server using rmcp

For AI Agents

See AGENTS.md for development guidelines.

Acknowledgments

This project is based on the get_rust_crate_source tool from symposium.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Commit count: 32

cargo fmt