1. Start with server status
The easiest integration is a status check. Your bot sends a request to a Minecraft status API, then displays whether the server is online, how many players are connected, and what version is running.
This works well if you just want a /status command or a channel message that updates automatically.
Why this is the best first step
- No plugin is required on the Minecraft server.
- It is quick to build and easy to maintain.
- It gives users useful information without opening the game.
Example API flow
Your bot makes a request to a service such as mcstatus.io or api.mcsrvstat.us, then reads the JSON response.
require('dotenv').config();
const fetch = require('node-fetch');
async function getServerStatus(ip) {
const response = await fetch(`https://api.mcstatus.io/v2/status/java/${ip}`);
if (!response.ok) throw new Error(`Status API returned ${response.status}`);
const data = await response.json();
return {
online: !!data.online,
players: data.players?.online ?? 0,
motd: data.motd?.clean ?? '',
version: data.version?.name ?? ''
};
}
2. Use a chat bridge if you want live messages
If you want Minecraft chat to appear in Discord, or Discord chat to show up in Minecraft, you need a bridge. For Java servers, the easiest option is usually DiscordSRV.
- It connects Minecraft chat and Discord channels.
- It works well on most hosting setups.
- It is better than building a full custom bridge unless you really need one.
If you prefer custom code, libraries such as minecraft-server-util can help you query the server without installing a plugin.
3. Use RCON for admin commands
RCON lets your bot run server-side console commands such as list, save-all, or restart. This is useful when you want to control the Minecraft server from Discord.
Security should come first
- Store your RCON password in a
.envfile. - Never put secrets directly in your bot source code.
- Restrict admin commands to trusted Discord roles.
- Log sensitive actions so you can review them later.
Example environment variables:
MC_IP=your-server-ip
RCON_PORT=25575
RCON_PASSWORD=your-strong-password
Example Node.js RCON code:
require('dotenv').config();
const { Rcon } = require('rcon-client');
async function runRconCommand(cmd) {
const conn = await Rcon.connect({
host: process.env.MC_IP,
port: Number(process.env.RCON_PORT || 25575),
password: process.env.RCON_PASSWORD
});
try {
return await conn.send(cmd);
} finally {
await conn.end();
}
}
runRconCommand('list').then(console.log).catch(console.error);
What to build first
If you are deciding where to start, build the status command first. It is the easiest feature to ship and gives your users an immediate win. After that, add either a chat bridge or RCON commands depending on what your community actually needs.