Skip to main content
Glama
HOI4 Agent Tools

HOI4 Agent Tools

by klimPaskov
README.md
<p align="center">
  <img src="https://raw.githubusercontent.com/klimPaskov/hoi4-agent-tools/main/docs/images/logo.png" width="96" height="96" alt="HOI4 Agent Tools">
</p>

<h1 align="center">HOI4 Agent Tools</h1>

<p align="center">
  An <a href="https://modelcontextprotocol.io/">MCP</a> server that helps coding agents build and edit <em>Hearts of Iron IV</em> mods.
</p>

<p align="center">
  <a href="https://www.npmjs.com/package/hoi4-agent-tools"><img alt="npm" src="https://img.shields.io/npm/v/hoi4-agent-tools"></a>
  <a href="https://nodejs.org/"><img alt="Node.js" src="https://img.shields.io/node/v/hoi4-agent-tools"></a>
  <a href="LICENSE"><img alt="License" src="https://img.shields.io/npm/l/hoi4-agent-tools"></a>
  <a href="https://github.com/klimPaskov/hoi4-agent-tools/releases/latest"><img alt="Release" src="https://img.shields.io/github/v/release/klimPaskov/hoi4-agent-tools?label=Release&logo=github&color=2ea44f"></a>
  <a href="https://discord.gg/rAXesGcT2t"><img alt="Discord" src="https://img.shields.io/badge/Discord-Join%20Community-7289da?logo=discord&logoColor=white"></a>
  <a href="https://www.youtube.com/@ChaosRedux"><img alt="YouTube" src="https://img.shields.io/badge/YouTube-Chaos%20Redux-ff0000?logo=youtube&logoColor=white"></a>
  <a href="https://ko-fi.com/klimpaskov"><img alt="Ko-fi" src="https://img.shields.io/badge/Ko--fi-Support%20the%20Project-ff5e5b?logo=kofi&logoColor=white"></a>
  <a href="https://github.com/klimPaskov/hoi4-agent-tools/issues"><img alt="Issues" src="https://img.shields.io/badge/Bugs%20%26%20Ideas-Issues-24292f?logo=github&logoColor=white"></a>
</p>

<p align="center">
  <a href="#quick-start">Quick start</a> ·
  <a href="https://www.npmjs.com/package/hoi4-agent-tools">npm</a> ·
  <a href="CHANGELOG.md">Changelog</a> ·
  <a href="CONTRIBUTING.md">Contributing</a> ·
  <a href="SECURITY.md">Security</a>
</p>

<p align="center">
  <a href="https://www.youtube.com/watch?v=Dd36E_NK4rQ"><img src="https://raw.githubusercontent.com/klimPaskov/hoi4-agent-tools/main/docs/images/agent-tools-demo-thumbnail.png" alt="Watch the HOI4 Agent Tools demo"></a>
</p>

Make focus trees, events and decisions. Edit maps and generate a new world. Preview windows, trees and maps, find the right rule in the docs, fix broken script and balance AI choices.

## What it does

Your agent can build and edit focus trees, events, decisions and maps, and generate a new world from a reference image ([map guide](docs/map.md)).
It previews focus trees, technology folders, windows and maps, finds the right rule in the game's documentation, fixes broken script and tunes AI choices.
You describe what you want; the agent picks the right tools.

## Quick start

