### Rust Project Development Setup Commands Source: https://github.com/snowmead/rust-docs-mcp/blob/main/docs/CONTRIBUTING.md Commands to set up the Rust development environment for the rust-docs-mcp project, including installing the nightly toolchain and running basic build and test operations. ```bash rustup toolchain install nightly ``` ```bash cargo build ``` ```bash cargo test ``` -------------------------------- ### rust-docs-mcp Command Line Interface (CLI) usage Source: https://github.com/snowmead/rust-docs-mcp/blob/main/README.md Illustrates various command-line options for `rust-docs-mcp`, including starting the MCP server, performing a default installation, forcing an overwrite of an existing installation, and displaying the help message for available commands. ```bash rust-docs-mcp # Start MCP server rust-docs-mcp install # Install to ~/.local/bin rust-docs-mcp install --force # Force overwrite existing installation rust-docs-mcp --help # Show help ``` -------------------------------- ### Install rust-docs-mcp with a single command Source: https://github.com/snowmead/rust-docs-mcp/blob/main/README.md Provides a quick and easy way to install the `rust-docs-mcp` tool using a curl pipe to bash script. This is the recommended installation method, presented as both a 'Quick Install' and a 'One-liner'. ```bash curl -sSL https://raw.githubusercontent.com/snowmead/rust-docs-mcp/main/install.sh | bash ``` -------------------------------- ### Example command for generating module structure Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Commands to navigate to an example project directory and generate its module structure, including test configurations, demonstrating how to use `cargo-modules structure`. ```bash cd ./tests/projects/readme_tree_example cargo-modules structure --cfg-test ``` -------------------------------- ### Example: Running cargo-modules orphans Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md A practical example demonstrating how to execute the `cargo-modules orphans` command from a specific project directory to identify orphaned files. ```bash cd ./tests/projects/orphans cargo-modules orphans ``` -------------------------------- ### Install rust-docs-mcp to a custom directory Source: https://github.com/snowmead/rust-docs-mcp/blob/main/README.md Allows users to specify a non-default installation path for `rust-docs-mcp` by passing the `--install-dir` argument to the installation script. This provides flexibility for system administrators or users with specific directory preferences. ```bash curl -sSL https://raw.githubusercontent.com/snowmead/rust-docs-mcp/main/install.sh | bash -s -- --install-dir /usr/local/bin ``` -------------------------------- ### Build rust-docs-mcp from source Source: https://github.com/snowmead/rust-docs-mcp/blob/main/README.md Details the steps to clone the `rust-docs-mcp` repository, navigate to the project directory, build the release binary using Cargo, and then install it. This process requires the Rust nightly toolchain and network access to download dependencies. ```bash git clone https://github.com/snowmead/rust-docs-mcp cd rust-docs-mcp/rust-docs-mcp cargo build --release ./target/release/rust-docs-mcp install ``` -------------------------------- ### Install cargo-modules Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Command to install the `cargo-modules` tool using the Rust `cargo` package manager. ```bash cargo install cargo-modules ``` -------------------------------- ### Install Rust nightly toolchain for rust-docs-mcp Source: https://github.com/snowmead/rust-docs-mcp/blob/main/README.md Installs the Rust nightly toolchain, which is a prerequisite for building `rust-docs-mcp` from source. This is necessary because the tool depends on Rustdoc JSON generation features that are typically available in nightly builds. ```bash rustup toolchain install nightly ``` -------------------------------- ### Generate and Render Graphical Dependencies with `dot` to SVG Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Demonstrates an example workflow for generating a graphical representation of dependencies, including test configurations, and piping the output to the `dot` tool for SVG rendering. The example first navigates to a specific project directory to execute the command. ```bash cd ./tests/projects/smoke cargo-modules dependencies --cfg-test | dot -Tsvg ``` -------------------------------- ### Example Rust crate module structure output Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md An example of the hierarchical module structure output generated by `cargo-modules structure` for a Rust crate. It illustrates how modules, traits, unions, enums, and functions are displayed with their visibility and attributes. ```rust crate readme_tree_example ├── trait Lorem: pub ├── mod amet: pub(crate) │ └── mod consectetur: pub(self) │ └── mod adipiscing: pub(self) │ └── union Elit: pub(in crate::amet) ├── mod dolor: pub(crate) │ └── enum Sit: pub(crate) └── mod tests: pub(crate) #[cfg(test)] └── fn it_works: pub(self) #[test] ``` -------------------------------- ### Rust Code Style and Linting Commands Source: https://github.com/snowmead/rust-docs-mcp/blob/main/docs/CONTRIBUTING.md Commands to ensure code adheres to Rust's official style guide and to perform static analysis for potential issues before committing changes. ```bash cargo fmt ``` ```bash cargo clippy ``` -------------------------------- ### Generate Filtered Module Structure Graph in DOT Format Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Illustrates an example command to generate a DOT file representing a crate's graphical module structure. This specific command filters out external items, functions, sysroot crates, traits, types, and 'use' edges, focusing solely on internal module organization. ```bash cargo modules dependencies --no-externs --no-fns --no-sysroot --no-traits --no-types --no-uses > mods.dot ``` -------------------------------- ### cargo-modules CLI Global Help Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Detailed help output for the `cargo-modules` command, listing available subcommands and global options. This provides an overview of the tool's capabilities. ```APIDOC $ cargo modules --help Visualize/analyze a crate's internal structure. Usage: cargo-modules Commands: structure Prints a crate's hierarchical structure as a tree. dependencies Prints a crate's internal dependencies as a graph. orphans Detects unlinked source files within a crate's directory. help Print this message or the help of the given subcommand(s) Options: -h, --help Print help ``` -------------------------------- ### API Reference for `cargo modules dependencies` Command Options Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Provides a comprehensive API-like documentation for the `cargo modules dependencies` command. It lists all available command-line options, their purposes, and default values, serving as a complete reference for command usage and configuration. ```APIDOC $ cargo modules dependencies --help Prints a crate's internal dependencies as a graph. Usage: cargo-modules dependencies [OPTIONS] Options: --verbose Use verbose output --lib Process only this package's library --bin Process only the specified binary -p, --package Package to process (see `cargo help pkgid`) --no-default-features Do not activate the `default` feature --all-features Activate all available features --features List of features to activate. This will be ignored if `--cargo-all-features` is provided --target Analyze for target triple --manifest-path Path to Cargo.toml [default: .] --no-externs Filter out extern items from extern crates from graph --no-fns Filter out functions (e.g. fns, async fns, const fns) from graph --no-modules Filter out modules (e.g. `mod foo`, `mod foo {}`) from graph --no-sysroot Filter out sysroot crates (`std`, `core` & friends) from graph --no-traits Filter out traits (e.g. trait, unsafe trait) from graph --no-types Filter out types (e.g. structs, unions, enums) from graph --no-uses Filter out "use" edges from graph --acyclic Require graph to be acyclic --layout The graph layout algorithm to use (e.g. none, dot, neato, twopi, circo, fdp, sfdp) [default: neato] --focus-on Focus the graph on a particular path or use-tree's environment, e.g. "foo::bar::{self, baz, blee::*}" --max-depth The maximum depth of the generated graph relative to the crate's root node, or nodes selected by '--focus-on' --cfg-test Analyze with `#[cfg(test)]` enabled (i.e as if built via `cargo test`) -h, --help Print help If you have xdot installed on your system, you can run this using: `cargo modules dependencies | xdot -` ``` -------------------------------- ### Configure rust-docs-mcp in MCP server settings Source: https://github.com/snowmead/rust-docs-mcp/blob/main/README.md Provides a JSON snippet demonstrating how to integrate `rust-docs-mcp` into an existing MCP (Multi-Client Protocol) configuration. It specifies the command path to the `rust-docs-mcp` executable and sets the transport method to 'stdio'. ```json { "rust-docs": { "command": "/path/to/rust-docs-mcp/target/release/rust-docs-mcp", "transport": "stdio" } } ``` -------------------------------- ### Overview of cargo-modules commands Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Common commands available with `cargo-modules` for analyzing crate structure, dependencies, and orphaned files. Each command provides specific insights into the project's organization. ```bash # Print a crate's hierarchical structure as a tree: cargo modules structure # Print a crate's internal dependencies as a graph: cargo modules dependencies # Detect unlinked source files within a crate's directory: cargo modules orphans ``` -------------------------------- ### cargo modules orphans Command Line Options (APIDOC) Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Detailed reference for the command-line options available with `cargo-modules orphans`. This section acts as an API documentation for the command, outlining its usage, various flags for verbose output, package filtering, feature activation, target specification, and help options. ```APIDOC $ cargo modules orphans --help Detects unlinked source files within a crate's directory. Usage: cargo-modules orphans [OPTIONS] Options: --verbose Use verbose output --lib Process only this package's library --bin Process only the specified binary -p, --package Package to process (see `cargo help pkgid`) --no-default-features Do not activate the `default` feature --all-features Activate all available features --features List of features to activate. This will be ignored if `--cargo-all-features` is provided --target Analyze for target triple --manifest-path Path to Cargo.toml [default: .] --deny Returns a failure code if one or more orphans are found --cfg-test Analyze with `#[cfg(test)]` enabled (i.e as if built via `cargo test`) -h, --help Print help ``` -------------------------------- ### cargo modules structure CLI Command Help Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Detailed help output for the `cargo modules structure` command, listing all available options for customizing the structure visualization. Options include filtering by type, sorting, and focusing on specific paths. ```APIDOC $ cargo modules structure --help Prints a crate's hierarchical structure as a tree. Usage: cargo-modules structure [OPTIONS] Options: --verbose Use verbose output --lib Process only this package's library --bin Process only the specified binary -p, --package Package to process (see `cargo help pkgid`) --no-default-features Do not activate the `default` feature --all-features Activate all available features --features List of features to activate. This will be ignored if `--cargo-all-features` is provided --target Analyze for target triple --manifest-path Path to Cargo.toml [default: .] --no-fns Filter out functions (e.g. fns, async fns, const fns) from tree --no-traits Filter out traits (e.g. trait, unsafe trait) from tree --no-types Filter out types (e.g. structs, unions, enums) from tree --sort-by The sorting order to use (e.g. name, visibility, kind) [default: name] --sort-reversed Reverses the sorting order --focus-on Focus the graph on a particular path or use-tree's environment, e.g. "foo::bar::{self, baz, blee::*}" --max-depth The maximum depth of the generated graph relative to the crate's root node, or nodes selected by '--focus-on' --cfg-test Analyze with `#[cfg(test)]` enabled (i.e as if built via `cargo test`) -h, --help Print help ``` -------------------------------- ### Rustdocs MCP Server API Reference Source: https://github.com/snowmead/rust-docs-mcp/blob/main/README.md This section outlines the core functions and capabilities exposed by the Rustdocs MCP server. It categorizes methods for cache management, documentation querying, dependency analysis, and module structure generation, providing agents with programmatic access to deep Rust crate intelligence. ```APIDOC MCP Tools: Cache Management: cache_crate_from_cratesio() cache_crate_from_github() cache_crate_from_local() remove_crate() list_cached_crates() list_crate_versions() get_crates_metadata() Documentation Queries: search_items_preview() search_items() list_crate_items() get_item_details() get_item_docs() get_item_source() Dependency Analysis: get_dependencies() Structure Analysis: structure() ``` -------------------------------- ### Basic Usage of cargo modules orphans Command Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Illustrates the fundamental command-line syntax for using `cargo modules orphans` to scan a crate's directory for unlinked source files. ```bash cargo modules orphans ``` -------------------------------- ### Basic Usage of `cargo modules dependencies` Command Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Presents the fundamental command structure for invoking `cargo modules dependencies`. This command is used to print a crate's internal dependencies as a graph, with various options available for customization. ```bash cargo modules dependencies ``` -------------------------------- ### Output of cargo modules orphans with Warnings Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Illustrates the console output when `cargo modules orphans` successfully detects orphaned modules. The output includes specific warnings for each unlinked file, suggesting potential fixes, and concludes with a summary of the findings. ```plain 2 orphans found: warning: orphaned module `foo` at src/orphans/foo/mod.rs --> src/orphans.rs | ^^^^^^^^^^^^^^ orphan module not loaded from file | help: consider loading `foo` from module `orphans::orphans` | | mod foo; | ++++++++ | warning: orphaned module `bar` at src/orphans/bar.rs --> src/orphans.rs | ^^^^^^^^^^^^^^ orphan module not loaded from file | help: consider loading `bar` from module `orphans::orphans` | | mod bar; | ++++++++ | Error: Found 2 orphans in crate 'orphans' ``` -------------------------------- ### Usage of cargo modules structure command Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md The basic command syntax for printing a crate's hierarchical structure as a tree. This command is used to visualize the module organization. ```bash cargo modules structure ``` -------------------------------- ### Plain Text Output Format for `cargo modules` Terminal Colors Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Defines the generic structure of the `cargo modules` command's output when terminal colors are enabled. It outlines placeholders for visibility, keyword, name, and test attributes, aiding visual parsing of the command's results. ```plain └── [] ``` -------------------------------- ### Automated MCP Tools List Update Command Source: https://github.com/snowmead/rust-docs-mcp/blob/main/docs/CONTRIBUTING.md A specific Claude Code command designed to automatically synchronize the list of MCP tools across `service.rs`, `README.md`, and `install.sh` files, ensuring documentation consistency. ```bash /update_mcp_tools_list ``` -------------------------------- ### Configure Rustdocs MCP Cache Directory Source: https://github.com/snowmead/rust-docs-mcp/blob/main/README.md This snippet demonstrates how to customize the default cache directory for the Rustdocs MCP server. Users can specify a custom path for storing cached Rust crate data either via a command-line argument or by setting an environment variable, providing flexibility in managing storage locations. ```bash # Command line option rust-docs-mcp --cache-dir /custom/path/to/cache # or set the environment variable export RUST_DOCS_MCP_CACHE_DIR=/custom/path/to/cache rust-docs-mcp ``` -------------------------------- ### Plain Text Structure of Graph Nodes in `cargo modules` Output Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Details the visual layout of individual nodes within the dependency graphs generated by `cargo modules`. It shows a plain text representation of how visibility, keyword, and path information are structured within each node. ```plain ┌────────────────────────┐ │ │ ├────────────────────────┤ │ │ └────────────────────────┘ ``` -------------------------------- ### Detecting Circular Dependencies with cargo-modules Source: https://github.com/snowmead/rust-docs-mcp/blob/main/cargo-modules/README.md Demonstrates the error output generated by `cargo modules dependencies --acyclic` when a circular dependency is identified within a Rust project. The output clearly traces the path of the detected cycle. ```plain Error: Circular dependency between `cargo_modules::options::general` and `cargo_modules::options::generate`. ┌> cargo_modules::options::general │ └─> cargo_modules::options::generate::graph │ └─> cargo_modules::options::generate └──────────┘ ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.