lockdoc MCP server
Commit Oct 26, 2026Provides coding agents with precise API documentation for Rust dependencies based on the exact versions and features in a project's Cargo.lock.
Also known as edg-l/lockdoc
- Stars
- 4
- Tools
- 3
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Oct 26, 2026
- License
- Apache-2.0
What is lockdoc MCP?
lockdoc provides coding agents with precise API documentation for Rust dependencies based on the exact versions and features in a project's Cargo.lock. It exposes 3 tools, such as item, search, deps.
Summary generated from the project's README
About lockdoc MCP server
Providing coding agents with precise API documentation for Rust dependencies is what lockdoc enables. It solves the problem of AI models using outdated or incorrect signatures by generating rustdoc JSON based on the exact versions and features specified in a project's Cargo.lock file. This ensures that an agent writing code against a specific version of a crate, such as bevy 0.20, receives the correct signatures rather than relying on training data from older versions.
Developers use this server by installing a specific nightly toolchain and registering it with clients like Claude Code. The server operates within the current cargo workspace and uses a dedicated cache directory in ~/.cache/lockdoc to avoid interfering with the project's own target directory or build locks. It provides three main tools: item for looking up specific paths, search for finding public items by name, and deps for listing direct dependencies with their locked versions and features.
What you can do with it
- 1Verify exact API signaturesAn agent can retrieve the precise declaration, methods, and trait implementations for a specific Rust item using its path.
- 2Discover crate membersA developer can ask an AI to find public items within a specific crate or module that match a certain name.
- 3Audit project dependenciesYou can use the server to list all direct dependencies in a workspace along with their locked versions and enabled features.
Written from the project's README. Every use case is checked against a quote from it.
lockdoc MCP tools 3
Detected from the READMEitemsearchdeps
Automated checks
Ran Nov 14, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachableedg-l/lockdoc is public and reachablegithub.com/edg-l/lockdoc ↗Pass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)Apache-2.0spdx.org/licenses/Apache-2.0.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-10-26github.com/edg-l/lockdoc ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model3 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNo tool named like delete, drop or execPass
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHublockdoc
API docs for your dependencies, at the versions in your Cargo.lock.
An MCP server for coding agents working in Rust.
Coding agents write Rust against the API they remember, and they remember whichever version was common in their training data. When your project pins bevy 0.20 and the agent learned 0.15, it writes calls that no longer exist, and the compiler is the first to notice.
lockdoc gives the agent the real signatures instead. It builds rustdoc JSON for each dependency at the exact version and feature set your lockfile resolves, and answers lookups from it:
> item tokio::sync::Mutex
struct tokio::sync::Mutex (tokio 1.53.3)
defined at tokio::sync::mutex::Mutex
pub struct Mutex<T: ?Sized> {
/* private fields */
}
An asynchronous `Mutex`-like type.
…
Inherent items (10):
fn new(t: T) -> Self where T: Sized // Creates a new lock in an unlocked state ready for use.
async fn lock(&self) -> MutexGuard<'_, T> // Locks this mutex, causing the current task to yield until the lock has been acquired.
fn try_lock(&self) -> Result<MutexGuard<'_, T>, TryLockError> // Attempts to acquire the lock, and returns [`TryLockError`] if the lock is currently held somewhere else.
…
Trait impls: Debug, Default, From<T>, Send, Sync
Paths resolve the way use does, through re-exports and globs, so
bevy::prelude::Transform finds the struct in bevy_transform and reports which crate and
version it came from.
Install
lockdoc needs a nightly toolchain, because rustdoc's JSON output is nightly-only. The nightly is pinned so its output format matches the parser lockdoc is built with.
rustup toolchain install nightly-2026-10-07
cargo install lockdoc
Then register it with your agent. For Claude Code, across all projects:
claude mcp add --scope user lockdoc -- lockdoc serve
The server works on the cargo workspace it is started in. Claude Code starts MCP servers in
the project directory, so nothing else is needed; every tool also takes a project path.
Tools
| Tool | What it returns |
|---|---|
item |
One item by path: declaration, docs, and its methods, fields, variants, trait impls or module contents. Type::method shows a single associated item. |
search |
Public items under a crate or module, or across every direct dependency, whose name matches, each at its shortest public path with its signature. |
deps |
The workspace's direct dependencies with locked versions and enabled features. |
The same queries run from the shell, which is handy for checking what the agent sees:
lockdoc item serde::Serialize
lockdoc search bevy Commands --limit 5
lockdoc search JpegDecoder
lockdoc -C ~/dev/my-game deps
docs/tools.md has every parameter and the output format.
It stays out of your project's way
- Builds go to lockdoc's own target directory under
~/.cache/lockdoc. Yourtarget/and cargo's build lock on it are never touched, socargo buildin the project never waits on lockdoc. - Every cargo command runs with
--locked, so lockdoc cannot rewriteCargo.lock; an out-of-date lockfile is reported as an error. Cargo may download a locked crate's source into~/.cargowhen this machine does not have it yet, ascargo buildwould. - The toolchain is selected with
+nightly-…, so arust-toolchain.tomlin the project does not change it. - A lookup that had to build says so, with the crates and the time taken, so the agent knows why a call was slow and that nothing in the project changed.
Costs and limits
The first lookup in a crate builds its docs. A small crate takes seconds. A facade such as
bevy re-exports around 60 crates, and the first lookup through it took 60 to 170 seconds on
a Ryzen 5 5600, depending on whether the dependencies were already compiled.
After that, everything comes from a cache on disk that new sessions reuse. On the same
machine, with bevy's docs built, a lookup through bevy::prelude takes 45 ms from the shell
and under 10 ms from a running server, and a search across all of bevy takes 2 to 12 ms. The
server held 121 MB after those calls.
| Not covered | Why |
|---|---|
std, core, alloc |
Only the project's dependencies are built. |
| Trait impls in downstream crates | A trait's implementors come from its own crate and that crate's dependencies. |
| Caching path dependencies across sessions | They have no version to key the cache on, so each server process rebuilds them once. |
docs/how-it-works.md covers the build pipeline, cache layout and re-export resolution.
License
Apache-2.0. See LICENSE.
lockdoc MCP questions
What tools does lockdoc MCP provide?
It exposes 3 tools, including item, search, deps.
Does lockdoc modify my project's files?
No, it builds documentation in its own target directory under ~/.cache/lockdoc and uses --locked to ensure Cargo.lock is never rewritten.
What toolchain is required to run lockdoc?
It requires a specific nightly toolchain because rustdoc's JSON output is only available in nightly versions.
Does lockdoc cover the Rust standard library?
No, it only builds documentation for the project's direct dependencies.
How does lockdoc handle re-exports and globs?
Paths resolve the same way the use keyword does, allowing it to find structs through re-exports and report their original crate and version.