mcapi
A unified, clean-room async Rust client for the Minecraft ecosystem — covering Mojang / Microsoft Auth, Modrinth, CurseForge, Yggdrasil / authlib-injector, Blessing Skin / CSL, Mod Loaders, Java Runtimes, and Server List Ping (SLP) in a single feature-gated crate.
Highlights
- Single Crate, Pay Only for What You Use: Pick exact modules via Cargo features. Enabling only
slpcompiles with zero HTTP (reqwest) dependencies. - One Shared
HttpCore(Arc-backed): Configure connection pooling,User-Agent, timeout, mirror routing, and retry policies once viaMcApi(orHttpCore) and clone zero-cost across every platform client. - Unified
mcapi::Error: One error enum andmcapi::Result<T>across all modules — no double-wrapping or per-client error conversion boilerplate. - Built-in Mirror Routing & Credential Isolation: First-class
Mirror::Bmclapi,Mirror::Mcim,Mirror::China, andMirror::Customprefix rewriting with optional fallback to official origins. Authenticated and mutating calls (client.authed(token)) always bypass mirrors so tokens and API keys are never leaked to third-party hosts. - Resilient & Forward-Compatible: Automatic
Retry-After/X-Ratelimit-*parsing, opt-in 429/5xx backoff retries, forward-compatibleUnknownenum variants, and[REDACTED]Debugformatting for all tokens and credentials.
Installation
Default (full + tls-aws-lc):
[]
= "0.2"
Selective modules (e.g. a launcher needing Mojang, Modrinth, Loaders, and Java Runtimes):
[]
= { = "0.2", = false, = ["mojang", "modrinth", "loaders", "java", "tls-aws-lc"] }
Zero-HTTP Server List Ping only (with optional DNS SRV):
[]
= { = "0.2", = false, = ["slp", "slp-srv"] }
Quick Start
1. Shared McApi Entry Point
Share one reqwest::Client connection pool, mirror configuration, and retry policy across all clients:
use Duration;
use ;
use ;
async
2. Authenticated Operations (client.authed(token))
Public endpoints live directly on <Platform>Client; protected endpoints live on client.authed(token) (Authed<'_>), which always sends requests directly to the official host (never through third-party mirrors):
use MojangClient;
# async
3. Native Server List Ping (Java & Bedrock)
use Duration;
use SlpClient;
async
Feature Flags
Module Features
| Feature | Default | Description |
|---|---|---|
full |
✅ | Enables all standard platform modules (curseforge, modrinth, mojang, yggdrasil, yggdrasil-authlib, blessing, loaders, java, slp) |
http |
via modules | Shared Arc-backed HttpCore, Mirror, ResiliencePolicy, McApi |
mojang |
via full |
MS OAuth2 (Device Code + PKCE) → XBL → XSTS (XErr) → Minecraft login, UUID/session lookup, Minecraft Services, Piston Meta |
modrinth |
via full |
Modrinth v2 REST API (CNF search, projects, chunked lookups, versions, SHA-1/512 hash lookup & update, tags, statistics, creator APIs) |
curseforge |
via full |
CurseForge Core API v1/v2 (search, chunked mods/files, Murmur2 cf_fingerprint, Minecraft versions/loaders, keyless mirror mode) |
yggdrasil |
via full |
Yggdrasil auth/session/profile client and ALI auto-discovery (YggdrasilClient::discover) |
yggdrasil-authlib |
via full |
authlib-injector build metadata client (AuthlibInjectorClient) |
yggdrasil-verify |
❌ | Opt-in RSA-SHA1 (SHA1withRSA) signature verification (ProfileProperty::verify_signature, GameProfile::decode_and_verify_textures) |
blessing |
via full |
Blessing Skin v6 REST API (login, /skinlib/list, /skinlib/info/{tid}, upload/manage, closet, players) + CustomSkinLoader endpoints |
loaders |
via full |
Fabric Meta v2, Quilt Meta v3, Forge (Maven XML / Promotions / BMCLAPI), NeoForge (Maven XML / 1.20.1 legacy / BMCLAPI), LiteLoader, OptiFine |
java |
via full |
Mojang Official Java Runtimes (all.json + file manifests), Adoptium Temurin v3, Azul Zulu Metadata v1 |
slp |
via full |
Native TCP Java SLP (1.7+ VarInt & 1.4–1.6 Legacy FE 01 FA) and UDP Bedrock RakNet Ping (zero HTTP deps) |
slp-srv |
❌ | Opt-in _minecraft._tcp DNS SRV resolution via hickory-resolver (cached per SlpClient) |
stream |
❌ | Enables reqwest/stream (Response::bytes_stream) for HttpCore::get_stream |
TLS Backends
Select one TLS backend when any HTTP module is enabled:
tls-aws-lc(default) —reqwest/rustls(aws-lc-rs)tls-native—reqwest/native-tlstls-native-vendored—reqwest/native-tls-vendoredtls-rustls-no-provider—reqwest/rustls-no-provider(supply your ownrustlscrypto provider)
Examples & Development
Run the included Server List Ping CLI example:
cargo run --example server_ping -- mc.hypixel.net
Run the full verification suite:
cargo fmt --all -- --check
cargo clippy --all-targets --all-features -- -D warnings
cargo test --all-features
cargo check --no-default-features
cargo check --no-default-features --features "full,tls-native"
cargo test --no-default-features --features "mojang,modrinth,tls-aws-lc"
cargo test --no-default-features --features "slp"
cargo test --no-default-features --features "yggdrasil,tls-aws-lc"
cargo test --no-default-features --features "yggdrasil-verify,tls-aws-lc"
cargo doc --all-features --no-deps
License
Dual-licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.