Prerequisites
- Node.js 16 or newer (for running and building your plugin).
- Mudstack desktop app (plugins run inside the app).
- Familiarity with JavaScript or TypeScript (the examples use CommonJS for the entry point, which is typical for plugins loaded by Mudstack).
Step 1: Get the template
Start from the mudstack-plugins repo:- Fork the repo on GitHub, or use Use this template if the repo is set up as a template.
- Clone your fork locally.
package.json– name, main entry, and dependency on@mudstack/pluginsmanifest.json– plugin id, name, version, main file, and optional subscriptions/registrationsindex.js– a class extendingMudstackPluginwithactivate()anddeactivate()
Step 2: Rename and describe your plugin
Edit manifest.json and package.json so they identify your plugin (not the generic template). manifest.json – Update at least:id– Unique plugin ID (e.g.com.yourcompany.my-plugin). Use a reverse-DNS style.name– Display name (e.g.My Pipeline Plugin).description– Short description of what the plugin does.author– Your name or team.
name– npm-style package name (e.g.my-mudstack-plugin).description– Same or similar to manifest.author– Same as manifest.
Step 3: Install dependencies
In the plugin folder (repo root when using the template):MudstackPlugin base class and types.
Step 4: Implement your plugin logic
Your entry point (e.g. index.js) must export a single class that extends MudstackPlugin. The runtime will:- Load your module.
- Instantiate the class with the Plugin API:
new YourPlugin(api). - Call
activate()when the plugin is enabled, anddeactivate()when it is disabled or the app shuts down.
Minimal example (JavaScript, CommonJS)
Using the API
Inside your class you have this.api with:- this.api.log(level, message, payload?) – Log to Mudstack (e.g.
'info','warn','error','debug'). - this.api.events.on(eventType, handler) – Subscribe to events (e.g.
file.created,plugin.activated). Returns an unsubscribe function; you only need to call it for subscriptions you add in code (not for manifest-declared subscriptions). - this.api.events – Use off() if you need to remove a handler by reference.
- this.api.sendEvent(eventType, payload) – Emit an event to the app and other plugins.
- this.api.db – Access to account, workspace, library, tag, asset, and asset version APIs (read/update data).
- this.api.config – getConfig(), setConfig(), getSchema(), validateConfig(), getDefaultConfig() for plugin settings.
- this.api.hasDependency(pluginId, version?) – Check if another plugin (or dependency) is available.
- this.api.requestFromPlugin(targetPluginId, methodName, payload?) – Call another plugin; that plugin responds with api.respond(requestId, result) or api.respondWithError(requestId, error).
- this.api.executeNodeScript(), executeCommand(), executePythonScript(), etc. – Run scripts or binaries (with timeout, cwd, env).
Adding a context menu command
To add a right-click menu item that runs your code:- In manifest.json, add a contextMenuCommands array (if not present) and an entry, e.g.:
- In manifest.json, add a subscriptions entry so the runtime calls a method on your class when the event is emitted:
- In your class, implement the handler. The message includes a request id and payload (e.g. selected asset ids):
Step 5: Declare dependencies (optional)
If your plugin depends on another plugin (e.g. a thumbnailer that requires a specific runtime), add it to manifest.json:- id – Plugin ID (or dependency id).
- version – Optional semver range (e.g.
^1.0.0). - optional – If
true, the plugin can run when the dependency is missing (e.g. with reduced features).
Step 6: Config schema (optional)
To expose settings (e.g. API keys, paths), define a config.schema in manifest.json. The runtime will validate and merge with defaults, and your plugin can read/write via this.api.config:Step 7: Install the plugin in Mudstack
- Copy the plugin folder (the whole directory containing
manifest.json,package.json, andindex.js) into Mudstack’s plugins directory:- Windows:
Documents\Mudstack\plugins\ - macOS:
~/Documents/Mudstack/plugins/ - Or the path configured in the app for user plugins.
- Windows:
- Ensure node_modules is present (run
yarn installornpm installinside the plugin folder). - Restart Mudstack (or use the app’s refresh/plugin discovery if available). Your plugin should appear in the list and activate if enabled.
Step 8: Debug and iterate
- Use this.api.log(‘info’, …) or this.api.log(‘debug’, …) to inspect behavior. Logs are written to the Mudstack plugin log location for your plugin.
- Check the app’s plugin management UI for enable/disable and any error state.
- For examples of subscriptions and context menu commands, see the mudstack-plugins examples (e.g. hello-world, context-menu-example).
Summary checklist
- Clone or fork mudstack-plugins (use root as plugin).
- Rename id, name, description, author in
manifest.jsonandpackage.json. - Run yarn install or npm install in the plugin folder.
- Implement a class extending MudstackPlugin with activate() and deactivate() in
index.js(or the file set in main). - Add contextMenuCommands and subscriptions in the manifest if you need context menu actions.
- Add dependencies and config.schema in the manifest if needed.
- Copy the plugin folder into Mudstack’s plugins directory and restart or refresh.