1. Install [Node.js](https://nodejs.org/) 22 (22.19 or later) or 24, and keep Hearts of Iron IV installed for vanilla files, artwork and fonts.
   The package ships its analysis engine for Windows x64, Linux x64 and arm64, and macOS on Apple silicon. On another platform, such as an Intel Mac, the tools that need the engine say so and how to build it; set `HOI4_ENGINE` to that build.
2. Install the server:

   ```bash
   npm install --global hoi4-agent-tools
   ```

3. Print the client configuration:

   ```bash
   hoi4-agent-tools-setup --print-client-config
   ```

   Paste the `globalInstall` block into a JSON client such as Claude Code, Claude Desktop or Cursor, or the `codexTomlGlobal` block into Codex's `config.toml`.

4. Open your mod folder as the agent's workspace and tell it what you want to build or fix.

The [setup guide](docs/setup.md) covers several mods, explicit game paths, local wiki snapshots and troubleshooting with `--discover` and `--diagnose`.

[Watch the Agent Tools demo](https://www.youtube.com/watch?v=Dd36E_NK4rQ) or use [HOI4 Mod Setup](https://github.com/klimPaskov/HOI4-Mod-Setup/releases/latest) to install and connect the server for your mod.
Part of the HOI4 modding toolkit with [Agentic HOI4 Modding](https://github.com/klimPaskov/Agentic-HOI4-Modding) (skills and instructions for your agent) and [HOI4 Live Tools](https://github.com/klimPaskov/HOI4-Live-Tools) (testing in the running game).

## Examples

[![A large focus tree rendered from mod source](docs/images/comparisons/holy-realm-mcp.png)](docs/images/comparisons/holy-realm-mcp.png)

Each pair shows a capture from the game next to the server's preview of the same source.

| In game                                                                                                                                | Server preview                                                                                                                   |
| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| [![Focus tree in game](docs/images/comparisons/fury-ingame.png)](docs/images/comparisons/fury-ingame.png)                              | [![Focus tree preview](docs/images/comparisons/fury-mcp.png)](docs/images/comparisons/fury-mcp.png)                              |
| [![Infantry technology folder in game](docs/images/comparisons/infantry-ingame.png)](docs/images/comparisons/infantry-ingame.png)      | [![Infantry technology folder preview](docs/images/comparisons/infantry-mcp.png)](docs/images/comparisons/infantry-mcp.png)      |
| [![Video options in game](docs/images/comparisons/gui/options-video-ingame.png)](docs/images/comparisons/gui/options-video-ingame.png) | [![Video options preview](docs/images/comparisons/gui/options-video-mcp.png)](docs/images/comparisons/gui/options-video-mcp.png) |

See more in the [examples gallery](docs/examples.md).

## Tools

The server gives your agent previews, documentation, script analysis and editing tools.
The agent combines them with its file editor to build events and decisions, repair scripts and adjust AI weights.
The [tool reference](docs/tools.md) lists exact names, arguments and results for integrations.

A session lists the core tools by default: documentation search, source lookup, script validation, the error log, the mod health check and localisation. They fit in about 8,000 tokens of the agent's context. Set `HOI4_AGENT_TOOLS_PROFILES` to `core,map`, `core,advanced` or `all` in the client's server entry for the world map tools or the focus, GUI, event, technology and probability editors ([tool profiles](docs/setup.md#choose-tool-profiles)).

## FAQ

**Where do edits go?** Changes are written to your mod folder; use Git to review or undo them.

**Does it run the game?** No. Previews come from mod source; test gameplay in HOI4 to see live clicks, AI choices and timing.

## Configuration

Started inside a mod folder, the server needs no configuration file.
`hoi4-agent-tools-setup --init` writes one when you work on several mods or the game is not found automatically.
For remote or shared use, `hoi4-agent-tools-http` serves the same tools over HTTP with tokens or OAuth.
See the [configuration reference](docs/configuration.md) and the [HTTP guide](docs/http.md).

## Documentation

- [Setup](docs/setup.md) and [configuration](docs/configuration.md)
- [Examples](docs/examples.md) and [tool reference](docs/tools.md)
- Guides: [local references](docs/reference.md), [focus trees](docs/focus.md), [scripted GUIs](docs/gui.md), [maps](docs/map.md), [events](docs/events.md), [technology](docs/technology.md), [AI weights and timing](docs/probability.md), [decisions and impact](docs/analysis.md), [mechanic and package tests](docs/mechanics.md)
- [Background jobs](docs/jobs.md) and [HTTP](docs/http.md)
- [Development](docs/development.md), [changelog](CHANGELOG.md) and [security policy](SECURITY.md)
- [Documentation index](docs/README.md)

## Development

```bash
npm ci
npm run check
```

See the [contributing guide](https://github.com/klimPaskov/hoi4-agent-tools/blob/main/CONTRIBUTING.md) and the [development guide](docs/development.md).

## License

Apache-2.0; see [LICENSE](LICENSE) and the [third-party notices](docs/third-party-notices.md).
Hearts of Iron IV artwork belongs to Paradox Interactive; this project is unaffiliated with Paradox Interactive.
The in-game captures were supplied for these comparisons.

TDQS

A3.9/5.0

Scored across 13 tools

Disambiguation4/5

Most tools have clearly distinct roles: reference_search/read/context form a discovery→read pipeline, error_log/explain_error/mod_health span finding→explaining→overall checking. The closest overlap is script_validate vs script_guard (both analyze scripts), but descriptions differentiate syntax/command validation from invented-name detection, so an agent can choose correctly.

Naming Consistency4/5

All names use a consistent hoi4. prefix and snake_case, so the convention is readable. There is minor variation in ordering—some are verb_noun (reference_search, script_validate, explain_error) while others are noun_verb (localisation_write, mod_health, error_log)—but no mixed casing or chaotic styles.

Tool Count5/5

13 tools is well within the sweet spot for a modding assistant toolkit. Each tool covers a distinct facet (docs, validation, errors, health, localisation, index, skills) and none feels redundant.

Completeness4/5

Strong lifecycle coverage: search/read docs, validate, guard against invented commands, diagnose launch errors, whole-mod health, localisation read/write, and indexing. The main gap is a general script-authoring/edit tool (only localisation_write exists), but core diagnosis and writing workflows are covered.

Maintenance

ActivityActive
ResponsivenessNo recent community issues