Skip to main content
Glama
pz-modding-mcp

pz-modding-mcp

by MrMikojo

pz-modding-mcp

An MCP server for Project Zomboid Build 42 modding. It lets an AI coding tool (Claude Code, Claude Desktop, OpenCode, or any MCP client) check PZ names against your installed game instead of guessing them.

AI models often invent PZ methods and events, or remember Build 41 names. This server reads projectzomboid.jar and the game's media/ folder on your PC and answers with short YES/NO results and real signatures. Short answers suit small local models (such as qwen3 through Ollama) as well as large ones.

  • Runs locally over stdio. No network access, no telemetry.

  • Read-only. It writes only to its own cache folder.

  • Ships no game files. The indexes are built on your PC from your own install, and rebuilt after a game update.

Tools

Tool

What it answers

Example

pz_check

Is a class, method, field, event or global real? YES/NO with the signature

method IsoPlayer getStats, event OnZombieDead, global getPlayer

pz_api

A class's public methods and fields, including its parents'

IsoPlayer, IsoPlayer.getStats, getModData

pz_items

Items and recipes from the game's scripts, searchable

Base.Axe, ItemType=base:weapon sort=MaxDamage, recipe RipClothing

pz_lua_search

Where the game's own Lua (or scripts) uses some text, with file:line

