Quick Start#
Get up and running with Mooncake in minutes.
This guide walks you through the entire flow of getting started with Mooncake:
Install Mooncake
Start the Store master and Send a request with the Python Store API
Serving-framework users can then connect SGLang, vLLM or other systems.
Prerequisites#
Python: 3.10 or later; a virtual environment is recommended.
RDMA: an RDMA driver and SDK (for example, Mellanox OFED), if you plan to use RDMA for data transfer. On ScaleFabric SHCA systems, install
shca-toolsand build with-DUSE_SHCA=ON.CUDA: 12.1 or later. For most CUDA-enabled use cases, such as RDMA-based KV cache transfer between GPUs or between GPU and DRAM, NVIDIA GPUDirect support is also required. You may install CUDA from the NVIDIA downloads page.
Note
The default pip, build and Docker paths target NVIDIA CUDA. For other platforms, see Other Platforms below.
Installation#
The same package provides:
Mooncake Store Python bindings for vLLM and SGLang HiCache integrations.
Transfer Engine Python bindings and runtime components for direct
mooncake.engine.TransferEngineusage.
We recommend using uv for faster installation:
pip install --upgrade pip
pip install uv
uv pip install mooncake-transfer-engine
Plain pip also works:
pip install mooncake-transfer-engine
Tip
The default wheel targets CUDA 12.1–12.9 and includes Mooncake-EP and GPU
topology detection. For CUDA 13.0/13.1, install
mooncake-transfer-engine-cuda13 instead.
Clone the repository and build the default configuration:
git clone https://github.com/kvcache-ai/Mooncake.git
cd Mooncake
sudo bash dependencies.sh
mkdir build
cd build
cmake ..
make -j
sudo make install
For CUDA, VRAM segments, NVMe-oF, and other backend flags, see the Build Guide.
Published images are available on Docker Hub at kvcacheai/mooncake:
docker run --net=host \
--ipc=host \
--ulimit memlock=-1 \
kvcacheai/mooncake:latest \
mooncake_master
The multi-architecture image publishes these CUDA flavor tags:
Tag |
CUDA |
Notes |
|---|---|---|
|
13 |
Default flavor |
|
13 |
Default flavor for this version |
|
12 |
Fixed release, recommended for production |
|
13 |
Fixed release, recommended for production |
|
12 |
Floating alias for the newest CUDA 12 image |
|
13 |
Floating alias for the newest CUDA 13 image |
For details, see Use Mooncake in Docker Containers.
Note
If users encounter problems such as missing lib*.so, first install the
corresponding system runtime libraries. If the issue persists, uninstall the
package and build the binaries manually.
Other Platforms#
The default path above targets NVIDIA CUDA. Use the matching wheel or source build for other platforms. Install only one variant in an environment.
Prerequisites
Python 3.10 or later.
Ubuntu runtime libraries:
libcurl4,libibverbs1,rdma-core,librdmacm1,libnuma1, andliburing2.
Installation
sudo apt-get update && sudo apt-get install -y \
libcurl4 libibverbs1 rdma-core librdmacm1 libnuma1 liburing2
pip install mooncake-transfer-engine-non-cuda
Prerequisites
Python 3.10 or later.
Ascend CANN Toolkit. Source
/usr/local/Ascend/cann/set_env.shbefore running Mooncake. Ascend Direct (ADXL/HIXL) is the recommended path.
Installation
pip install mooncake-transfer-engine-npu
source /usr/local/Ascend/cann/set_env.sh
See Ascend Direct Transport for the recommended path. The legacy backend is documented in Ascend Transport. For mixed GPU/NPU transfers, see Heterogeneous Ascend Transport. There are also two detailed Chinese guides: Mooncake KVPool guide and Mooncake NPU guide.
Prerequisites
Python 3.10 or later.
ROCm / HIP SDK, with
hipccand runtime libraries onPATH(for example/opt/rocm).
Installation
pip install mooncake-transfer-engine-rocm
Prerequisites
Python 3.10 or later; XPU-enabled PyTorch for tensor APIs.
An Intel GPU with a compatible driver and Level Zero runtime.
Intel oneAPI DPC++ compiler (
icpx) and SYCL runtime. Source/opt/intel/oneapi/setvars.shbefore building and running Mooncake.
Installation
Build from source with XPU support enabled rather than using the default CUDA or non-CUDA wheel:
git clone https://github.com/kvcache-ai/Mooncake.git
cd Mooncake
sudo bash dependencies.sh
source /opt/intel/oneapi/setvars.sh
python -m pip install . \
-Ccmake.define.CMAKE_C_COMPILER=icx \
-Ccmake.define.CMAKE_CXX_COMPILER=icpx \
-Ccmake.define.USE_TENT=ON \
-Ccmake.define.USE_XPU=ON \
-Ccmake.define.USE_CUDA=OFF
export ONEAPI_DEVICE_SELECTOR=level_zero:gpu
export MC_USE_TENT=1
XPU requires TENT; the classic Transfer Engine has no XPU support. Use tcp
or rdma for Store setup. With rdma, XPU memory uses dma-buf RDMA when
available and is otherwise staged through host memory. XPUs on the same node
copy directly only when the devices have peer access; across processes, this
also needs same-node IPC (same PID namespace, and Yama ptrace_scope 0 or 1,
or CAP_SYS_PTRACE for scope 2). Otherwise the copy goes through host memory
or the network path.
See Build with Intel XPU and
Intel XPU Transport for details and limitations.
Prerequisites
Python 3.10 or later.
MUSA SDK. Add
/usr/local/musa/libtoLIBRARY_PATHandLD_LIBRARY_PATH.mthreads-peermemfor GPUDirect RDMA.
Installation
pip install mooncake-transfer-engine-musa
Prerequisites
An AWS instance with EFA (for example p5 or p6).
AWS EFA driver and libfabric. Verify with
fi_info -p efa, and keep/opt/amazon/efa/libonLD_LIBRARY_PATH.CUDA 12.1–12.9 or CUDA 13 if you use the GPU-aware EFA wheels.
Installation
# GPU memory transfers with CUDA 12
pip install mooncake-transfer-engine-efa
# GPU memory transfers with CUDA 13
pip install mooncake-transfer-engine-efa-cuda13
# CPU/DRAM-only transfers
pip install mooncake-transfer-engine-efa-non-cuda
See the EFA transport guide for prerequisites and configuration.
Prerequisites
Python 3.10 or later.
Cambricon Neuware SDK. Set
NEUWARE_HOME, or use the default/usr/local/neuware. There is no dedicated prebuilt MLU wheel yet.
Installation
git clone https://github.com/kvcache-ai/Mooncake.git
cd Mooncake
sudo bash dependencies.sh
mkdir build && cd build
cmake .. -DUSE_MLU=ON
make -j
sudo make install
Prerequisites
Python 3.10 or later.
MACA SDK. Set
MACA_HOME, or use the default/opt/maca.
Installation
git clone https://github.com/kvcache-ai/Mooncake.git
cd Mooncake
sudo bash dependencies.sh
mkdir build && cd build
cmake .. -DUSE_MACA=ON
make -j
sudo make install
Prerequisites
Python 3.10 or later.
Hygon DTK SDK. Set
DTK_HOME, or use the default/opt/dtk.
Installation
git clone https://github.com/kvcache-ai/Mooncake.git
cd Mooncake
sudo bash dependencies.sh
mkdir build && cd build
cmake .. -DUSE_HYGON=ON
make -j
sudo make install
Prerequisites
Python 3.10 or later.
Iluvatar CoreX SDK. Set
COREX_HOME, or use the default/usr/local/corex.
Installation
git clone https://github.com/kvcache-ai/Mooncake.git
cd Mooncake
sudo bash dependencies.sh
mkdir build && cd build
cmake .. -DUSE_COREX=ON
make -j
sudo make install
Prerequisites
Python 3.10 or later.
Biren SUPA SDK. Set
BIREN_HOMEto the SDK root containingsupa/includeandsupa/lib, or use the default/usr/local/birensupa/all/latest.
Installation
git clone https://github.com/kvcache-ai/Mooncake.git
cd Mooncake
sudo bash dependencies.sh
mkdir build && cd build
cmake .. -DUSE_SUPA=ON -DBIREN_HOME=/usr/local/birensupa/all/latest
make -j
sudo make install
Start Mooncake Store#
If you installed with pip or from source, start the master service:
mooncake_master
Wait until you see a line like this in the logs:
Master service started on port 50051, max_threads=4, ...
The default RPC port is 50051. Skip this step if the Docker command above is
already running mooncake_master.
Send Your First Request#
Run this single-node put/get example after mooncake_master is running. This example uses P2PHANDSHAKE, so no separate Transfer Engine metadata service is required.
from mooncake.store import MooncakeDistributedStore
store = MooncakeDistributedStore()
store.setup(
local_hostname="localhost",
metadata_server="P2PHANDSHAKE",
global_segment_size=512 * 1024 * 1024,
local_buffer_size=128 * 1024 * 1024,
protocol="tcp",
rdma_devices="",
master_server_addr="127.0.0.1:50051",
)
store.put("hello_key", b"Hello, Mooncake Store!")
data = store.get("hello_key")
print(data.decode()) # Output: Hello, Mooncake Store!
store.close()
Connect vLLM or SGLang#
Choose the integration path that matches your serving deployment.
PD Disaggregation#
PD disaggregation paths use Mooncake Transfer Engine for direct KV transfer between prefill and decode workers. Configure these paths through the serving framework guides, not by calling Transfer Engine APIs directly:
Distributed KV Cache Pooling#
Mooncake Store provides distributed KV cache storage for vLLM and SGLang HiCache:
Framework |
Use case |
Setup guide |
|---|---|---|
SGLang |
HiCache L3 storage backend with Mooncake Store |
|
vLLM |
KV cache storage and sharing with |
AI Coding Assistant Skills#
If you use Claude Code or another coding assistant that supports reusable skills, Mooncake provides built-in playbooks for common development tasks:
Skill |
Use it for |
|---|---|
|
Diagnose services, RDMA, environment variables, and runtime logs. |
|
Run pre-PR local validation with Mooncake’s CI script. |
|
Work with Mooncake Store, Transfer Engine, and EP/Backend Python APIs. |
Install them from the Claude Code plugin marketplace without cloning the full repository:
/plugin marketplace add kvcache-ai/Mooncake --sparse .claude-plugin
/plugin install mooncake-troubleshoot@mooncake
/plugin install mooncake-ci-local@mooncake
/plugin install mooncake-api@mooncake
Next Steps#
For production deployment, standalone store services, high availability, allocation strategies, SSD offload, and runtime tuning, continue to the Mooncake Store Deployment & Tuning Guide.
For API details, see the Mooncake Store Python API and Mooncake Store design.