Skip to main content
Glama

cmo-lua

A small framework and MCP server for writing Command: Modern Operations scenarios in Lua.

Command stays the simulator. This project is the part an AI can edit: a folder of Lua event scripts, a check that the function names exist, and a reader for the .scen files already on your machine. The function list and the pages it fetches come from the community docs at commandlua.github.io.

It does not include Command, the Command database, or any official scenario.

What you can do

  • Search the Command Lua API and open the official page for one function.

  • Read a local .scen file: sides, missions, unit names, and the Lua inside its events.

  • Replace one event's Lua and write a new scenario file beside the original.

  • Keep a scenario as a project (cmo-project.json plus scripts/*.lua) and compile install.lua, which you run once in the Command Lua console.

Related MCP server: wow-vanilla-mcp

Project layout

{
  "format": 1,
  "title": "Strait patrol",
  "events": [
    {
      "name": "Patrol briefing",
      "trigger": { "name": "Scenario loaded", "type": "ScenLoaded" },
      "action": { "name": "Show briefing", "file": "scripts/briefing.lua" }
    }
  ]
}

examples/strait-patrol is a complete one. Trigger types the compiler knows: ScenLoaded, ScenEnded, Time, RegularTime, RandomTime, UnitDestroyed, UnitDamaged, UnitDetected, UnitEntersArea, UnitRemainsInArea, Points.

Use it from an editor

Build it, then add the server to your MCP client:

npm install
npm run build
npm test
{
  "mcpServers": {
    "cmo-lua": {
      "command": "node",
      "args": ["<path-to>/cmo-lua/dist/index.js"]
    }
  }
}

On this machine that path is C:/Velodona/cmo-lua/dist/index.js.

Then ask for something like: look up ScenEdit_AddUnit, extract this scenario into a project, and add an event that posts a message when the scenario loads.

In Command, open the Lua console and run the generated install.lua with the scenario already loaded. The script removes and recreates only the events named in the project.

Scenario files

A current Command scenario is XML. The body is compress version 5: LZ4 chunks inside AES, the same container described by the public CMOScenTool project. cmo_read_scenario unpacks that so an assistant can see the events. cmo_write_action_script writes a separate .cmo-lua.scen and leaves the file you opened alone. Load the new file in Command before you throw away the original.

cmo_list_scenarios only reads the wrapper (title, setting, complexity), which is enough to find a file without unpacking it.

Tools

Tool

What it does

cmo_search_api

Search the function catalog

cmo_get_function

Fetch one official docs page

cmo_list_scenarios

List .scen files in a folder

cmo_read_scenario

Unpack one scenario

cmo_write_action_script

Replace one Lua action and write a new .scen

cmo_extract_project

Turn a scenario into a project folder

cmo_read_project

Read a project and its scripts

cmo_write_script

Write a Lua file into a project

cmo_validate_project

Check files and function names

cmo_compile_loader

Write install.lua

There is also a prompt, cmo_draft_event, that tells the assistant to look functions up before it writes them.

Develop

npm test
npm run build
npm run smoke

The Dong Hoi round-trip test runs only when that scenario is installed with Command. It does not copy the scenario into this repository.

Available Tools

10 tools
cmo_compile_loaderCompile install.luaA
DestructiveIdempotent

Write install.lua for a project. Run that file once in the Command Lua console with the scenario loaded. It removes and recreates the project's events, triggers, and Lua actions. Validate first; compilation is refused when the project has errors.

Inputs: directory (required).

cmo_extract_projectExtract a scenario into a Lua projectA
Destructive

Unpack a .scen file into a cmo-lua project: cmo-project.json plus one scripts/*.lua file per event action. Edit those files, then cmo_compile_loader. Refuses to replace an existing project unless overwrite is true.

Inputs: path (required), directory (required), overwrite.

cmo_get_functionGet Command Lua functionA
Read-onlyIdempotent

Fetch one function's page from the official Command Lua docs (commandlua.github.io). Use cmo_search_api if you are not sure of the exact name.

Inputs: name (required).

cmo_list_scenariosList scenario filesA
Read-onlyIdempotent

List .scen files in a folder using the XML wrapper only (title, setting, complexity). This does not unpack the scenario body. Pass the Command Scenarios directory, or a folder of your own saves.

Inputs: directory (required), limit, offset, response_format.

cmo_read_projectRead a cmo-lua projectA
Read-onlyIdempotent

Read cmo-project.json and the Lua source of each event. Use this after cmo_extract_project or when the user already has a project folder.

Inputs: directory (required).

cmo_read_scenarioRead a scenarioA
Read-onlyIdempotent

Unpack one .scen file and return its sides, missions, unit counts, and events. Lua action scripts are included when include_scripts is true. Use this to see what a scenario already does before editing it. Official and saved scenarios are read locally; nothing is uploaded.

Inputs: path (required), unit_limit, unit_offset, include_scripts, +1 more.

cmo_search_apiSearch Command Lua APIA
Read-onlyIdempotent

Search the Command Lua function catalog taken from https://commandlua.github.io/assets/Functions.html.

Use this before writing a script so the function name is real. Call cmo_get_function for the official page of one result.

Examples:

  • "add a ship" -> query="add unit"

  • "event triggers" -> query="set trigger"

Inputs: query (required), limit, offset, response_format.

cmo_validate_projectValidate a cmo-lua projectA
Read-onlyIdempotent

Check cmo-project.json and its Lua files. Reports missing files, bad probabilities, and Command function names that are not in the official catalog.

Inputs: directory (required).

cmo_write_action_scriptReplace a Lua action inside a scenarioA
DestructiveIdempotent

Replace the ScriptText of one Lua event action and write a new .scen file. The original file is left unchanged unless output_path is that same file.

The action is matched by its description, which cmo_read_scenario lists. Load the new file in Command to try it. This rewrites the compressed scenario body, so open the result in Command before you delete the original.

Inputs: path (required), action (required), script (required), output_path.

cmo_write_scriptWrite a project Lua fileA
DestructiveIdempotent

Write a .lua file inside a cmo-lua project and, if needed, add or update the matching event in cmo-project.json. Paths cannot leave the project directory.

Inputs: file (required), contents (required), directory (required), event_name, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 10 tools

    Disambiguation4/5

    Most tools occupy clearly distinct roles: docs lookup (search_api/get_function) versus scenario inspection (list_scenarios/read_scenario) versus project workflows (extract/read/write/validate/compile). The main risk is cmo_write_action_script vs cmo_write_script, which both "write Lua" but differ in target (raw .scen event vs project file) — descriptions clarify but the names alone are close. cmo_read_scenario and cmo_read_project are also adjacent but resolvable from context.

    Naming Consistency5/5

    Every tool uses the cmo_ prefix followed by a verb_noun snake_case pattern (search_api, get_function, list_scenarios, read_scenario, write_action_script, extract_project, read_project, write_script, validate_project, compile_loader). No camelCase or style mixing; the pattern is predictable throughout.

    Tool Count5/5

    Ten tools is well within the ideal 3-15 range and each maps to a distinct step in the docs-lookup and scenario/project lifecycle. No tool feels redundant or like padding; the counts split naturally between reference lookup and file manipulation.

    Completeness4/5

    The surface covers the full workflow: look up real functions, inspect existing scenarios, extract to a project, edit scripts, validate function names, and compile a loader. Minor gaps exist — no tool to create a brand-new scenario from scratch, no delete/rename of events, and no direct write-back of a compiled .scen (by design, via install.lua). These are workaroundable but leave the lifecycle slightly one-directional.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to interact with DCS World in real-time through chat by executing Lua scripts and providing tools for mission info, unit management, coordinate conversion, and more.
      10
      9
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to search and retrieve documentation for Vanilla World of Warcraft Lua APIs, including function signatures, categories, protected flags, and addon scaffolding.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to read and control Command: Modern Operations scenarios locally via MCP tools, supporting real-time battle assessment, task planning, and scenario editing.
      12
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI assistants to develop Desynced mods by providing direct access to the game's Lua API reference, base-game source, live logs, and installed mods, plus live control via a debugger link for evaluating and reloading Lua in the running game.
      9
      2
      MIT