{"id":26555153,"url":"https://github.com/mashkovtsevlx/mc-server-util","last_synced_at":"2026-02-18T00:01:44.840Z","repository":{"id":283464695,"uuid":"951856845","full_name":"mashkovtsevlx/mc-server-util","owner":"mashkovtsevlx","description":"A modern Node.js library for interacting with Minecraft Java Edition servers. Query server status and execute RCON commands with ease.","archived":false,"fork":false,"pushed_at":"2025-03-24T13:59:19.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-17T10:49:13.846Z","etag":null,"topics":["minecraft","minecraft-api","minecraft-server","nodejs","rcon","server-utility"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mashkovtsevlx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-20T10:56:45.000Z","updated_at":"2025-03-24T13:59:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"cc17edcd-682d-4bd2-9f67-4f6412715ce2","html_url":"https://github.com/mashkovtsevlx/mc-server-util","commit_stats":null,"previous_names":["mashkovtsevlx/mc-server-util"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mashkovtsevlx/mc-server-util","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashkovtsevlx%2Fmc-server-util","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashkovtsevlx%2Fmc-server-util/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashkovtsevlx%2Fmc-server-util/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashkovtsevlx%2Fmc-server-util/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mashkovtsevlx","download_url":"https://codeload.github.com/mashkovtsevlx/mc-server-util/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mashkovtsevlx%2Fmc-server-util/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29563273,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T21:50:49.831Z","status":"ssl_error","status_checked_at":"2026-02-17T21:46:15.313Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["minecraft","minecraft-api","minecraft-server","nodejs","rcon","server-utility"],"created_at":"2025-03-22T10:25:06.814Z","updated_at":"2026-02-18T00:01:44.832Z","avatar_url":"https://github.com/mashkovtsevlx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minecraft Server Utilities 🛠️\n[![npm monthly downloads](https://img.shields.io/npm/dm/mc-server-util?color=blue)](https://www.npmjs.com/package/mc-server-util)\n\nA modern Node.js library for interacting with Minecraft Java Edition servers. Query server status and execute RCON commands with ease.\n\n## Features ✨\n\n- ✅ Server status checking (MOTD, players, version)\n- 🔑 Secure RCON command execution\n- 📢 Built-in `say` command helper\n- ⏱️ Configurable timeouts (10s default)\n- 🔍 Debug logging capabilities\n- 🛡️ Comprehensive error handling\n\n## Installation 📦\n\n```bash\nnpm install mc-server-util\n```\n\n## Usage Examples 🚀\n\n### Basic Server Status Check\n```javascript\nimport { getMinecraftServerStatus } from 'mc-server-util';\n\ntry {\n  const status = await getMinecraftServerStatus('mc.example.com');\n  console.log(`Server version: ${status.version.name}`);\n  console.log(`Players online: ${status.players.online}`);\n} catch (error) {\n  console.error('Server offline:', error.message);\n}\n```\n\n### Execute RCON Command\n```javascript\nimport { sendRconCommand } from 'mc-server-util';\n\nconst response = await sendRconCommand(\n  'mc.example.com',\n  25575,\n  'secure-password',\n  'whitelist add PlayerName'\n);\nconsole.log('Command response:', response);\n```\n\n### Broadcast Server Message\n```javascript\nimport { sendRconSayCommand } from 'mc-server-util';\n\nawait sendRconSayCommand(\n  'mc.example.com',\n  'secure-password',\n  'Server maintenance in 5 minutes!'\n);\n```\n\n## API Documentation 📖\n\n### `getMinecraftServerStatus(host, [port = 25565], [debug = false])`\n**Returns:** `Promise\u003cServerStatus\u003e`\n\n**ServerStatus Object:**\n```typescript\n{\n  online: boolean,\n  version: {\n    name: string,\n    protocol: number\n  },\n  players: {\n    max: number,\n    online: number,\n    sample?: Player[],\n    nicknames?: string\n  },\n  description: string,\n  favicon?: string\n}\n```\n\n### `sendRconCommand(host, [port = 25575], password, command, [debug = false])`\n**Returns:** `Promise\u003cstring\u003e`\n\n### `sendRconSayCommand(host, password, message, [debug = false])`\n**Returns:** `Promise\u003cstring\u003e`\n\n## Advanced Configuration ⚙️\n\n### Debug Mode\n```javascript\n// Enable debug logging\nawait getMinecraftServerStatus('mc.example.com', 25565, true);\n\n// Example debug output:\n// Connected to server, sending handshake\n// Handshake packet: 0f0000...\n// Received data chunk: 0f0000...\n```\n\n### Custom Timeout\n```javascript\n// Create custom timeout (in milliseconds)\nconst status = await getMinecraftServerStatus('mc.example.com', 25565, {\n  debug: false,\n  timeout: 15000\n});\n```\n\n## Error Handling ⚠️\nCommon error scenarios:\n- `Connection timeout` - Server not responding\n- `RCON authentication failed` - Incorrect password\n- `Invalid RCON packet` - Protocol mismatch\n\n**Example error handling:**\n```javascript\ntry {\n  await sendRconCommand('mc.example.com', 25575, 'wrong-password', 'help');\n} catch (error) {\n  if (error.message.includes('authentication failed')) {\n    console.error('Invalid RCON credentials');\n  } else {\n    console.error('Connection error:', error.message);\n  }\n}\n```\n\n## Security Best Practices 🔒\n1. **Never hardcode credentials**  \n   Use environment variables:\n   ```javascript\n   import dotenv from 'dotenv';\n   dotenv.config();\n   \n   sendRconCommand(\n     process.env.MC_HOST,\n     process.env.MC_RCON_PORT,\n     process.env.MC_RCON_PASSWORD,\n     'save-all'\n   );\n   ```\n\n2. **Validate user input**  \n   Sanitize command inputs:\n   ```javascript\n   const sanitizeInput = (input) =\u003e input.replace(/[^\\w\\s-]/g, '');\n   const safeCommand = sanitizeInput(userInput);\n   ```\n\n## Contributing 🤝\nWe welcome contributions! Please follow these steps:\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/your-feature`)\n3. Commit changes with descriptive messages\n4. Push to your branch (`git push origin feature/your-feature`)\n5. Open a Pull Request\n\n## License 📄\nMIT © Alex Mashkovtsev\n\n---\n\n**Protocol Reference**  \nFor low-level protocol details, see the [Minecraft Protocol Specification](https://wiki.vg/Protocol).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmashkovtsevlx%2Fmc-server-util","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmashkovtsevlx%2Fmc-server-util","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmashkovtsevlx%2Fmc-server-util/lists"}