7 releases
Uses new Rust 2024
| new 0.13.4 | May 15, 2026 |
|---|---|
| 0.13.3 | May 15, 2026 |
| 0.12.1 | May 13, 2026 |
| 0.11.0 | May 11, 2026 |
#1667 in Development tools
Used in aptu-coder
59KB
1K
SLoC
aptu-coder-remote
Remote repository exploration tools for GitLab and GitHub, implemented as MCP tools.
Part of the aptu-coder project.
Installation
Add to your Cargo.toml:
[dependencies]
aptu-coder-remote = "*"
Tools
remote_tree
List directory structure and file counts for a remote repository without cloning it.
Platform is auto-detected from the URL host (gitlab.com uses the gitlab crate,
github.com uses octocrab).
Parameters:
url(required): Full repository URL, e.g.https://gitlab.com/owner/repopath(optional): Subdirectory path. Defaults to root.ref(optional): Branch, tag, or commit SHA. Defaults to the default branch.depth(optional): Directory traversal depth. Default 2.
Output: Compact summary matching analyze_directory summary=true format.
remote_file
Fetch raw file content from a remote repository at a given ref, with optional line range to keep context cost low.
Parameters:
url(required): Full repository URLpath(required): File path within the repository, e.g.src/main.rsref(optional): Branch, tag, or commit SHA. Defaults to the default branch.line_range(optional): Line slice inSTART-ENDformat, e.g.10-50.
Authentication
Tokens are read from environment variables at call time, never stored:
GITLAB_TOKENfor GitLab repositoriesGITHUB_TOKENfor GitHub repositories
Usage Examples
Fetch a repository tree
use aptu_coder_remote::fetch_tree;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Requires GITHUB_TOKEN environment variable
let output = fetch_tree(
"https://github.com/clouatre-labs/aptu-coder",
Some("crates"),
None,
2,
).await?;
println!("{}", output.formatted);
Ok(())
}
Fetch a file with line range
use aptu_coder_remote::fetch_file;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Requires GITHUB_TOKEN environment variable
let output = fetch_file(
"https://github.com/clouatre-labs/aptu-coder",
"README.md",
None,
Some("1-50"),
).await?;
println!("{}", output.content);
Ok(())
}
API Reference
For detailed API documentation, see docs.rs.
License
Apache-2.0
Dependencies
~24–32MB
~522K SLoC