Skip to content

Connecting an agent

The engine speaks the Model Context Protocol (MCP), so an AI agent such as Claude Code can work on a project with the same tools the editor uses: import and cook assets, write scenes, write and check scripts, play the game and look at it, and export it.

There are two ways in:

  • The editor serves the project it has open. The agent works on what you are looking at: you watch its changes arrive, can undo them, and can play what it built. This is the usual way.
  • Tools.Mcp serves a project with no editor running, for an agent working on its own: building content in bulk, or in a script.

Both serve the same engine tools. The editor adds the ones that need it: its pages, the scene page’s selection and camera, its menu commands, and playing the game.

  1. Open the project, then Edit > Preferences…, the Agent access tab.

  2. Turn on Serve the open project to agents (MCP) and Save. The editor makes a token, the secret an agent must present, and writes it to mcp-token in its user data folder (~/.local/share/gameengine/mcp-token on Linux).

  3. Connect the agent to http://127.0.0.1:7405/mcp (the MCP port on the same tab), with the token as a bearer token. For Claude Code:

    Terminal window
    claude mcp add --transport http engine-editor http://127.0.0.1:7405/mcp \
    --header "Authorization: Bearer $(cat ~/.local/share/gameengine/mcp-token)"

The server listens on your own computer only (127.0.0.1), and only while a project is open. To serve one run without changing the preference, start the editor with --mcp, or --mcp-port <port> for another port:

Terminal window
Tools.Editor path/to/project --mcp

Tools.Mcp is built with the editor. It talks over standard input and output, so the agent starts it itself:

Terminal window
claude mcp add engine -- /path/to/GameEngine/Bin/Debug/Linux64-Clang/Tools.Mcp

The agent then creates or opens a project with its project_create and project_open tools.

Do not point Tools.Mcp at a project an open editor is editing: both would write the same files. Use the editor’s own server for that project instead.

Both servers carry the engine’s guide for agents, docs://McpGuide.md: how the tools fit together, the order to use them in, and their pitfalls. An agent should read it first; asking it to is a good start to a session. The servers also carry the scripting guide and a description of the scene format generated from the engine itself.

After you rebuild the engine, restart the editor or Tools.Mcp: a server started before the rebuild still runs the old engine.

Next: What an agent can do.