diff --git a/Makefile b/Makefile
index 18d456ae5fbd199fb57ed3e4702ac4eb701aade5..5a1d9dc37d0a08904fa77465f22bdb14e4ee9686 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,13 @@ config: cmd/generate-config/main.go cmd/generate-config/config_template.go cmd/g
 build: cmd/db-server/main.go
 	go build -o mo-server cmd/db-server/main.go
 
+# Building mo-server binary for debugging, it uses the latest MatrixCube from master.
+.PHONY: debug
+debug: cmd/db-server/main.go
+	go get github.com/matrixorigin/matrixcube
+	go mod tidy
+	go build -tags debug -o mo-server cmd/db-server/main.go
+
 # Running unit test cases
 # Set test timeout to 15 minutes
 # Excluding frontend test cases temporarily