copilot 0.0.2

MCP Server for Cargo
copilot-0.0.2 is not a library.

Getting started

cargo-copilot is a Model Context Protocol (MCP) server that gives LLMs access to your local Cargo workspace context and documentation.

Installation

Install the binary:

cargo install copilot

Configuration

VSCode (with MCP Extension)

Configure .vscode/mcp.json:

{
  "servers": {
    "cargo-copilot": {
      "command": "cargo",
      "args": ["copilot"]
    }
  }
}

Tools

cargo-copilot allows the LLM to inspect dependencies and read local documentation generated by cargo doc.

Tool Description
cargo_dependencies Lists all available dependencies in the current workspace as crate ids (name@version). Useful for discovering what packages are available to inspect.
cargo_doc_overview Fetches the main documentation page for a specific crate. It runs cargo doc --package <name> --no-deps internally to ensure docs are available.
cargo_doc_index Lists all symbols (modules, macros, structs, enums, functions, types) found in a crate's generated documentation.
cargo_doc_get Retrieves the full documentation for a specific symbol (e.g., de/struct.Deserializer) as Markdown.

Instructions

To get the best results, provide the following system prompt to your LLM:

# CRITICAL: cargo-copilot Tool Usage

You have access to the `cargo-copilot` MCP server. Follow this strict workflow
to answer questions about the codebase:

1.  **Discovery**: Use `cargo_dependencies` to see available crates.
2.  **Overview**: Use `cargo_doc_overview` to understand a crate's purpose.
3.  **Lookup**: Use `cargo_doc_index` to find the generated documentation
    location for a symbol.
4.  **Retrieval**: Use `cargo_doc_get` to read the documentation.

**IMPORTANT CONSTRAINT**: Generated documentation paths (HTML) often differ from
logical Rust module paths due to re-exports.

- **NEVER guess** the `symbol_path` argument for `cargo_doc_get`.
- **ALWAYS** copy the `symbol_path` strictly verbatim from the output of
  `cargo_doc_index`.
- If a path like `model/struct.ServerInfo.html` fails, it means the symbol is
  documented elsewhere (e.g. `handler/server/struct.ServerInfo.html`). You must
  check the index.

License

MIT. Use it for whatever.