Back to mods
Server Info API project artwork

CurseForge · Minecraft mod

Server Info API

A simple server mod that setup an API endpoint for access server info through HTTP

Choose a version Pick your version below, then grab the matching file.

Quick answer

Which Server Info API release should I use?

Updated 1 year ago
beta file 1.0.0-rc1
Game version 1.21.5, 1.21.4, 1.21.3
Loader Fabric

Server Info API 1.0.0-rc1 targets 1.21.5, 1.21.4, 1.21.3 with Fabric. The project page does not say whether this file belongs on the client, dedicated server, or both. All 1 required mods have matching files.

Where it goes

Is Server Info API required on the client, server, or both?

The project page does not say whether this file belongs on the client, dedicated server, or both.

Client Source doesn’t say
Dedicated server Source doesn’t say
Loader for this release Fabric
Required install it here Optional supported, not mandatory Not supported do not install here Source doesn’t say do not assume

The source does not explicitly classify this release as client-only or server-only.

What else does Server Info API 1.0.0-rc1 need?

1.0.0-rc1. Change the file and its required mods may change too.

All 1 required mods have matching files

Install Fabric API first. We found matching files for this game-version and loader setup.

Fabric API Needed by Server Info API 1.0.0-rc1
required
Matching file found Matched file: [1.21.1] Fabric API 0.116.18+1.21.1

We only count dependency files that match this setup. A file for another loader does not fill the gap.

Before you install it

Add Server Info API without breaking your instance.

Built for Server Info API 1.0.0-rc1. Pick another file and the loader, install side or required mods may change.

  1. 01

    Stick to this file

    Use 1.0.0-rc1. It targets 1.21.5, 1.21.4, 1.21.3 with Fabric; another release may have different loader, side or dependency requirements.

  2. 02

    Bring the mods it needs

    Install Fabric API first. We found matching files for this game-version and loader setup.

  3. 03

    Put it on the correct side

    The project page does not say whether this file belongs on the client, dedicated server, or both.

  4. 04

    Pick the file you checked

    Use the “Get this file” button beside 1.0.0-rc1. It opens that exact file at the source.

About this project

What does Server Info API add?

🚀 Server Info API Mod

Access and Extend Server Information via HTTP API

This mod is designed to empower Minecraft server owners and mod developers by providing a robust and easily extendable HTTP API. Get real-time server statistics and seamlessly integrate your server's and mod's data into external applications or web interfaces.


✨ Why You Need This Mod

Are you looking to:

  • 📊 Monitor your server via HTTP request?
  • 🎮 Display live player counts on your website?
  • 🤖 Create custom Discord bots that interact with your server data?
  • 🔌 Allow other mods to effortlessly expose their data through a unified API?

The Server Info API mod makes all of this a lot easier! It sets up a dedicated API endpoint for your Minecraft server, offering both essential predefined routes and a flexible system for developers to add their own.


⚙️ Quick Setup

By default, the API runs on port 8080. You can easily change this port to suit your needs by modifying the apiPort setting in config/Server Info API/settings.json.


🌐 API Endpoints - What You Can Access

This mod comes with powerful predefined routes to get you started immediately.

📊 /status

Get a comprehensive overview of your server's vital statistics, including disk usage, CPU load, RAM consumption, and current player counts.

Example Response:

{
  "disk": {
    "totalGB": 1606,
    "freeGB": 343,
    "usedMB": 25
  },
  "players": {
    "online": 0,
    "max": 20
  },
  "cpu": {
    "usagePercent": 9.865470852017937
  },
  "ram": {
    "totalMB": 63033,
    "usedMB": 31469
  }
}

👥 /players

Show the total number of players who have ever joined your server and see a list of all currently online players.

Example Response:

{
  "totalPlayers": 1,
  "onlinePlayers": []
}

👤 /player/:criteria

Retrieve detailed information about a specific player by using their in-game name or UUID as the :criteria.

Example Response:

{
  "name": "PLAYER_NAME",
  "online": true,
  "uuid": "PLAYER_UUID",
  "info": {
    "currentChunkPos": {
      "z": 1,
      "x": 0
    },
    "currentPos": {
      "z": 23.423937096484163,
      "x": 7.907748838070694,
      "y": 100.12983446114534
    },
    "dimension": "minecraft:the_nether"
  }
}

🚀 For Developers

This mod isn't just for server owners; it's built with extensibility in mind! Any mod developer can easily register custom API routes to expose their mod's unique data or functionalities.

1. Create Your Route Class

Define your API endpoint by creating a class that implements the APIRoute interface. You can use the @RouteSettings annotation to configure its path and behavior.

import xyz.yoinky3000.server_info_api.annotations.RouteSettings;
import xyz.yoinky3000.server_info_api.api.APIRequest;
import xyz.yoinky3000.server_info_api.api.APIResponse;
import xyz.yoinky3000.server_info_api.api.APIRoute;
import net.minecraft.server.MinecraftServer; // Import for the server parameter

