Skip to main content
Glama
construct2-mcp

construct2-mcp

by wjrosa

construct2-mcp

An MCP server that gives an AI agent (Claude Code, Claude Desktop, or any MCP client) full control of the Construct 2 game editor: create projects, build layouts, add objects and behaviors, write event sheets, open and reload them in the editor, and export finished builds.

Construct 2 has no scripting API, so the server works in two layers:

Layer

How

What it covers

Project

Reads and writes the .caproj folder project directly, in the editor's own byte-exact XML format

Layouts, layers, instances, object types, animations, instance variables, behaviors, families, event sheets (events, sub-events, groups, variables, comments, includes, OR blocks, Else), sounds, files, project settings

Editor

Drives the running editor through Windows UI Automation patterns

Open, reload, save, preview, the full Export wizard (HTML5, NW.js, Cordova...), dialogs, screenshots, and any ribbon button, tab, tree item or checkbox

Every condition and action is checked against the installed plugins and behaviors: the server runs each addon's edittime.js in an embedded JavaScript engine, so it knows exactly what your Construct 2 knows, third-party addons included. Parameters are converted to the stored form (combo index, comparison, key code, object name), and an unknown action, wrong parameter or bad option is refused with a message that lists the valid ones.

The editor tools use UI Automation patterns and window messages, so they don't move the mouse or take the keyboard: you can keep using the PC while an agent works. editor_send_keys is the one exception, and it's labeled as such.

Requirements

  • Windows (Construct 2 is Windows-only)

  • Construct 2 r279 or r280 (the final releases, still downloadable from construct.net)

  • Python 3.11+ and uv

Related MCP server: PlayCanvas Editor MCP Server

Install

Claude Code

claude mcp add construct2 -- uvx --from git+https://github.com/wjrosa/construct2-mcp construct2-mcp

Claude Desktop / other clients (claude_desktop_config.json):

{
  "mcpServers": {
    "construct2": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/wjrosa/construct2-mcp", "construct2-mcp"]
    }
  }
}

Optional environment variables:

Variable

Meaning

C2_INSTALL_DIR

Construct 2 folder, if it isn't found automatically

C2_ADDON_DIRS

Extra folders with plugins/ and behaviors/ subfolders

C2MCP_EDITOR_SYNC

reload (default) or skip: what to do when an edited project is open in the editor

C2MCP_BACKUP_DIR

Where backups go (default %LOCALAPPDATA%\construct2-mcp\backups)

What an agent can do

project_create      folder="D:/games/Dodge" name="Dodge"
object_create       name="Player" plugin="Sprite" image="player.png"
object_add_behavior object="Player" behavior="8 Direction"
instance_add        layout="Layout 1" object="Player" x=427 y=400
events_add          sheet="Event sheet 1" items=[
  {"conditions": [{"object": "System", "ace": "Every X seconds", "params": [0.5]}],
   "actions":    [{"object": "System", "ace": "Create object",
                   "params": {"Object to create": "Rock", "Layer": 0, "X": "random(854)", "Y": -20}}]},
  {"conditions": [{"object": "Player", "ace": "On collision with another object", "params": ["Rock"]}],
   "actions":    [{"object": "System", "ace": "Restart layout"}]}]
editor_open         project="D:/games/Dodge"
editor_export       folder="D:/games/Dodge-html5" platform="HTML5 website"

event_sheet_read shows a sheet the way the editor does, with an id on every line:

[8594137504185396] EVENT
  ? [6401295413349054] Keyboard: On space pressed
  > [3758869385639090] System: Add to (Score, 1)
  [8736377089486879] EVENT
    ? [6851630112316939] Hero: Compare instance variable (hp, ≤, 0)
    > [7911252092929822] Hero: Destroy

