Skip to main content

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

Quick Start

Installation

Install the MCMP JavaScript SDK using npm:
npm install @mcmp/sdk
Or with yarn:
yarn add @mcmp/sdk

Basic Usage

import { McmpClient } from '@mcmp/sdk';

// Initialize the client
const client = new McmpClient({
  apiKey: 'your-api-key-here'
});

// Create a new server
const server = await client.servers.create({
  name: 'My Minecraft Server',
  type: 'PAPER',
  version: '1.21.1'
});

console.log('Created server:', server.id);

// Start the server
await client.servers.start(server.id);
console.log('Server started!');

TypeScript Support

The SDK is built with TypeScript and provides full type safety:
import { McmpClient, Server, ServerType, ServerVersion } from '@mcmp/sdk';

const client = new McmpClient({
  apiKey: process.env.MCMP_API_KEY!
});

const server: Server = await client.servers.create({
  name: 'TypeScript Server',
  type: ServerType.PAPER,
  version: ServerVersion.V1_21_1
});

Browser Support

The SDK works in both Node.js and browser environments:
Full support for server-side applications with all features available
Client-side applications with CORS support and browser-compatible features
Framework-agnostic with hooks and utilities for popular frameworks
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 install @mcmp/sdk
yarn add @mcmp/sdk
pnpm add @mcmp/sdk
bun add @mcmp/sdk

Next Steps

1

Installation

Set up the JavaScript SDK in your project
2

Authentication

Configure API keys and authentication
3

Server Management

Learn to manage servers programmatically
4

Real-time Features

Explore real-time events and WebSocket features