A Node.js API to check the status of Minecraft servers.
- Get Minecraft server status by address (supports custom ports)
- Support for both Java Edition and Bedrock Edition servers
- API call statistics (total, daily, and yesterday counts)
- Rate limiting to prevent abuse
- Request logging for monitoring
- Environment-based configuration
- Clone this repository
- Install dependencies:
npm install
- Create a .env file with your configuration (see .env.example)
- Start the server:
node index.js
GET /3/:serverAddress
GET /bedrock/3/:serverAddress
serverAddress
: Minecraft server address (Format:host
orhost:port
)- Default port for Java Edition: 25565
- Default port for Bedrock Edition: 19132
GET /3/mc.tbedu.top:25565
GET /3/mc.tbedu.top
GET /bedrock/3/mc.tbedu.top:19132
GET /bedrock/3/mc.tbedu.top
{
"ip": "118.112.60.42",
"port": 25565,
"latency": 45,
"debug": {
"ping": true,
"srv": false,
"animatedmotd": false,
"cachetime": 1721631977,
"apiversion": 3
},
"motd": {
"raw": ["§fMinecraft Server§r"],
"clean": ["Minecraft Server"],
"html": ["<span style=\"color: #FFFFFF\">Minecraft Server</span>"]
},
"players": {
"online": 12,
"max": 100
},
"version": "1.21.8",
"online": true,
"hostname": "mc.tbedu.top",
"icon": "data:image/png;base64,...",
"software": "Paper"
}
{
"ip": "118.112.60.42",
"port": 19132,
"debug": {
"ping": true,
"animatedmotd": false,
"cachetime": 1721631977,
"apiversion": 3
},
"motd": {
"raw": ["Minecraft Bedrock Server"],
"clean": ["Minecraft Bedrock Server"],
"html": ["<span style=\"color: #FFFFFF\">Minecraft Bedrock Server</span>"]
},
"players": {
"online": 8,
"max": 50
},
"version": "1.21.0",
"online": true,
"hostname": "mc.tbedu.top"
}
API returns timestamps (cachetime) in Shanghai Time (UTC+8).
Configuration is done through environment variables in the .env file:
PORT
: Server port (default: 3000)RATE_LIMIT_WINDOW_MS
: Rate limit window in milliseconds (default: 60000 = 1 minute)RATE_LIMIT_MAX
: Maximum requests per IP in the window (default: 100)TRUST_PROXY
: Set to 'true' if running behind a reverse proxy
- express: Web framework
- minecraft-server-util: Minecraft server status checker
- express-rate-limit: Rate limiting middleware
- morgan: HTTP request logging
- dotenv: Environment variable management
- cors: Cross-origin resource sharing
- moment-timezone: Time zone handling
- rotating-file-stream: Log file rotation
- fs: File system operations
- path: Path handling utilities
- chalk: Terminal string styling
This project is released under the MIT License. You are free to use, modify, and distribute the code of this project. However, please retain the copyright information of the original author.
- FeltSquirrel727 (Original Author)