forge-mcp

MCP stdio 서버를 통해 hex, 오프셋, PE, APK, Unity 및 Unreal 워크플로를 지원하는 게임 모딩 도구입니다.

문서

forge-mcp

Python License MCP CI

forge-mcp is a Python Model Context Protocol (MCP) server for local, single-player game-modding workflows. It gives an MCP client structured tools for inspecting and editing hex files, PE binaries, APKs, Unity and Unreal assets, tables, archives, and format templates, with workspace snapshots and undo support.

The server exposes MCP tools over the Python MCP SDK's default stdio transport. It is intended to be launched by an MCP client such as Claude Desktop; this repository does not configure an HTTP or SSE listener.

Use this project only with game files you own or are authorized to inspect and modify. It is not an online-game, anti-cheat, DRM-removal, or multiplayer tool.

Features

  • Hex viewing, AOB/wildcard/string search, file diffs, value scans, offset calculations, pointer-chain helpers, binary patches, and checksums.
  • PE inspection, function/string-reference lookup, signatures, cross-build matching, isolated Unicorn emulation, and optional Ghidra decompilation.
  • APK manifest and native-library inspection, resource extraction, smali search/patch, APK repacking/signing, and optional Il2Cpp metadata dumping.
  • Unity asset listing/extraction/replacement and Unreal .pak listing/extraction/packing through the corresponding optional tooling.
  • Schema-driven table listing, cloning, field edits, reference lookup, offset rebuilding, checksums, and validation.
  • ZIP/TAR/7z/unrar archive operations through the archive plugin layer.
  • Format analysis and templates: entropy maps, decode attempts, field guesses, .ksy/.hexpat template generation, and validation.
  • Frida hook-script generation and text trace diffs. The server generates scripts; it does not execute Frida hooks.
  • Crash-log parsing, dependency checks, mod-conflict detection, bisect plans, load-order suggestions, IPS/xdelta patch export, Cheat Engine table generation, job-log changelogs, and snapshot undo.

Installation

forge-mcp requires Python 3.11 or newer.

Install from Git

# Core package
python -m pip install "forge-mcp @ git+https://github.com/RivaExits0/forge-mcp.git@v0.1.1"

# Include optional Python integrations
python -m pip install "forge-mcp[full] @ git+https://github.com/RivaExits0/forge-mcp.git@v0.1.1"

Install from a checkout

git clone https://github.com/RivaExits0/forge-mcp.git
cd forge-mcp
python -m pip install -e ".[full]"

The core package includes the MCP SDK, PE/ELF parsers, Capstone, Unicorn, LIEF, cryptography, and related analysis libraries. The full extra adds keystone-engine, UnityPy, kaitaistruct, androguard, and lz4. The dev extra adds pytest; lint adds Ruff and mypy.

Run the server

The package installs the forge-mcp console command:

forge-mcp

The equivalent module invocation is:

python -m forge_mcp.server

Both start the MCP server using stdio. The server creates workspaces under ./forge-workspaces by default, relative to the process working directory. Set FORGE_WORKSPACE_ROOT to choose another root:

FORGE_WORKSPACE_ROOT=/absolute/path/to/forge-workspaces forge-mcp

MCP client configuration

For Claude Desktop, add a server entry to claude_desktop_config.json and restart the client:

{
  "mcpServers": {
    "forge-mcp": {
      "command": "/absolute/path/to/venv/bin/forge-mcp",
      "env": {
        "FORGE_WORKSPACE_ROOT": "/absolute/path/to/forge-workspaces"
      }
    }
  }
}

If the command is available on the configured PATH, this also works:

{
  "mcpServers": {
    "forge-mcp": {
      "command": "forge-mcp",
      "env": {
        "FORGE_WORKSPACE_ROOT": "/absolute/path/to/forge-workspaces"
      }
    }
  }
}

On Windows, use an absolute executable path or "command": "forge-mcp"; use JSON-escaped backslashes or forward slashes in paths.

MCP tools

There are ten top-level tools. Most use a module + action + optional params dispatch shape. Large list responses support offset and limit; the paging helper caps a page at 4096 items. Mutating operations generally accept dry_run and write operations log jobs and take snapshots where applicable.

ToolMain responsibilities
open_gameCreate/open a per-game workspace, import a source file as an original plus working copy, and load an optional profile directory. Call this first for workspace-dependent operations.
inspectRead-only inspection: PE information/decompilation, APK and native-library data, Unity/Unreal assets, tables, archives, entropy, and hex views.
searchHex/AOB/string searches, binary diffs, value scans, PE function lookup and cross-build matching, smali searches, format guesses/decoding, and crash-log parsing.
editDry-run-first edits for hex, smali, tables, checksums, templates, archives, APKs, Unity assets, and Unreal packages.
patch_codePE signature generation/verification, isolated function emulation, optional Ghidra decompilation, Il2Cpp dumping, and Frida script generation.
rebuildRebuild or repack tables, archives, APKs, Unreal packages, and format templates.
validateValidate PE signatures, tables, format templates, and availability of selected APK tools.
exportExport IPS/xdelta patches and Cheat Engine tables, or read the workspace changelog/job log.
diagnoseParse crash logs, check dependencies, find mod conflicts, create bisect plans, suggest load order, and diff traces.
undoRestore the latest or a selected workspace snapshot, with a SHA-256 result for restored files.

