L2 Modding MCP
L2 Modding MCP
MCP Server for Lineage 2 / Unreal Engine 2.5 asset modding — 25 tools. Extract, modify, repackage textures (.utx), generate procedural meshes (.usx), parse animations (.ukx), sounds (.uax), and maps (.unr).
Features
Textures
Extract/inspect/import textures from
.utxpackagesCodec: DXT1/DXT3/DXT5/P8/RGBA8/RGB8/G16 (decode + encode)
Batch process: grayscale, invert, brightness, contrast, resize, blur, sharpen
Batch import: folder of PNGs →
.utxin one stepNormal map, AO map, specular map generation
Texture atlas builder (grid packing)
PBR channel packer (metallic/roughness/AO/height → RGBA)
3D Meshes
Procedural castle generator (towers, walls, battlements, gate, keep, floor)
StaticMesh serializer for
.usxpackagesExport to OBJ and FBX ASCII
Import from OBJ back into the pipeline
LOD generator (vertex decimation, LOD0–LOD3)
Collision mesh generator (box, cylinder)
Procedural heightmap terrain (hills, mountains, plains, island, noise)
Animations (.ukx)
Parse AnimationSequence data (frames, bones, tracks)
Export to BVH format (Blender/Maya compatible)
Sounds (.uax)
List sound assets
Extract sounds to WAV (PCM and embedded WAV)
Maps (.unr)
Parse level data: brushes, static meshes, lights, player starts
Package Management
Package browser: scan directories for mesh↔texture cross-references
Package optimizer: remove dead exports, reduce size
Package comparator: diff two packages
Installation
pip install -e .Usage with opencode
Add to opencode.json:
{
"mcp": {
"l2-modding": {
"type": "local",
"command": ["python", "-m", "l2_mcp.server"],
"enabled": true
}
}
}MCP Tools (25)
Textures
Tool | Description |
| List all assets in .utx/.usx/.ukx |
| List name table entries |
| Detailed texture info (format, mips, palette) |
| Extract single texture to PNG |
| Extract all textures to directory |
| Replace texture with PNG (repacks .utx) |
| Batch transform (grayscale, invert, etc.) |
| Folder of PNGs → .utx |
| Generate normal/AO/specular map |
| Pack textures into atlas grid |
| Pack metallic/roughness/AO/height → RGBA |
Meshes & Level Design
Tool | Description |
| Generate procedural 3D castle |
| Generate stone/roof/floor/gate textures |
| Export meshes to .usx |
| Export meshes to OBJ or FBX |
| Import OBJ → mesh pipeline |
| Generate LOD0–LOD3 by decimation |
| Generate collision mesh (box/cylinder) |
| Procedural heightmap terrain |
Animations
Tool | Description |
| List animations in .ukx |
| Export animation to BVH |
Sounds
Tool | Description |
| List sounds in .uax |
| Extract sound to WAV |
| Extract all sounds to WAV |
Package Management
Tool | Description |
| Diff two packages |
| Scan L2 folder for mesh↔texture refs |
| Strip dead exports, reduce size |
| Read .unr maps (brushes, actors, lights) |
Supported Texture Formats
ID | Format | Description |
0 | P8 | 256-color paletted |
1 | RGBA8 | 32-bit RGBA |
3 | DXT1/BC1 | 4 bpp, optional 1-bit alpha |
4 | RGB8 | 24-bit RGB |
5 | DXT3/BC2 | 8 bpp, explicit alpha |
6 | DXT5/BC3 | 8 bpp, interpolated alpha |
B | G16 | 16-bit grayscale |
Project Structure
src/l2_mcp/
├── server.py # MCP server (25 tools)
└── upk/
├── reader.py # Binary reader (compact indices, GUIDs)
├── package.py # UPK parser (.utx/.usx/.ukx) + serializer
├── texture.py # DXT codec + texture decode/encode
├── writer.py # Package rebuilder / repacker
├── mesh.py # StaticMesh serializer + primitives
├── castle.py # Procedural castle generator
├── obj_io.py # OBJ/FBX export
├── obj_import.py # OBJ import
├── animation.py # .ukx parser + BVH export
├── normal_map.py # Normal/AO/specular map generator
├── batch_builder.py # Batch import + heightmap terrain
├── lod.py # LOD generator + collision mesh
├── browser.py # Package scanner + optimizer
├── atlas.py # Texture atlas + PBR packer
├── sound.py # .uax sound extractor
└── unr.py # .unr map parserLicense
MIT