Installation
This guide will help you install and configure the MCMP JavaScript SDK in your JavaScript or TypeScript project.Requirements
Node.js Version
Node.js 16.0 or higher is required for the MCMP JavaScript SDK
Package Manager
npm, yarn, pnpm, or bun recommended
npm Installation
Install the MCMP JavaScript SDK using npm:TypeScript Support
For TypeScript projects, the SDK includes built-in type definitions:yarn Installation
Install using yarn:pnpm Installation
Install using pnpm:Bun Installation
Install using Bun:CDN Installation
For browser usage without a build system, use the CDN:ES Modules
The SDK supports ES modules for modern JavaScript:CommonJS
For CommonJS environments:TypeScript Configuration
For TypeScript projects, ensure yourtsconfig.json includes:
Framework Integration
React
For React applications, install the React-specific package:Vue.js
For Vue.js applications:Angular
For Angular applications:Environment Configuration
Environment Variables
Create a.env file for your API key:
Configuration Files
Create a configuration file:Verification
Test your installation with a simple example:Dependencies
The MCMP JavaScript SDK includes the following dependencies:HTTP Client
HTTP Client
- Built-in fetch API with automatic retries
- Request/response interceptors
- Automatic JSON parsing
WebSocket
WebSocket
- Native WebSocket support
- Automatic reconnection
- Event handling
TypeScript
TypeScript
- Full TypeScript support
- Comprehensive type definitions
- IntelliSense support
Troubleshooting
Module Not Found
Module Not Found
Ensure the package is installed correctly and your Node.js version is 16.0 or higher.
TypeScript Errors
TypeScript Errors
Make sure you have TypeScript installed and your tsconfig.json is configured properly.
Import Errors
Import Errors
Check that you’re using the correct import syntax for your module system (ES modules vs CommonJS).
Network Issues
Network Issues
Verify your network connection and that the MCMP API is accessible from your environment.