JavaScript SDK Overview
The MCMP JavaScript SDK provides a modern, TypeScript-first toolkit for integrating Minecraft server management capabilities into your web applications, Node.js services, and browser-based tools.Key Features
Server Management
Start, stop, and configure Minecraft servers programmatically
Real-time Events
Subscribe to real-time server events and player activities
WebSocket Support
Real-time communication with servers via WebSocket
Plugin Integration
Integrate with Bukkit/Spigot/Paper plugins seamlessly
Quick Start
Installation
Install the MCMP JavaScript SDK using npm:Basic Usage
TypeScript Support
The SDK is built with TypeScript and provides full type safety:Browser Support
The SDK works in both Node.js and browser environments:Node.js
Node.js
Full support for server-side applications with all features available
Browser
Browser
Client-side applications with CORS support and browser-compatible features
React/Vue/Angular
React/Vue/Angular
Framework-agnostic with hooks and utilities for popular frameworks
Web Workers
Web Workers
Support for background processing and non-blocking operations
Modern JavaScript Features
The SDK leverages modern JavaScript features for optimal performance:- Async/Await: Clean asynchronous code with full Promise support
- ES Modules: Native ES module support with tree-shaking
- TypeScript: Full TypeScript support with comprehensive type definitions
- Fetch API: Modern HTTP client with automatic retries and error handling
- WebSocket: Real-time communication with automatic reconnection
Architecture
The JavaScript SDK is built with a modular architecture:- Core Client: Main interface for all MCMP operations
- Service Modules: Specialized services for different functionality
- Type Definitions: Comprehensive TypeScript types for all API responses
- Event System: Real-time event handling with WebSocket support
- Configuration: Flexible configuration with environment variable support
Supported Platforms
Node.js
Full server-side support with all features
Browser
Client-side support with CORS and security features
React
React hooks and components for easy integration
Vue.js
Vue.js composables and utilities
Package Managers
npm
npm
yarn
yarn
pnpm
pnpm
Bun
Bun