HOI4 Agent Tools
Provides tools for modding Hearts of Iron IV, including focus tree editing, GUI design, and map transactions, integrating with Paradox Interactive's game development environment.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@HOI4 Agent Tools scan the focus tree in my mod for errors"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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). 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.
Related MCP server: mcdev-mcp
Quick start
Install Node.js 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_ENGINEto that build.Install the server:
npm install --global hoi4-agent-toolsPrint the client configuration:
hoi4-agent-tools-setup --print-client-configPaste the
globalInstallblock into a JSON client such as Claude Code, Claude Desktop or Cursor, or thecodexTomlGlobalblock into Codex'sconfig.toml.Open your mod folder as the agent's workspace and tell it what you want to build or fix.
The setup guide covers several mods, explicit game paths, local wiki snapshots and troubleshooting with --discover and --diagnose.
Watch the Agent Tools demo or use HOI4 Mod Setup to install and connect the server for your mod. Part of the HOI4 modding toolkit with Agentic HOI4 Modding (skills and instructions for your agent) and HOI4 Live Tools (testing in the running game).
Examples

Each pair shows a capture from the game next to the server's preview of the same source.
In game | Server preview |
|
|
|
|
|
|
See more in the examples gallery.
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 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).
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 and the HTTP guide.
Documentation
Setup and configuration
Guides: local references, focus trees, scripted GUIs, maps, events, technology, AI weights and timing, decisions and impact, mechanic and package tests
Background jobs and HTTP
Development
npm ci
npm run checkSee the contributing guide and the development guide.
License
Apache-2.0; see LICENSE and the third-party notices. 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.
Available Tools
13 toolshoi4.error_logRead the game error logARead-onlyIdempotent
Find errors from the last game launch and group them by category, with source files, lines and fix hints. Show which files changed since the log and which errors appeared after a relaunch; mod entries come first. Example: {"scope":"mod","category":"effect"}. Returns at most 20 entries (limit 50) with fix hints and which entries are new since the previous launch.
Inputs: limit, query, scope, offset, +2 more. Returns: code, data, status, blockers, +7 more
hoi4.explain_errorExplain error.log linesARead-onlyIdempotent
Explain error.log lines: the rule each one breaks, its file and line with the lines around it, and the fix, from a reviewed catalogue of the game's messages. Says whether the game documents the command a line names, and the closest documented names. Example: {"line":"Invalid trigger 'stability' in events/my_events.txt line : 12"}. Returns up to 20 explanations (10 lines).
Inputs: line, lines, workspaceId. Returns: code, data, status, blockers, +7 more
hoi4.localisation_inspectCheck localisation in every languageARead-onlyIdempotent
Read localisation in every language the game and mod ship. key: one key per language with file, line and layer, the languages lacking it and the files mentioning it. audit: keys the mod uses that no language defines, keys missing from a supported language, keys defined twice in one language, and file problems. coverage: keys per language. Example: {"mode":"key","key":"my_event.1.t"} or {"mode":"audit"}. Returns counts per problem and a few examples of each.
Inputs: key, mode, limit, language, +1 more. Returns: code, data, status, blockers, +7 more
hoi4.localisation_writeAdd or fix localisationADestructive
Add localisation keys (mode add: key and text; language, file, replace) or repair localisation files (mode fix: BOM, broken quotes, keys missing from supported languages). Game keys are overridden from a replace folder. apply false returns the diff and writes nothing; apply true writes it. Returns up to 10 files with diffs. Example: {"mode":"add","entries":[{"key":"my_focus","text":"My focus"}]}
Inputs: mode (required), file, apply, fixes, +6 more. Returns: code, data, status, blockers, +7 more
hoi4.mod_healthCheck a whole modARead-onlyIdempotent
Check a whole mod in one call: the last error.log, the engine check (unknown effects, triggers and modifiers, duplicate ids, broken overrides), script validation, and the localisation and asset audits. Returns the 10 problems that matter most, each counted with 2 examples, its fix and the tool to use next, and which audits ran. Example: {"limit":5} or {"checks":["error_log","engine_check"]}. Takes up to a minute on a large mod.
Inputs: limit, checks, workspaceId. Returns: code, data, status, blockers, +7 more
hoi4.mod_indexExplore mod content and find free IDsARead-onlyIdempotent
Summarize the content in a mod or find a free event ID across the mod, game and dependencies. Use overview for descriptors, folders and definitions (the 50 busiest namespaces; pass a namespace or prefix to list those starting with it), or next_id with a namespace or prefix. Example: {"mode":"next_id","kind":"event","namespace":"my_mod"}. Returns a compact summary; the first call indexes the mod, which takes seconds on a large one.
Inputs: kind, mode, layer, prefix, +2 more. Returns: code, data, status, blockers, +7 more
hoi4.reference_contextFind docs for a modding taskARead-onlyIdempotent
Find documentation for the content you are building: events, decisions, ideas, focuses, technology, GUI, maps, localisation or AI. Example: {"surface":"event","question":"fire an event after a delay"}. Returns up to 16 short sections; read more with hoi4.reference_read.
Inputs: surface (required), limit, question, workspaceId. Returns: code, data, status, blockers, +7 more
hoi4.reference_readRead a modding ruleARead-onlyIdempotent
Read a documentation section returned by reference_search or reference_context. Pass its id and revision. Example: {"id":"","revision":""}. Returns at most 80 lines (40 by default) and 8,000 bytes, with a line to continue from.
Inputs: id (required), revision (required), source, maxLines, +3 more. Returns: code, data, status, blockers, +7 more
hoi4.reference_searchFind a modding ruleARead-onlyIdempotent
Find a modding rule in the offline wiki and installed game docs by plain words or script name. Returns up to 10 short candidates (limit up to 12) with file, lines, revision and, for a command, a one-line meaning and its scopes. Pick the one that fits, since several commands sound alike, then read it with hoi4.reference_read using its id and revision. Example: {"query":"add_timed_idea"} or {"query":"make a country hold elections now"}.
Inputs: query (required), limit, sources, workspaceId. Returns: code, data, status, blockers, +7 more
hoi4.script_guardFind invented commands in new scriptARead-onlyIdempotent
Check the files you wrote for invented commands: every effect, trigger and modifier that the installed game documentation does not list and no loaded file defines, with its file, line and the closest real name. Checks the named paths, or the mod script files changed in the last 120 minutes. Needs hoi4-engine. Example: {"paths":["events/my_events.txt"]}. Returns up to 40 names.
Inputs: paths, workspaceId, sinceMinutes. Returns: code, data, status, blockers, +7 more
hoi4.script_validateCheck HOI4 script commands and scopesARead-onlyIdempotent
Find broken syntax, commands and scopes in an effect, trigger or mod file using the installed docs. Unknown helpers and native argument blocks stay unresolved. Example: {"source":"add_political_power = 10","kind":"effect","scope":"country"} or {"path":"events/a.txt"}. {"closure":true} instead counts whether the references of the whole mod resolve, per kind. Returns up to 12 findings.
Inputs: kind, path, limit, scope, +5 more. Returns: code, data, status, blockers, +7 more
hoi4.skillRead the mod's modding skillsARead-onlyIdempotent
List the modding skills installed in the mod, or load one by name, at the kit version HOI4 Mod Setup pinned, with its hash. A file edited since Setup installed it is refused unless acceptLocalEdits. Example: {"name":"hoi4-events"}. Returns up to 20,000 bytes of text; continue from nextOffset.
Inputs: file, name, offset, workspaceId, +1 more. Returns: code, data, status, blockers, +7 more
hoi4.source_lookupFind definitions and usagesBRead-onlyIdempotent
Find where a script symbol is defined and used across the game, DLC and mod. Pass a symbol, or a file path and line. Example: {"symbol":"my_scripted_effect"}. Returns up to 3 definitions with source text and 10 usages; keyPath and view=structure navigate nested blocks.
Inputs: kind, line, path, view, +13 more. Returns: code, data, status, blockers, +7 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
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.
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.
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.
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
Related MCP Connectors
One MCP server for all your MCP servers: code mode, per-tool permissions, approvals and audit.
A MCP server built for developers enabling Git based project management with project and personal…
An MCP server for deep research or task groups
MCP Server for JFrog, providing tools for development and artifact management.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA provider-agnostic MCP server that synchronizes work-in-progress between multiple coding sessions to prevent file conflicts.2MIT
- AlicenseAqualityCmaintenanceAn MCP server that empowers AI coding agents to work effectively with Minecraft mod development, providing static analysis of decompiled source code and runtime interaction with a running Minecraft instance.3140 npm18MIT
- FlicenseBqualityDmaintenanceAn MCP server that provides a bounded development workflow for ExileAPI plugins, enabling agents to detect compiler references, create linked Git repositories, and read build errors.19-
- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives AI coding agents structured access to a project's architecture, rules, modules, and technical decisions.MIT





