A lightweight C++17 library for retrieving Minecraft Java and Bedrock server status using the public API from mcstatus.io.
The library provides a simple interface to check whether a server is online and retrieve useful information such as player count and server version.
The project is designed as a modern CMake package and integrates easily with existing C++ projects.
- Check Minecraft Java Edition server status
- Check Minecraft Bedrock Edition server status
- Simple structured API
- Modern C++17 implementation
- Easy CMake integration
- Designed to be packaged for vcpkg
This library requires the following dependencies:
- CPR — HTTP client library
- nlohmann-json — JSON parsing library
Both dependencies can be installed using vcpkg.
If you do not already have vcpkg, install it first.
git clone https://github.com/microsoft/vcpkg
cd vcpkgWindows
bootstrap-vcpkg.batLinux / macOS
./bootstrap-vcpkg.shvcpkg install cpr
vcpkg install nlohmann-jsonClone the repository:
git clone https://github.com/Arp1it/Minecraft_Server_Status_CPP.git
cd Minecraft_Server_Status_CPPConfigure the project with CMake:
cmake -B build -S . \
-DCMAKE_TOOLCHAIN_FILE=[path-to-vcpkg]/scripts/buildsystems/vcpkg.cmakeBuild the project:
cmake --build buildInstall the package:
cmake --install buildAfter installation, the library can be discovered automatically by CMake.
Add the package to your CMakeLists.txt:
find_package(minecraft_api REQUIRED)
target_link_libraries(my_app
PRIVATE minecraft_api::minecraft_api
)#include <iostream>
#include "minecraft_server_status/minecraft_server_status.hpp"
int main() {
auto status = minecraft_server_status::java("hypixel.net");
std::cout << "Online: " << status.online << std::endl;
std::cout << "Players: "
<< status.players_online
<< "/"
<< status.players_max
<< std::endl;
std::cout << "Version: "
<< status.version
<< std::endl;
}auto status = minecraft_server_status::bedrock("play.example.com");struct Server_Status {
bool online;
int players_online;
int players_max;
std::string version;
};If the API request fails, the library throws:
std::runtime_error
Example message:
Failed to fetch Minecraft server status
This project is structured as a CMake package, allowing it to be discovered using:
find_package(minecraft_api REQUIRED)
The exported target is:
minecraft_api::minecraft_api
This makes the library easy to integrate into modern CMake-based C++ projects and simplifies packaging for vcpkg.
Minecraft_Server_Status_CPP
│
├── include/
│ └── minecraft_server_status/
│ └── minecraft_server_status.hpp
│
├── src/
│ ├── java.cpp
│ └── bedrock.cpp
│
├── cmake/
│ └── minecraft_apiConfig.cmake
│
├── CMakeLists.txt
├── LICENSE
└── README.md
This library uses the public Minecraft server status API provided by: