WzImg MCP Server Documentation

July 9, 2026 · View on GitHub

Version: 1.1.0

Overview

WzImg MCP Server is a Model Context Protocol (MCP) server that enables AI agents to interact with MapleStory IMG files programmatically. It provides 74 tools across 10 categories for reading, analyzing, modifying, and exporting game data.

First export the .wz files into .img with HaCreator, you will need the manifest.json!

Extract .wz window image

Quick Start

Installation

# Build the server
cd WzImg-MCP-Server
dotnet build WzImgMCP.csproj

Connection Methods

WzImg MCP Server supports two transport modes: stdio (standard input/output) and HTTP (Streamable HTTP with SSE).

MCP server name: wzimg

Method 1: Stdio (Default)

The stdio method runs the server as a subprocess. The client communicates via stdin/stdout.

# Run in stdio mode (default)
dotnet run --project WzImgMCP

Claude Desktop Configuration (%APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "wzimg": {
      "command": "dotnet",
      "args": ["run", "--project", "E:/path/to/WzImg-MCP-Server/WzImgMCP.csproj"],
      "env": {
        "WZIMGMCP_DATA_PATH": "D:\\Extract\\v83"
      }
    }
  }
}

Claude Code Configuration (.mcp.json in project root):

{
  "mcpServers": {
    "wzimg": {
      "type": "stdio",
      "command": "dotnet",
      "args": ["run", "--project", "E:/path/to/WzImg-MCP-Server/WzImgMCP.csproj"],
      "env": {
        "WZIMGMCP_DATA_PATH": "D:\\Extract\\v83"
      }
    }
  }
}

Codex Configuration (~/.codex/config.toml or project-scoped .codex/config.toml):

Codex supports MCP servers in the CLI and IDE extension. Both clients share config.toml, so you only need to configure the server once. See the Codex MCP documentation for the full configuration reference.

[mcp_servers.wzimg]
command = "dotnet"
args = ["run", "--project", "E:/path/to/WzImg-MCP-Server/WzImgMCP.csproj"]

[mcp_servers.wzimg.env]
WZIMGMCP_DATA_PATH = "D:\\Extract\\v83"

You can also add the stdio server from the Codex CLI:

codex mcp add wzimg --env WZIMGMCP_DATA_PATH=D:/Extract/v83 -- dotnet run --project E:/path/to/WzImg-MCP-Server/WzImgMCP.csproj

In the Codex TUI, run /mcp to confirm that wzimg is available.


Method 2: HTTP (Streamable HTTP)

The HTTP method runs the server as a standalone web service. Clients connect via HTTP requests with Server-Sent Events (SSE) for streaming responses.

# Run in HTTP mode
dotnet run --project WzImgMCP -- --http

# Or specify a custom port
dotnet run --project WzImgMCP -- --http --port 8080

Claude Code Configuration (.mcp.json):

{
  "mcpServers": {
    "wzimg": {
      "type": "http",
      "url": "http://127.0.0.1:13339/mcp",
      "env": {
        "WZIMGMCP_DATA_PATH": "D:\\Extract\\v83"
      }
    }
  }
}

Codex Configuration (~/.codex/config.toml or project-scoped .codex/config.toml):

Start the WzImg MCP Server separately, then point Codex at the HTTP endpoint:

[mcp_servers.wzimg]
url = "http://127.0.0.1:13339/mcp"

Note: When using HTTP mode, the WZIMGMCP_DATA_PATH environment variable should be set when starting the server, not in the client config. The env block above is shown for reference but is only applied by the client when spawning the server (stdio mode). For HTTP mode, set it before running the server:

# Windows
set WZIMGMCP_DATA_PATH=D:\Extract\v83
dotnet run --project WzImgMCP -- --http

# Linux/macOS
WZIMGMCP_DATA_PATH=/path/to/data dotnet run --project WzImgMCP -- --http

Using with curl (testing):

# Initialize connection (returns session ID)
curl -X POST http://127.0.0.1:13339/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{}},"id":1}'