Tools (55)

  • Project: project_info, project_create, project_templates, project_set_settings, capx_to_folder, folder_to_capx, backups_list, backup_restore

  • Catalog: addons_list, addon_info, object_aces, catalog_learn, catalog_reload

  • Objects: objects_list, object_create, object_add_frames, object_add_instance_variable, object_add_behavior, family_create, object_references, object_delete

  • Layouts: layout_get, layout_create, layout_set, layer_add, layer_update, layer_delete, instances_list, instance_add, instance_update, instance_delete

  • Events: event_sheet_read, event_get, event_sheet_create, events_add, event_replace, ace_add, events_delete, event_move, event_set_flags

  • Files: file_import

  • Editor: editor_status, editor_open, editor_reload, editor_close, editor_save, editor_preview, editor_export, editor_screenshot, editor_dialogs, editor_dialog_click, editor_dialog_set_text, editor_ui_tree, editor_ui_act, editor_send_keys

Safety

  • Your work in the editor comes first. If the project is open in Construct 2 with unsaved changes, every project edit is refused, because saving in the editor would overwrite it. If the project is open and saved, the editor is reloaded after the edit.

  • Backups. Before the first change to any file in a session, the original is copied to the backup folder. backup_restore puts it back.

  • Byte-exact files. Unchanged files are never rewritten, and changed ones keep the editor's formatting, so diffs in git stay small. Tested by round-tripping 822 project files from shipped games.

How it was tested

  • 822 XML files from 9 released Construct 2 games re-serialize byte-identical.

  • 20,355 conditions and actions in those games resolve against the catalog. The only unresolved ones come from third-party addons that weren't installed.

  • A project built entirely through the tools opens in Construct 2 r279 without warnings, exports to HTML5 through the automated wizard, and runs in a browser with its events working.

Limitations

  • Built-in ACE ids. System conditions and actions, and the "common" ones every object gets (Set position, Destroy...), live in the editor's C++ code. Their ids were harvested from Scirra's bundled examples and real projects (107 so far, which covers the commonly used ones). If you need one that isn't known yet, add it once in the editor, save, and run catalog_learn on that project.

  • Object renaming isn't supported yet (it has to rewrite every expression that names the object).

  • editor_preview opens the project's preview browser, as Construct 2 always does.

  • Construct 2 can't open sheets or layouts as tabs without a click, so read events with event_sheet_read rather than from screenshots.

  • The Free edition's limits (events, layers) still apply in the editor.

Development

uv sync
uv run python tools/roundtrip_check.py <folder with projects>   # byte-exact XML check
uv run python tools/resolve_check.py <folder with projects>     # every ACE resolves
uv run python tests/mcp_e2e.py <work dir> [--editor]            # full MCP run, optionally with the editor
uv run python tools/build_catalog.py --public <examples> --private <your projects>

tools/build_catalog.py only stores example parameter values from --public projects, so building the catalog from private games never puts their code in the repository.

License

MIT. Not affiliated with or endorsed by Scirra Ltd. "Construct" is a trademark of Scirra Ltd.

Available Tools

55 tools
ace_addC

Add one condition (kind="condition") or action (kind="action") to an existing event.

Inputs: ace (required), kind (required), sheet (required), project (required), +3 more.

addon_infoB

Full definition of a plugin or behavior: settings, properties (with options and defaults), conditions, actions and expressions. Accepts the addon id or its display name.

Inputs: addon (required), kind, filter.

addons_listA

Installed plugins (kind="plugin") or behaviors (kind="behavior"): id, name, category, ACE counts.

Inputs: kind. Returns: result

backup_restoreB

Copy the files saved in a backup session (default: the newest) back over the project.

Inputs: project (required), session.

backups_listC

Backups this server made before changing the project's files (one folder per server session).

Inputs: project (required). Returns: result

capx_to_folderB

Unpack a single-file .capx into a folder project (default: next to it, same name) so it can be edited.

Inputs: capx (required), folder.

catalog_learnA

Teach the catalog System/common ACEs it does not know yet by harvesting them from a project or a folder of projects (.caproj folders and .capx files). Saved per user and used from then on.

Inputs: path (required).

catalog_reloadA

