Server Status API
How live server status works and how to configure it.
How It Works
The template uses mcsrvstat.us, a free Minecraft server status API. No API key required. No account needed.
API Endpoint:
https://api.mcsrvstat.us/2/play.yourserver.comWhat It Provides
| Data | Description |
|---|---|
| Online Status | Whether the server is reachable |
| Player Count | Current and max players |
| Version | Minecraft version running |
| MOTD | Server message of the day |
| Favicon | Server icon (if set) |
Configuration
src/config/site.config.ts
serverStatus: {
// Enable/disable status polling
enabled: true,
// How often to check (milliseconds)
pollingInterval: 30000, // 30 seconds
// Display options
showPlayerCount: true,
showVersion: true,
// Message when server is offline
offlineText: 'Server Maintenance',
}Polling Behavior
The status hook polls the API at regular intervals:
- ▸First check happens immediately on page load
- ▸Subsequent checks happen every pollingInterval
- ▸Failed requests retry with exponential backoff
- ▸Status cached in React state between polls
// In src/hooks/useServerStatus.ts
const fetchStatus = async () => {
const response = await fetch(
`https://api.mcsrvstat.us/2/${serverIp}`
);
const data = await response.json();
return {
online: data.online,
players: data.players?.online || 0,
maxPlayers: data.players?.max || 0,
version: data.version,
};
};Rate Limits
△API Fair Use
mcsrvstat.us is a free service. Don't poll more than once every 15 seconds. The default 30-second interval is respectful and recommended.
| Interval | Requests/Hour | Status |
|---|---|---|
| 15 seconds | 240 | Acceptable |
| 30 seconds | 120 | Recommended |
| 60 seconds | 60 | Conservative |
| 5 minutes | 12 | Minimal |
Troubleshooting
Status shows offline but server is up
- ▸Check if your server IP is correct in config
- ▸Ensure your server allows status queries (query-port open)
- ▸Some hosts block status queries - check with your provider
- ▸Try the API directly in browser: api.mcsrvstat.us/2/your.ip
Player count not showing
- ▸Make sure showPlayerCount is true in config
- ▸Some server plugins hide player count
- ▸Bungeecord/Velocity may need additional setup
Disable status completely
// Option 1: Disable in config
serverStatus: {
enabled: false,
// ...
}
// Option 2: Hide the section entirely
sections: {
serverStatus: false,
// ...
}Alternative APIs
If you need to use a different API, modify src/hooks/useServerStatus.ts. Other popular options:
| API | URL | Notes |
|---|---|---|
| mcsrvstat.us | api.mcsrvstat.us | Default, no key needed |
| mcstatus.io | api.mcstatus.io | Alternative, no key |
| Custom | your-api.com | Build your own |