# Call a tool
curl -X POST http://127.0.0.1:13339/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"list_categories","arguments":{}},"id":2}'

Environment Variables

VariableDescription
WZIMGMCP_DATA_PATHPath to IMG filesystem extracted by HaCreator (must contain manifest.json)
WZIMGMCP_PORTServer port for HTTP mode (default: 13339)
WZIMGMCP_TRANSPORTTransport mode: stdio (default) or http

Command Line Arguments

ArgumentDescription
--httpRun in HTTP mode instead of stdio
--port <port>Set HTTP server port (default: 13339)
--data-path <path>Set data source path

Comparison: Stdio vs HTTP

FeatureStdioHTTP
StartupLaunched per-session by clientRuns as persistent service
PerformanceLow latency (direct IPC)Slight overhead (TCP/HTTP)
Multiple clientsOne client per processMultiple concurrent clients
DebuggingHarder (subprocess)Easier (standalone process)
DeploymentEmbeddedCan run on remote server
Best forClaude Desktop, local devCI/CD, remote access, shared servers

Expected Directory Structure:

D:\Extract\v83\
├── manifest.json          # Version metadata (required)
├── Character/
│   ├── 00002000.img
│   ├── 00012000.img
│   └── ...
├── Map/
│   ├── Map0/
│   │   ├── 000010000.img
│   │   └── ...
│   └── ...
├── Mob/
├── Npc/
├── Sound/
└── ...

Architecture

┌─────────────────────────────────────────────────────────────────────────┐
│                              AI Clients                                 │
├─────────────────┬─────────────────┬─────────────────────────────────────┤
│  Claude Desktop │  Claude/Codex   │        Other MCP Clients            │
│   (subprocess)  │  (CLI/remote)   │      (custom applications)          │
└────────┬────────┴────────┬────────┴─────────────────┬───────────────────┘
         │                 │                          │
         │ stdio           │ stdio or HTTP            │ HTTP
         │                 │                          │
         ▼                 ▼                          ▼
┌─────────────────────────────────────────────────────────────────────────┐
│                           WzImg MCP Server                              │
│  ┌────────────────────────────────────────────────────────────────────┐ │
│  │                      Transport Layer                               │ │
│  │  ┌─────────────────────┐      ┌──────────────────────────────────┐ │ │
│  │  │   Stdio Transport   │      │       HTTP Transport             │ │ │
│  │  │   (stdin/stdout)    │      │   (Streamable HTTP + SSE)        │ │ │
│  │  │                     │      │   Port: 13339 (default)          │ │ │
│  │  └──────────┬──────────┘      └────────────────┬─────────────────┘ │ │
│  └─────────────┼──────────────────────────────────┼───────────────────┘ │
│                │                                  │                     │
│                └────────────────┬─────────────────┘                     │
│                                 ▼                                       │
│                    ┌─────────────────────────┐                          │
│                    │   MCP Protocol Handler  │                          │
│                    │   (JSON-RPC 2.0)        │                          │
│                    └────────────┬────────────┘                          │
│                                 ▼                                       │
│                    ┌─────────────────────────┐                          │
│                    │      Tool Classes       │                          │
│                    │   (74 tools, ToolBase)  │                          │
│                    └────────────┬────────────┘                          │
│                                 ▼                                       │
│                    ┌─────────────────────────┐                          │
│                    │   WzSessionManager      │                          │
│                    │   (cache, state)        │                          │
│                    └────────────┬────────────┘                          │
│                                 ▼                                       │
│                    ┌─────────────────────────┐                          │
│                    │       MapleLib          │                          │
│                    │    (WZ/IMG I/O)         │                          │
│                    └─────────────────────────┘                          │
└─────────────────────────────────────────────────────────────────────────┘

Core Components

ComponentDescription
ToolBaseBase class providing session validation and error handling
Result<T>Internal wrapper used by tools before Markdown rendering
WzSessionManagerManages loaded data sources and image cache
WzDataConverterConverts WZ properties to serializable formats

Response Format

All MCP tools now return Markdown text (plain string output) instead of JSON objects.

Typical success output:

- success: true
- data:
  - category: Map
  - image: 100000000.img

Typical failure output:

- success: false
- error: No data source initialized

Response Size Optimization

Tools support pagination and compact modes to minimize response size. These are enabled by default.

Pagination

Paginated responses include offset, limit, total_count, and has_more:

- total_count: 150
- offset: 0
- limit: 50
- has_more: true
- items:
  -
    - name: example

Compact Mode

compact=true (default) returns minimal fields. Set compact=false for full property metadata.

Configuration

Limits are configurable in appsettings.json:

{
  "HaMCP": {
    "ResponseLimits": {
      "MaxMarkdownResponseKB": 512,
      "MaxBase64ImageKB": 256,
      "DefaultSearchResults": 20,
      "DefaultPropertyPageSize": 50
    }
  }
}

Tool Reference

All tools accept category and image parameters unless noted. Paths use / separator (e.g., info/bgm).

File Operations

ToolDescription
init_data_sourceInitialize data source from directory containing manifest.json. Params: basePath
scan_img_directoriesScan directory for available data sources. Params: path, recursive=true
get_data_source_infoGet current data source metadata and cache stats
list_categoriesList available categories (Map, Mob, Npc, etc.)
list_images_in_categoryList .img files. Params: category, subdirectory?
get_cache_statsGet cache hit ratio and memory usage
clear_cacheClear loaded image cache

ToolDescription
get_subdirectoriesList subdirectories in a category
list_propertiesList child properties. Params: path?, compact=true, offset=0, limit=50 (max 500)
get_tree_structureGet property tree. Params: path?, depth=2 (max 5), maxChildrenPerNode=50 (max 200). Hard limit: 1000 nodes
search_by_nameSearch by name pattern (* wildcards). Params: pattern, category?, image?, compact=true, maxResults=20 (max 200)
search_by_valueSearch by value. Params: value, type?, category?, image?, compact=true, maxResults=20 (max 200)
get_property_pathGet full path of a property

Property Access

ToolDescription
get_propertyGet property with full metadata
get_property_valueGet just the value
get_stringGet string value. Params: path, defaultValue?
get_intGet integer value. Params: path, defaultValue?
get_floatGet float value. Params: path, defaultValue?
get_vectorGet vector (X, Y)
resolve_uolResolve UOL link to target property
get_childrenGet child properties. Params: path?, compact=true, offset=0, limit=50 (max 500)
get_property_countCount child properties
iterate_propertiesIterate with full metadata. Params: path?, offset=0, limit=50
get_properties_batchBatch get. Params: requests[] with {category, image, path}

Property Types: Null, Short, Int, Long, Float, Double, String, SubProperty, Canvas, Vector, Sound, UOL, Lua, Convex


Canvas Operations

ToolDescription
get_canvas_bitmapGet image as base64 PNG
get_canvas_infoGet metadata (dimensions, format, origin, delay) without image data
get_canvas_originGet draw offset point (X, Y)
get_canvas_headGet head position for character rendering
get_canvas_boundsGet lt/rb bounds
get_canvas_delayGet frame delay in milliseconds
get_animation_framesGet frames. Params: path, metadataOnly=true, offset=0, limit=5 (max 50). Returns frameCount, totalDuration, hasMore
list_canvas_in_imageList all canvases. Params: maxDepth=10
resolve_canvas_linkResolve _inlink/_outlink references

Frame structure (Markdown response):

- index: 0
- width: 100
- height: 120
- origin:
  - x: 50
  - y: 100
- delay: 120

When metadataOnly=false, each frame also includes:

- base64_png: <base64 data>

When metadataOnly=true, base64_png is omitted.


Audio Operations

ToolDescription
get_sound_infoGet metadata (duration, format, frequency)
get_sound_dataGet audio as base64
list_sounds_in_imageList all sounds. Params: maxDepth=10
resolve_sound_linkResolve UOL to sound

Export Operations