Re-read installed plugins/behaviors (after installing a .c2addon).

Inputs: no named parameters.

editor_closeB

Close a Construct 2 window. Unsaved changes block this unless discard=true.

Inputs: pid, discard, project.

editor_dialog_clickC

Press a button (OK, Cancel, Yes, No, Next, ...) in an open Construct 2 dialog.

Inputs: button (required), pid, project, dialog_title.

editor_dialogsC

Open dialogs and message boxes in Construct 2 with their text and buttons.

Inputs: pid, project. Returns: result

editor_dialog_set_textC

Type into a text field of an open dialog (by order, 0 = first).

Inputs: value (required), pid, project, field_index, +1 more.

editor_exportB

Export through File > Export project. platform: HTML5 website, NW.js, Cordova, ... (first wizard page). minify needs Java. options answers later pages by control caption, e.g. {"Embed style": true}. The result lists every page's controls, so an unexpected page can be answered by calling again with options.

Inputs: folder (required), pid, minify, options, +2 more.

editor_openB

Open a project in Construct 2 (starts the editor; reuses a window that already has it open).

Inputs: project (required).

editor_previewB

Run the current layout in the browser (Run layout / Debug layout). Construct 2 serves the preview at http://localhost:50000 and opens it in the project's preview browser.

Inputs: pid, debug, project.

editor_reloadA

Close and reopen the project in Construct 2 so it shows changes made to the files. Refused when the editor has unsaved changes.

Inputs: project (required).

editor_saveC

Press Save in Construct 2.

Inputs: pid, project.

editor_screenshotC

Picture of the Construct 2 window (captured even when other windows cover it).

Inputs: pid, project.

editor_send_keysA

LAST RESORT: brings Construct 2 to the front and types with the real keyboard (pywinauto syntax: ^s = Ctrl+S, {ENTER}, {F5}). Interrupts whoever is using the PC; prefer editor_ui_act.

Inputs: keys (required), pid, project.

editor_statusB

Running Construct 2 windows: pid, project, unsaved changes (dirty), open tabs, status bar, dialogs.

Inputs: no named parameters. Returns: result

editor_ui_actB

Act on any editor control by name through UI Automation: invoke (buttons, ribbon), select (tabs, list and tree items), expand/collapse, toggle (checkboxes), set_value/get_value, default (a tree item's double-click action). No mouse or keyboard is used.

Inputs: name (required), pid, index, value, +4 more.

editor_ui_treeA

The editor's UI Automation tree (control type, name, automation id), from the main window or a named control/dialog. Use it to find controls for editor_ui_act.

Inputs: pid, root, depth, project. Returns: result

event_getC

One event, group, variable, condition or action as a JSON spec.

Inputs: sid (required), sheet (required), project (required).

event_moveA

Move an event/group/variable: into parent_sid (as sub-event), next to after_sid/before_sid, or to a top-level index.

Inputs: sid (required), sheet (required), project (required), index, +4 more.

event_replaceB

Replace an event/group/variable (or a single condition/action) with a new spec, keeping its position. Tip: event_get, change the JSON, event_replace.

Inputs: sid (required), item (required), sheet (required), project (required), +1 more.

events_addA

Insert events, groups, variables, comments or includes. Without a position they go to the end of the sheet; parent_sid puts them as sub-events of an event/group; after_sid/before_sid places them next to an item. Item shapes: {"conditions": [...], "actions": [...], "sub_events": [...], "or": false, "disabled": false} {"type": "group", "title": "...", "description": "", "active": true, "events": [...]} {"type": "variable", "name": "Score", "var_type": "number|text|boolean", "value": 0, "constant": false, "static": false} {"type": "comment", "text": "..."} {"type": "include", "sheet": "Common"} A condition/action: {"object": "Player", "behavior": "Platform"?, "ace": "Is on floor", "params": [...] or {"Name": value}, "inverted": false}. Returns the sheet as text with the new sids.

Inputs: items (required), sheet (required), project (required), index, +4 more.

events_deleteB

Delete events, groups, variables, conditions or actions by sid (an event goes with its sub-events).

Inputs: sids (required), sheet (required), project (required), editor_sync.

event_set_flagsC

Toggle flags: disabled (event, group or action), inverted (condition), or_block (event), group_active.

Inputs: sid (required), sheet (required), project (required), disabled, +4 more.

event_sheet_createB

Add an empty event sheet (attach it with layout_set or include it with events_add type=include).

Inputs: name (required), project (required), folder, editor_sync.

event_sheet_readA

Read an event sheet. format="text": an indented listing like the editor's, with [sid] on every event, condition (?) and action (>); format="json": the same as editable specs (what events_add takes).

Inputs: sheet (required), project (required), format.

family_createC

Create a family of object types that share a plugin.

Inputs: name (required), members (required), project (required), editor_sync.

file_importC

Import a sound (kind="sound"), music track ("music") or project file ("file"). For audio, import both the .ogg and the .m4a so every browser can play it.

Inputs: path (required), project (required), kind, folder, +1 more.

folder_to_capxB

Pack a folder project into a single .capx file (UI state files are left out).

Inputs: capx (required), project (required).

instance_addC

Place an instance. properties: plugin properties ({"text": "Hi", "initial-visibility": "Invisible"}); variables: instance variable values; behaviors: {"Platform": {"max-speed": 400}}. Returns it with its uid.

Inputs: layout (required), object (required), project (required), x, +10 more.

instance_deleteC

Delete instances by uid.

Inputs: uids (required), project (required), editor_sync.

instances_listC

Instances in a layout: uid, object, layer, position, size, angle, opacity, properties, instance variable values and behavior properties.

Inputs: layout (required), project (required), layer, object. Returns: result

instance_updateC

Move, resize, rotate, re-layer or change properties/variables/behavior properties of an instance by uid.

Inputs: uid (required), project (required), x, y, +9 more.

layer_addC

Add a layer (index 0 = bottom). background_color is "r,g,b".

Inputs: name (required), layout (required), project (required), index, +6 more.

layer_deleteB

Delete a layer and its instances.

Inputs: layer (required), layout (required), project (required), editor_sync.

layer_updateC

Rename, show/hide, recolor, set parallax/opacity or reorder a layer (layer: name or index).

Inputs: layer (required), layout (required), project (required), name, +7 more.

layout_createC

Add a layout. event_sheet: "new" makes " sheet", a name links an existing sheet, null for none. copy_from duplicates another layout's layers and instances.

Inputs: name (required), project (required), width, folder, +4 more.

layout_getC

Layout size, event sheet, margins and layers (with instance counts).

Inputs: layout (required), project (required).

layout_setC

Change a layout's size, event sheet, margins or unbounded scrolling.

Inputs: layout (required), project (required), width, height, +4 more.

object_acesB

Everything an object (or family, or "System") can do: its plugin's conditions/actions/expressions, its behaviors' ones, and the common ones (position, size, instance variables...). kind: conditions, actions, expressions or all. filter: substring of the name/category.

Inputs: object (required), project (required), kind, filter.

object_add_behaviorB

Add a behavior (id or name: Platform, 8Direction, Bullet, Solid, Fade, Sine, ...) to an object or family. properties overrides defaults on every instance (see addon_info for names and options).

Inputs: object (required), project (required), behavior (required), name, +2 more.

object_add_framesB

Add frames to a Sprite animation (created if missing); replace=true swaps out the existing frames.

Inputs: images (required), object (required), project (required), loop, +4 more.

object_add_instance_variableC

Add an instance variable (number, text or boolean) to an object or family; every existing instance gets initial.

Inputs: name (required), object (required), project (required), initial, +2 more.

object_createA

Add an object type. plugin: id or name (Sprite, Text, TiledBg, 9patch, Keyboard, Mouse, Audio, Function, Array, ...). Sprites take image (any image file) or frames (several); without one a visible placeholder is made. Like the editor's Insert Object, a world object also gets one instance placed (on layout, default the first; at x/y, default just outside the layout) because Construct 2 can only spawn objects at runtime that have an instance somewhere. Project-wide plugins (Keyboard, Audio...) get their global instance; properties sets its values.

Inputs: name (required), plugin (required), project (required), x, +10 more.

object_deleteB

Delete an object type or family with its instances and images. Refused while events use it unless force=true.

Inputs: object (required), project (required), force, editor_sync.

object_referencesC

Where an object or family is used: events, expressions and layout instances.

Inputs: object (required), project (required).

objects_listC

Object types and families with plugin, instance variables, behaviors and animations.

Inputs: project (required), filter. Returns: result

project_createB

Create a new folder project in folder (must be empty or missing) from a bundled template, and name it.

Inputs: name (required), folder (required), template.

project_infoA

Summary of a Construct 2 folder project: layouts (with their event sheets), event sheets, objects count, families, plugins/behaviors used, settings, sounds and files. project is the .caproj path or its folder.

Inputs: project (required).

project_set_settingsC

Change project properties. Keys: name, description, version, author, email, website, id, first_layout, pixel_rounding, preview_effects, use_loader_layout, window_size ([w, h]), or any Configuration Settings name ("Fullscreen in browser", "Sampling", "Preview browser", ...).

Inputs: project (required), settings (required), editor_sync.

project_templatesA

Templates bundled with Construct 2 that project_create can start from.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 55 tools

    Disambiguation4/5

    Tools are grouped by clear entity prefixes (project, object, layout, layer, instance, event, editor) and each usually targets a distinct resource+action. A few pairs are genuinely close: event_get vs event_sheet_read (text/json), editor_dialog_click vs editor_ui_act (both press buttons/dialogs), and object_create's frames argument vs object_add_frames. These overlaps are mostly resolvable from the descriptions, so misselection risk is moderate but not severe.

    Naming Consistency4/5

    A predictable <entity>_<verb> pattern dominates (object_create, layout_set, layer_delete, instance_update, events_add, editor_save, project_set_settings). Deviations are mostly plural/singular entity mismatches (instance_delete vs instances_list, event_get vs events_add/events_delete) and an odd ordering in ace_add and addons_list, but nothing chaotic. An agent can reliably infer prefixes.

    Tool Count2/5

    55 tools is well past the point where a set stays legible, even for a rich domain. The surface also mixes two largely independent concerns — editing project files on disk and automating the Construct 2 GUI (ui tree, dialogs, keys, screenshots) — so the set feels like two servers bundled together. Many granular event/ACE tools could have been consolidated.

    Completeness4/5

    Coverage is broad: project create/pack/unpack/settings, full object/family/behavior/instance lifecycle, layout/layer creation and updates, plus rich event-sheet editing (add, replace, move, flags, delete) and editor automation. Minor gaps exist — no layout_delete, event_sheet_delete/rename, or family update tools are exposed. Agents can work around these by editing files or deleting/recreating, so no hard dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      A
      maintenance
      Lets AI agents automate the PlayCanvas Editor end to end — creating and editing entities, scripts, assets, templates, animations, scenes, settings and builds, plus version-control checkpoints — and then launch the project to verify it actually runs via screenshots, logs, live state inspection and simulated input.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to drive a browser-based game editor directly, covering projects, entities, scripts, assets, templates, animation, scenes, settings, builds, and viewport and runtime control. Agents can also launch the project and verify it actually runs by capturing screenshots, logs, and live state, then send keyboard, mouse, and touch input.
      -
    • A
      license
      Not graded
      quality
      A
      maintenance
      Lets AI agents automate the PlayCanvas Editor directly, creating and editing projects, entities, scripts, assets, templates, animation, scenes, builds and store content through natural language. It also launches projects at runtime to capture screenshots, logs and live state, so agents can confirm that scenes actually run.
      MIT