sendClientCommand(

show_lua_function

One Lua function from your mod or from the game, not the whole file

ISBaseTimedAction:isValid

pz_source

Optional: decompiled Java for one method, made locally with CFR

IsoPlayer, getStats

pz_status

Setup check: the PZ folder, the index state, what is on

pz_rebuild_indexes

Rebuild the indexes by hand (they also rebuild by themselves)

pz_check is the same checker as the pzcheck.py script in the pz-modding skill. The server runs it in-process and keeps the jar loaded between calls.

Related MCP server: NarshaMCP

Requirements

  • Python 3.10 or newer.

  • Project Zomboid Build 42 installed. Tested with 42.22.2 on Windows.

  • For pz_source only: Java (PZ's own jre64 is used if found) and a CFR jar that you download yourself.

Install

git clone <this repository> pz-modding-mcp
cd pz-modding-mcp
python -m pip install .

Check the setup without a client:

python -m pz_modding_mcp --check

It prints the PZ folder it found, the index state, and which folders show_lua_function may read. The first tool call builds the indexes (about 15 to 30 seconds). Later calls are fast.

Connect a client

The server starts with python -m pz_modding_mcp (or the pz-modding-mcp command after install). Use the Python that has the package installed. Example configs are in config/.

Claude Code

claude mcp add pz-modding -e PZ_DIR="C:/Program Files (x86)/Steam/steamapps/common/ProjectZomboid" -- python -m pz_modding_mcp

Or copy config/claude-code.mcp.json into your mod's folder as .mcp.json.

Claude Desktop: add the block from config/claude-desktop.json to claude_desktop_config.json.

OpenCode: add the mcp block from config/opencode.json to your opencode.json.

Start the client in your mod's folder, so that show_lua_function can read your mod's files.

Settings (environment variables)

Variable

Meaning

Default

PZ_DIR

the folder with projectzomboid.jar

the usual Steam folders on Windows, Linux and macOS

PZ_MCP_CACHE

where the indexes go

%LOCALAPPDATA%\pz-modding-mcp, ~/.cache/pz-modding-mcp, ~/Library/Caches/pz-modding-mcp

PZ_MCP_WORKSPACE

folders show_lua_function may read (separated by ; on Windows, : elsewhere)

the folder the server starts in

PZ_MCP_CFR

path to a CFR jar. pz_source is off without it

not set

PZ_MCP_JAVA

Java to run CFR with

PZ's jre64, then java on PATH

show_lua_function reads only files inside the workspace folders and the game's media folder.

What the indexes hold

  • api.txt: every public class, method and field under zombie.* in the jar (names and types only).

  • items.json: every item, craftRecipe, evolvedrecipe and fixing block in media/scripts, with file:line. Item fields come from the item block itself; nested blocks such as component FluidContainer are not merged in.

They are rebuilt when the jar or the script files change.

Game files and decompiled code

  • This repository holds no Project Zomboid files, indexes or decompiled code. Do not add them.

  • pz_source decompiles single classes on your PC, into the cache folder, so you can understand what a method does. Do not publish that output or copy it into a mod. Check The Indie Stone's terms before you use it.

Tests

python -m pip install ".[test]"
python -m pytest -q

tests/test_offline.py needs no game. tests/test_stdio.py starts the server over stdio and calls two tools; it is skipped when PZ is not found.

Known limits

  • Build 42 only. Build 41 jars may work for pz_api and pz_check, but this is not tested.

  • pz_api follows parent classes, not Java interfaces. pz_check method covers interfaces.

  • pz_source needs CFR. The bracket matching that cuts out one method is simple, and it may cut a method short when a string holds { or }.

  • Linux and macOS paths are included but not tested.

The pz-modding skill (a SKILL.md with reference pages and the same pzcheck.py) teaches a model the Build 42 rules: mod folders, Lua load order, multiplayer commands, sandbox options and translations. This server provides the lookups. They work well together, and each works alone.

License

MIT. See LICENSE. Project Zomboid is a trademark of The Indie Stone. This project is not affiliated with them.

Available Tools

8 tools
pz_apiA

Project Zomboid's Java API, from the installed game's jar: the public methods and fields Lua can call on PZ objects, with argument and return types. name = a class ("IsoPlayer": its members and its parents'), "Class.member" ("IsoPlayer.getStats", parents count too), or a member name alone ("getModData": every class that has it). Lua calls methods with a colon: player:getStats().

Inputs: name (required), max_hits. Returns: result

pz_checkA

Is a Project Zomboid name real? Answers YES or NO, with the real signature. query = a command and its names: "method IsoPlayer getStats", "field IsoPlayer x", "class ItemContainer" (also says if Lua can see it), "members IsoPlayer Stat", "find getModData", "event OnZombieDead", "global getPlayer", "lua ISTimedActionQueue.add", "grep sendClientCommand(", "script item Hammer". If it says NO, do not use that name.

Inputs: query (required). Returns: result

pz_itemsA

The game's items and recipes (from the installed game's media/scripts), searchable. Examples: "Base.Axe" one item, all its fields "ItemType=base:weapon sort=MaxDamage" weapons, highest damage first (= is an exact match) "Tagsripclothing" items whose Tags contain that text ( means contains) "poncho" items whose name or DisplayName contains it "recipe RipClothing" one craftRecipe, evolvedrecipe or fixing block Use it to see which items exist and their full names (Module.Name) before you use them in code.

Inputs: query (required), limit. Returns: result

pz_rebuild_indexesA

Rebuild the Java API and item indexes from the installed game. Only needed after a PZ update if a tool seems out of date: the tools rebuild by themselves when the game files change.

Inputs: no named parameters. Returns: result

pz_sourceA

What a PZ Java method actually does: its decompiled code, made on your PC from your own game jar with CFR (off unless PZ_MCP_CFR is set). cls = "IsoPlayer" or "zombie.characters.IsoPlayer"; method = a name (all its overloads) or "" for the class outline. For understanding PZ only: never copy PZ code into a mod.

Inputs: cls (required), method. Returns: result

pz_statusA

Setup check: which PZ folder is used, whether the indexes are built, and whether pz_source is on. Call it first if another tool says something is missing.

Inputs: no named parameters. Returns: result

show_lua_functionA

Print ONE Lua function or table from a file, with line numbers, instead of reading a whole file. path = a file in your workspace (your mod) or in PZ's media folder, e.g. "media/lua/client/ISUI/ISInventoryPane.lua"; name = "ISInventoryPane:onMouseDown", "MyMod.onTick", "Recipe". A short path is searched for under the readable folders (see pz_status).

Inputs: name (required), path (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 8 tools

    Disambiguation4/5

    Each tool targets a distinct facet of the modding workflow (setup, index rebuild, name validation, Java API browse, Lua search, function reading, item/recipe lookup, decompiled source). The only soft overlap is between pz_check and pz_api/pz_source, since all three can report a signature — but the descriptions explicitly separate 'validate this name', 'browse the API', and 'read the decompiled body'.

    Naming Consistency4/5

    Seven of eight tools use a pz_-prefixed snake_case convention (pz_api, pz_check, pz_items, pz_rebuild_indexes, pz_lua_search, pz_source, pz_status). The single outlier, show_lua_function, drops the prefix and leads with a verb, which is a minor but noticeable inconsistency.

    Tool Count5/5

    Eight tools is tightly scoped for a knowledge/lookup server covering PZ's Java API, Lua sources, and item/recipe data. Every tool earns its place: no redundant entry points and no obvious padding.

    Completeness4/5

    The surface covers the full lookup lifecycle: setup verification, index rebuild, name validation, Java API and decompiled source, Lua text search plus targeted function reading, and item/recipe queries. Minor gaps exist around file/directory browsing (you must already know a path for show_lua_function) and any mod-editing or linting operation.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables AI assistants to develop Desynced mods by providing direct access to the game's Lua API reference, base-game source, live logs, and installed mods, plus live control via a debugger link for evaluating and reloading Lua in the running game.
      9
      2
      MIT
    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables AI coding agents to inspect and work with Unreal Engine projects by parsing C++ symbols, Blueprints, and .uasset data over MCP, supporting tasks like symbol tracing, asset search, and code generation.
      -
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to query the actual AOSP and AndroidX source code locally, searching classes, extracting method bodies and Javadoc, listing class members, resolving inheritance hierarchies, and (via optional LSP) finding cross-file definitions and references. This gives precise, offline access to framework internals like the Activity lifecycle or Compose internals instead of relying on outdated training data.
      -