ToolDescription
export_to_mdExport property tree to Markdown and writes .md files. Params: path, maxDepth=5 (max 10), outputPath?. Error if >100KB without outputPath
export_pngExport canvas to PNG. Params: path, outputPath
export_mp3Export sound to MP3. Params: path, outputPath
export_all_imagesBatch export canvases. Params: outputPath
export_all_soundsBatch export sounds. Params: outputPath

Analysis

ToolDescription
get_statisticsGet data source statistics
get_category_summarySummarize category (image count, size)
find_broken_uolsFind broken UOL references
compare_propertiesCompare two properties. Params: source{category,image,path}, target{...}
get_version_infoGet server version
validate_imageValidate image structure

Modification

ToolDescription
set_stringSet string value
set_intSet integer value
set_floatSet float value
set_vectorSet vector. Params: path, x, y
add_propertyAdd property. Params: path, name, type, value
delete_propertyDelete property
rename_propertyRename. Params: path, newName
copy_propertyDeep copy. Params: source{...}, target{...}
set_canvas_bitmapReplace image. Params: path, base64Png
set_canvas_originSet origin. Params: path, x, y
import_pngImport PNG. Params: path, pngPath
import_soundImport audio. Params: path, soundPath
save_imageSave changes to disk
discard_changesRevert unsaved changes

Batch Operations

ToolDescription
extract_to_imgExtract WZ to IMG. Params: wzPath, outputPath
pack_to_wzPack IMG to WZ. Params: imgPath, outputPath
batch_export_imagesExport category images. Params: category, outputPath
batch_searchSearch across categories. Params: pattern, categories[], maxResults

Lifecycle

ToolDescription
parse_imageParse image into memory
unparse_imageFree image memory
is_image_parsedCheck if parsed
get_parsed_imagesList parsed images
preload_categoryPreload all images in category
unload_categoryUnload all images in category

Code Architecture

ToolBase Pattern

All tool classes extend ToolBase for consistent error handling:

public class MyTools : ToolBase
{
    public MyTools(WzSessionManager session) : base(session) { }

    [McpServerTool(Name = "my_tool")]
    public string MyTool(string param)
    {
        return Execute(() =>
        {
            // Business logic here
            return new MyData { ... };
        });
    }
}

Execute Helpers

MethodDescription
Execute<T>()Validates session, catches exceptions
ExecuteRaw<T>()No session check (for init operations)
GetImage()Get parsed WzImage
GetProperty()Get property by path
GetRequiredProperty<T>()Get typed property (throws if not found)

Result Types

// Internal result wrapper used before Markdown conversion
public class Result<T>
{
    public bool Success { get; init; }
    public string? Error { get; init; }
    public T? Data { get; init; }
}

// Common data types
public record Point2D(int X, int Y);
public record Size2D(int Width, int Height);

Project Structure

WzImgMCP/
├── Program.cs                 # Entry point
├── Core/
│   ├── Result.cs              # Generic result types
│   └── ToolBase.cs            # Base class for tools
├── Server/
│   └── WzSessionManager.cs    # Session management
├── Tools/
│   ├── FileTools.cs           # 7 tools
│   ├── NavigationTools.cs     # 6 tools
│   ├── PropertyTools.cs       # 11 tools
│   ├── ImageTools.cs          # 9 tools
│   ├── AudioTools.cs          # 4 tools
│   ├── ExportTools.cs         # 6 tools
│   ├── AnalysisTools.cs       # 6 tools
│   ├── ModifyTools.cs         # 14 tools
│   ├── BatchTools.cs          # 4 tools
│   └── LifecycleTools.cs      # 6 tools
└── Utils/
    └── WzDataConverter.cs     # Type conversion utilities

Testing

# Run unit tests
dotnet test WzImgMCP.Tests

# Test with MCP Inspector
npx @modelcontextprotocol/inspector dotnet run --project WzImgMCP

Dependencies

<PackageReference Include="ModelContextProtocol" Version="0.1.0-preview" />
<ProjectReference Include="..\MapleLib\MapleLib.csproj" />

License

MIT

Copyright (c) 2026, LastBattle https://github.com/lastbattle
 
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.