// --- Option 1: Basic Route (no server required) ---
// This route will respond with "test" and does not require the MinecraftServer to be fully loaded.
@RouteSettings(path = "/my-simple-test-route") // requireMinecraftServer is false by default
public class MySimpleTestRoute implements APIRoute {
    @Override
    public APIResponse handle(APIRequest apiRequest) {
        // You don't have access to the MinecraftServer object here
        return new APIResponse(APIResponse.HttpStatus.OK, APIResponse.MimeType.TEXT_PLAIN, "Hello from my simple route!");
    }
}

// --- Option 2: Route Requiring MinecraftServer ---
// This route will only serve requests once the MinecraftServer is ready.
// If a request comes in before the server is ready, an HTTP 500 (INTERNAL_SERVER_ERROR)
// will be automatically sent.
@RouteSettings(path = "/my-server-data-route", requireMinecraftServer = true)
public class MyServerDataRoute implements APIRoute {
    @Override
    public APIResponse handle(APIRequest request, MinecraftServer server) {
        // Here, 'server' is guaranteed not to be null if requireMinecraftServer is true
        int onlinePlayers = server.getCurrentPlayerCount();
        return new APIResponse(APIResponse.HttpStatus.OK, APIResponse.MimeType.TEXT_PLAIN,
            "Currently online players: " + onlinePlayers);
    }
}

@RouteSettings explained:

  • path: The API endpoint (e.g., /my-custom-data).
  • requireMinecraftServer: If true, the route will only serve requests when the Minecraft server is fully initialized. If a request arrives before the server is ready, an HTTP 500 (Internal Server Error) response is sent automatically. This is false by default.

2. Register Your Route Class

Once you've created your APIRoute class, register it with the ServerInfoAPI. You can do this at any time, even outside of onInitialize if your mod's logic requires it. The route becomes active as soon as it's registered!

import xyz.yoinky3000.server_info_api.ServerInfoAPI;
import net.fabricmc.api.ModInitializer; // Assuming Fabric ModInitializer

public class CustomMod implements ModInitializer {
    @Override
    public void onInitialize() {
        // ... your other initialization code ...

        // Registering a route using the annotation (recommended for clarity)
        ServerInfoAPI.registerRoute(new MyServerDataRoute()); // The annotation handles path and server requirement

        // Alternatively, if you prefer not to use annotations, or for dynamic paths:
        // You can explicitly define path, server requirement, and override behavior.
        // ServerInfoAPI.registerRoute("/my-dynamic-route", new MySimpleTestRoute());
        // ServerInfoAPI.registerRoute("/admin-data", new MyServerDataRoute(), true, true); // Path, Route, requiresServer, override

        System.out.println("Custom API routes registered!");
    }
}

registerRoute Overloads for Flexibility: The ServerInfoAPI offers various registerRoute methods to give you full control:

  • public static APIHandler.RegisterResult registerRoute(APIRoute route): Registers a route configured by its @RouteSettings annotation. override is false by default.
  • public static APIHandler.RegisterResult registerRoute(APIRoute route, boolean override): Registers an annotated route, allowing you to explicitly override existing routes at the same path.
  • public static APIHandler.RegisterResult registerRoute(String path, APIRoute route): Registers a route with a specified path. requireMinecraftServer is false and override is false by default.
  • public static APIHandler.RegisterResult registerRoute(String path, APIRoute route, boolean override): Registers a route with a specified path, allowing you to override existing routes.
  • public static APIHandler.RegisterResult registerRoute(String path, APIRoute route, boolean requireMinecraftServer, boolean override): Provides full control over path, APIRoute instance, requireMinecraftServer status, and override behavior.

3. Dynamic Route Patterns

You can define dynamic segments in your route paths using :SOMETHING_HERE. This is perfect for routes like /player/:criteria where criteria is a placeholder for a player name or UUID.

To access these dynamic parameters within your handle method:

import xyz.yoinky3000.server_info_api.api.APIRequest;
import xyz.yoinky3000.server_info_api.api.APIResponse;
import xyz.yoinky3000.server_info_api.api.APIRoute;
import net.minecraft.server.MinecraftServer;

@RouteSettings(path = "/my-data/:item_id")
public class ItemDataRoute implements APIRoute {
    @Override
    public APIResponse handle(APIRequest request, MinecraftServer server) {
        // Retrieve the value of the 'item_id' segment from the URL
        String itemId = request.routeParams().get("item_id"); //

        if (itemId != null) {
            // Logic to fetch data for this item ID
            return new APIResponse(APIResponse.HttpStatus.OK, APIResponse.MimeType.TEXT_PLAIN, "Requested item ID: " + itemId);
        } else {
            return new APIResponse(APIResponse.HttpStatus.BAD_REQUEST, APIResponse.MimeType.TEXT_PLAIN, "Item ID not provided.");
        }
    }
}

🤝 Contribution & Support

Feel free to open issues for bug reports or feature requests on the GitHub repository. Contributions are always welcome!

Project description from CurseForge.

Pick your setup

Server Info API by Minecraft version and loader

Choose the version and loader you play, then open the matching release.

5 available setups

Check the dependencies, then try the file in a copied instance before changing a world you care about.

Recent files

Server Info API versions and loaders

1 of 1 releases match

Looking for an older file? The official CurseForge project page is in Resources.