Code Property Graph MCP server for DayZ Enforce Script
Project description
enforce-cpg
A Code Property Graph (CPG) MCP server for DayZ Enforce Script.
It parses Enforce Script (.c) source across a vanilla/base layer and any
number of mod layers, builds a graph of declarations, inheritance,
overrides, and calls, and exposes that graph over the Model Context
Protocol so an AI coding assistant (e.g.
Claude Code) can answer real DayZ-modding questions: "what overrides
Speak on Animal?", "who calls this method?", "what breaks if I change
this field?" — across a real, multi-mod, load-order-dependent codebase,
without ever crashing on a bad file or an unresolved reference.
Install
pip install enforce-cpg # or: uvx enforce-cpg --version
No compiler needed — the Enforce grammar ships as prebuilt wheels
(tree-sitter-enforce).
Or, from a local checkout:
uv sync
uv run enforce-cpg --version
Configure
Point enforce-cpg at your vanilla scripts and mod source trees with an
enforce-cpg.toml file (see enforce-cpg.example.toml):
[project]
name = "my-server"
db_path = ".enforce-cpg/index.db"
# ORDERED: earlier = loaded first = base precedence. This IS your -mod= order.
[[sources]]
name = "vanilla"
kind = "core"
path = "/path/to/vanilla_scripts"
[[sources]]
name = "MyMod"
kind = "mod"
path = "/path/to/MyMod/Scripts"
Load-order warning: the order of [[sources]] in this file is the
override precedence used to resolve Animal.Speak-style method stacks —
it must mirror your server's real -mod= load order. A source listed
earlier is treated as the base that later sources override; get this
wrong and resolve_method / get_inheritance will report the wrong
override winner.
Build (or rebuild) the index:
uv run enforce-cpg index --config enforce-cpg.toml --full
Tools
Once registered with an MCP client, enforce-cpg exposes 12 tools:
| Tool | Description |
|---|---|
reindex |
Rebuild the code property graph index. full=true forces a from-scratch rebuild; otherwise only changed files are re-indexed. |
find_symbol |
Find declarations of a symbol by name (optionally filtered by kind). |
find_references |
Find references to a symbol by name (optionally filtered by kind; declaration sites excluded by default). |
find_callers |
Find callers of a class method, transitively up to the given depth. |
resolve_method |
Resolve a method call to its override stack across the source layers (core -> mods), in resolution order, flagging cut chains. |
get_inheritance |
Get the inheritance chain for a class, optionally scoped to a method. |
impact_of_change |
Estimate the blast radius of changing a class member. |
get_overview |
Get a structural overview of a file or a class. |
audit_overrides |
Corpus-wide override audit: every modded layer that overrides without super, silently disabling earlier layers. |
mod_surface |
Every method a given source overrides that another source also defines — the mod's footprint on the shared hierarchy. |
doctor |
Setup + index-health report: sources resolved, per-source parse coverage, missing-vanilla warning, diagnostics, unresolved hotspots. |
ingest |
Register a source from an extracted directory (always) or a .pbo (de-rapified if a tool is available), copied under .enforce-cpg/sources/ with the [[sources]] entry added. |
The same surface is available on the CLI (enforce-cpg find-symbol,
… audit, … mod-surface --source <name>, … doctor,
… ingest <path> --name <n> --kind core|mod, …).
Every tool degrades honestly instead of crashing: an unresolved symbol or
a missing argument returns {"results": [], "note": "..."} rather than an
exception, so a single bad query never takes down the server.
Register with Claude Code
claude mcp add enforce-cpg -- uvx --from enforce-cpg enforce-cpg-mcp
The server reads its config from the ENFORCE_CPG_CONFIG environment
variable (defaults to enforce-cpg.toml in the working directory), so
set that to your project's config path when registering.
License
enforce-cpg is licensed under the Attribution Assurance License (AAL),
an OSI-approved open-source license. The full license text is in
LICENSE; the required attribution notice is in
NOTICE.
Attribution notice (must be displayed per the AAL's attribution clause):
enforce-cpg — © 2026 tommyz4 — https://github.com/tommyz4/enforce-cpg
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file enforce_cpg-0.2.1.tar.gz.
File metadata
- Download URL: enforce_cpg-0.2.1.tar.gz
- Upload date:
- Size: 254.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c5eda086de73c2e1143d0945679076e13e3de429e0693fd5825df88c0d99338
|
|
| MD5 |
b5eca1c2b085c0262f10e9d2521ff535
|
|
| BLAKE2b-256 |
c7361f7180e17a7bae6dda284264b5cb6f6a17d40d3e3ac0d4f02ae99394f136
|
File details
Details for the file enforce_cpg-0.2.1-py3-none-any.whl.
File metadata
- Download URL: enforce_cpg-0.2.1-py3-none-any.whl
- Upload date:
- Size: 33.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79a47604ecdd92a1fdcfcb710d44e2b53580819143f6992056ec78cb34061b77
|
|
| MD5 |
2dd48e829f6f18a70d61eca56d37f6ee
|
|
| BLAKE2b-256 |
fed0132a330cacf77e04ad7e6cbf3b97ecb3f7863282de143ba038576fc2e1f2
|