MCP server by Midi12
kaitai-mcp
MCP server for binary file format reverse engineering using Kaitai Struct.
Exposes 12 tools for binary analysis, from low-level hex inspection to structured parsing with Kaitai Struct format specifications. Works with any MCP-compatible client (Claude Desktop, Claude Code, etc.).
Tools
Binary Inspection
| Tool | Description |
|---|---|
| hex_dump | View raw bytes as hex dump with ASCII sidebar |
| file_info | File size, magic bytes, detected MIME type |
| find_strings | Extract ASCII/UTF-16 strings with offsets |
| search_bytes | Find byte patterns/signatures (supports wildcards) |
| read_as | Read typed values (u8, u16, u32, float, string, etc.) at offsets |
| entropy_analysis | Shannon entropy per block to detect compression/encryption |
| binary_diff | Compare two binary files, show difference regions |
Kaitai Struct
| Tool | Description |
|---|---|
| compile_ksy | Compile .ksy format spec to 15 target languages |
| parse_binary | Parse a binary file with a .ksy spec, return structured JSON |
| validate_ksy | Validate a .ksy spec for correctness |
Format Library
| Tool | Description |
|---|---|
| list_formats | Browse ~400 known format specs by category |
| get_format_info | Get full .ksy spec for a known format (PNG, ZIP, ELF, etc.) |
Installation
git clone --recurse-submodules https://github.com/midi12/kaitai-mcp.git
cd kaitai-mcp
npm install
npm run build
Configuration
Claude Desktop / Claude Code
Add to your MCP settings:
{
"mcpServers": {
"kaitai": {
"command": "node",
"args": ["/path/to/kaitai-mcp/dist/index.js"]
}
}
}
Example Workflow
- Identify file type:
file_infoto detect magic bytes - Browse known formats:
list_formats+get_format_infoto find a matching .ksy - Inspect raw bytes:
hex_dumpto view headers,read_asto decode specific fields - Find patterns:
search_bytesfor signatures,find_stringsfor embedded text - Analyze regions:
entropy_analysisto find compressed/encrypted sections - Parse structure:
parse_binarywith a .ksy spec for full structured output - Iterate:
validate_ksy+compile_ksyto develop custom format specs - Compare files:
binary_diffto understand format variations
Development
npm run dev # Watch mode for TypeScript compilation
npm run build # One-time build
npm start # Run the server
License
MIT