Example tool calls use JSON parameters like these:

open_game({
  "game_name": "example_game",
  "source_path": "/games/example_game/example.exe"
})

inspect({
  "module": "pe",
  "action": "pe_info",
  "params": {"path": "/path/to/example.exe"}
})

search({
  "module": "hex",
  "action": "hex_search",
  "params": {
    "path": "/path/to/example.exe",
    "query": "48 8B ?? ?? ?? 90",
    "mode": "aob",
    "limit": 20
  }
})

edit({
  "module": "hex",
  "action": "hex_patch",
  "params": {
    "path": "/path/to/work/example.exe",
    "offset": 4660,
    "bytes_hex": "90 90",
    "dry_run": true
  }
})

For a longer end-to-end example, see docs/demo-script.md.

Optional external tools

Core operations do not require every external integration. When an optional executable is missing, the relevant operation reports an error or unavailable dependency instead of silently completing it.

ToolUsed forConfiguration
Ghidra (analyzeHeadless)Optional PE decompilationPass ghidra_home or set GHIDRA_HOME/configure it on PATH.
apktoolAPK unpack/repackPut it on PATH or configure APKTOOL_HOME.
jadxAndroid/Dex-related workflowsPut it on PATH or configure JADX_HOME.
Il2CppDumperOptional Il2Cpp dumpingPut the executable on PATH.
UnrealPak or u4pakUnreal .pak operationsPut the selected tool on PATH.
xdelta3xdelta patch exportPut it on PATH.
Frida (frida, frida-trace)Generated runtime hook scriptsInstall separately, for example python -m pip install frida frida-tools.
aapt2Preferred APK manifest parsingInstall via Android SDK Build Tools and put it on PATH.

Python integrations such as UnityPy, Androguard, LZ4, Keystone, and Kaitai Struct are installed by the full extra where supported.

Workspaces, safety, and limitations

  • open_game validates the workspace name and keeps an imported original separate from the working copy. Workspace-relative paths are checked before writes.
  • Single-file writes take a snapshot before changing the target when the operation supports snapshotting. undo can restore the latest snapshot or a specified snapshot ID. Directory-producing operations, including some APK, Unity, Unreal, and Il2Cpp outputs, are exceptions to the single-file snapshot model.
  • Archive extraction rejects traversal paths, absolute paths, symlinks, hardlinks, and special files. This protects archive destinations, but explicit input paths are still local filesystem paths: the server is not a general-purpose sandbox.
  • Many mutating actions default to dry_run: true; review the result before applying a change. Use working copies and backups for important files.
  • PE emulation is performed through Unicorn with the module's constrained emulation setup; it is not a substitute for running the target program. The server does not execute binaries or generated Frida scripts.
  • External tools, APK signing credentials, AES keys, game-specific schemas, and file-format support are environment-dependent. Unsupported actions return an error rather than implying that an artifact was changed.
  • This project is for authorized local modding and analysis. It does not provide multiplayer support, anti-cheat bypass, DRM removal, or a hosted security boundary.

Game profiles

A profile is a directory under profiles/<game>/ containing data rather than Python code. The example profile shows the supported shape:

profiles/example_game/
├── profile.toml
├── signatures.json
└── schema.ksy        # optional Kaitai schema

Pass the directory to open_game with profile_dir:

open_game({
  "game_name": "example_game",
  "profile_dir": "/path/to/forge-mcp/profiles/example_game"
})

See profiles/example_game/profile.md for the example format.

Development

Create an editable development install and run the repository checks:

python -m pip install -e ".[full,dev]"
python -m pytest -q

The CI workflow runs the test matrix on Linux and Windows with Python 3.11 and 3.12. It also runs:

python -m pip install -e ".[lint]"
ruff check src tests
mypy src/forge_mcp

The tests use synthetic fixtures under tests/fixtures/; they do not require copyrighted game files. To regenerate fixtures when needed:

python tests/make_fixtures.py

Run the server locally during development with:

python -m forge_mcp.server

Project layout

src/forge_mcp/server.py       # FastMCP server and ten top-level tools
src/forge_mcp/core/           # workspaces, snapshots, paging, profiles, external tools
src/forge_mcp/modules/        # hex, PE, APK, Unity, Unreal, tables, archives, formats, etc.
profiles/                     # example and community profile data
tests/                        # unit, security, module, and server tests
docs/                         # demo workflow and recording notes

License

MIT. See LICENSE.

Links