SuperAPIAI Directory

dos2-gm-mcp

github.com · AI developer platforms

dos2-gm-mcp is an MCP server for the Divinity: Original Sin 2 Definitive Edition Game Master mode that lets AI assistants prepare and run GM campaigns. It has two layers: first, it directly reads and edits campaign files on disk, including NPC and item templates, story vignettes with custom art, map notes, journals, scene atmospheres, and add-on mods, automatically backing up before every write; second, it communicates with the running game through a bridge mod for the Norbyte Script Extender, allowing it to list characters in a level, spawn NPCs from templates, move, rename, level up, hide or show them, and execute arbitrary Lua on the game server. The project targets the Windows platform and requires uv, Python 3.11+, and the .NET 8 runtime; the live layer additionally requires Script Extender v58 or later. It is an unofficial fan tool and is not affiliated with Larian Studios.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsWindows

About this tool

Purpose

dos2-gm-mcp is an MCP (Model Context Protocol) server that lets AI assistants help prepare and run Divinity: Original Sin 2 Definitive Edition Game Master mode campaigns. It integrates campaign file editing and live game control into a single interface, enabling assistants to complete GM preparation work and on-the-fly operations through natural language requests.

Main capabilities

Campaign file layer

  • Read and edit GM campaigns on disk, including NPC and item templates, story vignettes with custom art, map notes, journals, scene atmospheres, and add-on mods.
  • Automatically back up the original file before every write, and restore any backup via dos2_restore.
  • The GM campaigns officially shipped with the game by Larian can be read, so they can serve as an NPC template library for copying references.

Live game layer

  • Communicate with the running game through a small bridge mod based on the Norbyte Script Extender.
  • List characters in a level, spawn NPCs from templates, move, rename, level up, hide, and show.
  • Execute arbitrary Lua on the game server (dos2_live_lua).

Example requests

  • View the scenes, templates, and story vignettes in a campaign.
  • Create a level 10 NPC template based on the witch archetype from Larian's example campaign, and specify three skills.
  • Add a story vignette with an image and three voting options.
  • Place a note with a combat checklist on the overview map.
  • While the game is running, spawn two fire imps next to a specified character and report the health of all characters.

Usage

Environment requirements

  • Windows system, with the game Divinity: Original Sin 2 Definitive Edition (tested on Steam build 3.6.117.3735).
  • uv and Python 3.11+.
  • .NET 8 runtime or later (required by LSLib's Divine.exe).
  • Required only for the live layer: Script Extender v58 or later (tested on v60).

Installation and connection

  • The last installation command downloads the official LSLib v1.20.4 release to ./lslib and verifies the SHA-256. LSLib is provided by Norbyte under the MIT licProvably distributable; this repository does not redistribute it.
  • Can connect to Claude Code or other MCP clients.
  • Claude Desktop also offers a single-file package dos2-gm-mcp.mcpb; download it from the latest release, open it, then have the assistant call dos2_fetch_lslib once. This package stores LSLib and backups in ~/.dos2-gm-mcp.
  • The game directory and Documents\Larian Studios\Divinity Original Sin 2 Definitive Edition are found automatically (Steam libraries and relocated Documents folders are supported), and can also be overridden via environment variables or config.json in the project root.
  • The campaign parameter accepts a campaign name, folder name, UUID, or any part of these.

Write rules

  • Writing requires the campaign to be closed: the game is closed or sitting at the main menu. If the game process is running, writing requires allow_running=true.
  • Before each write, the old file is copied to backups<campaign folder><time>-<operation>, and dos2_restore can restore it.
  • Placed NPCs and encounters are stored in the scene cache, which is read-only here; they must be placed in-game or via the live layer.
  • dos2_live_lua executes arbitrary Lua in the game and should only be used with a trusted assistant.

Live layer setup

  1. Install Script Extender: place its DXGI.dll in DefEd\bin next to EoCApp.exe.
  2. Have the assistant run dos2_bridge_install for the target campaign (the game must be closed). It builds the bridge mod and adds it to the campaign's add-on mod list.
  3. Load the campaign in GM mode and call dos2_live_status.

The bridge mod is a server-side Lua mod (bridge/) that reads commands from Osiris Data/dos2gm-mcp on each tick, executes them, and writes back the results; it uses no sockets and listens on no network. In multiplayer, every player needs the same .pak and Script Extender, as with any DOS2 mod.

ApplicableScenarios

  • The GM batch-creates or modifies NPC and item templates, story fragments, map notes, and logs during the campaign preparation phase.
  • Quick on-the-fly operations during gameplay, such as spawning NPCs, adjusting character states, and querying health values.
  • Using Larian's official campaigns as a template library to copy and modify NPCs.
  • Providing verified game mechanics notes for those building their own DOS2 GM tools.

Limitations and Caveats

  • Only Windows and Divinity: Original Sin 2 Definitive Edition are supported.
  • Writing requires the campaign to be closed; writing while the game is running requires explicit permission.
  • Already-placed NPCs and encounters are read-only at the file level.
  • dos2_live_lua can execute arbitrary Lua and poses a security risk.
  • Multiplayer requires all players to install the same .pak and Script Extender.
  • This project is an unofficial fan tool, not affiliated with or endorsed by Larian Studios.

Known Game Mechanics Notes (for tool developers)

  • NPC templates are stored in the campaign's Eggs.lsf with type GMExportCharacter; the template's second Attribute node stores the GM's modifications in incremental form.
  • Equipment slots: 0 helmet, 1 chest armor, 2 leg armor, 3 weapon, 4 shield, 5 and 10 rings, 6 belt, 7 boots, 8 gloves, 9 amulet, 12 horns, 15+ backpack.
  • Map notes have Type = 2, UI = map UUID, and NoteUIX/Y are map pixel coordinates; scene notes have Type = 0 and are attached to invisible marker items in the LevelCache.
  • A mod's meta.lsx requires a Definitive Edition PublishVersion (e.g., 909321303); using 1.0.0.0 causes the game to flag it as a Classic Edition mod and reject it.
  • "Play campaign" runs on a copy of the campaign, leaving the prepared campaign unchanged; loading a GM save uses the main menu's mod list, so add-on mods must also be checked there.
  • Any Osi.* call during campaign or level loading causes a native Script Extender crash, even if Ext.Osiris.IsCallable() has already returned true; calls should only be made when the game state is Running, Paused, or GameMasterPause.
  • During GM pause, Osiris defers world operations (placement, teleportation) until the pause is lifted, and calling SetOnStage immediately after creating a character is lost; the bridge marks such results with applies_on_unpause.
  • CombatRoundStarted and CharacterVitalityChanged do not fire in GM mode; round counting and health polling should be used instead.
  • The Script Extender console rejects commands during GM pause, but the file bridge still works.
  • Items accept CustomDisplayName, CustomDescription, and CustomBookContent at runtime, and the values are passed to players.

Acknowledgments

LSLib and Script Extender are provided by Norbyte and are the foundation that makes this project possible. Divinity: Original Sin 2 is a game by Larian Studios.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools