This document provides essential context for working with the Minecraft Dev MCP codebase.
This is a Model Context Protocol (MCP) server that provides AI assistants with access to decompiled Minecraft source code, registry data, and modding tools. It enables LLMs to help developers with Minecraft mod development by providing accurate, version-specific source code and game data.
- Phase 1 & 2 complete (core services, remap/decompile/search/compare) as of 2025-12-06; 29 integration tests pass end-to-end.
- Phase 3 complete (third-party mod analysis) as of 2025-12-15; includes full mod decompilation, search, and indexing capabilities with WSL support.
-
version-manager.ts - Downloads and manages Minecraft client/server JARs from Mojang
getVersionJar()- Downloads client JAR (for remapping/decompilation)getServerJar()- Downloads server JAR (for registry extraction)- Caches JARs in AppData/config directory
-
mapping-service.ts - Downloads and manages mappings (Yarn, Mojmap, Intermediary)
- Yarn: Community mappings (best for mod development)
- Mojmap: Official Mojang mappings
- Intermediary: Fabric's stable intermediate mapping format
-
remap-service.ts - Remaps obfuscated Minecraft JARs using mappings
- Uses tiny-remapper Java tool
- Converts obfuscated names → human-readable names
- Yarn requires 2-step remapping: obfuscated → intermediary → yarn
-
decompile-service.ts - Decompiles remapped JARs to Java source
- Uses VineFlower decompiler
- Produces readable Java source code
- Caches decompiled sources for reuse
-
registry-service.ts - Extracts Minecraft registry data (blocks, items, entities, etc.)
- CRITICAL: Must use SERVER JAR, not client JAR
- Uses Minecraft's built-in data generator (
--reportsflag) - Handles both modern (1.18+) and legacy (<1.18) formats
-
source-service.ts - Main orchestration service
- Coordinates version management → remapping → decompilation
- Provides
getMinecraftSource()for retrieving specific class source code - Handles caching and progress reporting
-
tiny-remapper.ts - Wraps tiny-remapper JAR for remapping obfuscated classes
- Handles namespace conversions (official → intermediary → named)
- Uses tiny-remapper 0.12.0 (multi-threaded ASM remapper)
-
vineflower.ts - Wraps VineFlower JAR for decompilation
- Creates temporary folders:
libraries/,versions/,logs/in CWD during decompilation - These are VineFlower's workspace files and should be gitignored
- Defaults align with Vineflower 1.11.2 (
-dgs=1 -hdc=0 -asc=1 -rsy=1 -lit=1)
- Creates temporary folders:
-
mc-data-gen.ts - Runs Minecraft's data generator to extract registry data
- MC 1.18+: Uses bundler format:
java -DbundlerMainClass=net.minecraft.data.Main -jar server.jar - MC <1.18: Uses legacy format:
java -cp server.jar net.minecraft.data.Main - Checks multiple locations for
registries.json:- MC 1.21+:
reports/registries.json - MC <1.21:
generated/reports/registries.json
- MC 1.21+:
- MC 1.18+: Uses bundler format:
-
java-process.ts - Low-level Java process execution wrapper
- Supports both
-jarand-cpmodes - Handles JVM args (e.g.,
-DbundlerMainClass) - Provides timeout, progress tracking, and error handling
- Supports both
-
mojang-downloader.ts - Downloads JARs and mappings from Mojang
downloadClientJar()- Client JAR (for playing/remapping)downloadServerJar()- Server JAR (for registry extraction)downloadMojangMappings()- Official Mojang mappings- All downloads include SHA-1 verification
-
yarn-downloader.ts - Downloads Yarn mappings from Fabric Maven
- Uses Maven API to find available versions
- Downloads and converts to Tiny v2 format
-
java-resources.ts - Downloads Java tool JARs (VineFlower, tiny-remapper)
- Caches in AppData/resources directory
-
cache-manager.ts - High-level cache operations
- Checks if versions/mappings/decompiled sources exist
- Returns cached paths
-
database.ts - SQLite database for metadata
- Tracks versions, mappings, decompilation jobs
- Stores access times for cache cleanup
Cache Directory Structure:
- Windows:
%APPDATA%\minecraft-dev-mcp\ - macOS:
~/Library/Application Support/minecraft-dev-mcp/ - Linux:
~/.config/minecraft-dev-mcp/
Subdirectories:
jars/- Client and server JARsminecraft_client.{version}.jarminecraft_server.{version}.jar
mappings/- Mapping files (Tiny format)remapped/- Remapped JARsdecompiled/{version}/{mapping}/- Decompiled source coderegistry/{version}/- Registry dataresources/- Java tool JARs (VineFlower, tiny-remapper)- Central cache is shared across workspaces; expect ~400–450 MB per MC version (JAR + mappings + remapped + decompiled + registry).
- ESM-only:
package.jsonmust keep"type": "module";tsconfiguses"module": "ES2022"/bundler resolution. - Local imports must include
.jsextensions after build (e.g.,./utils.js), not.ts. - No CommonJS
require; all tooling/scripts assume ES modules.
Problem Solved: Registry extraction was failing because it tried to use the remapped client JAR.
Solution:
- Always use SERVER JAR - The server JAR has the built-in data generator
- Use obfuscated JAR - Don't remap it, the server JAR runs fine obfuscated
- Handle bundler format - MC 1.18+ uses a bundler format that requires
-DbundlerMainClass
Implementation (src/services/registry-service.ts):
// Get SERVER JAR (not client!)
const serverJarPath = await this.versionManager.getServerJar(version);
// Run data generator with version-specific format
const registriesFile = await this.dataGen.generateRegistryData(
serverJarPath,
registryDir,
version // Used to detect if bundler format needed
);Registry Names:
- Use singular form:
block,item,entity(NOTblocks,items,entities) - Full names include namespace:
minecraft:block,minecraft:item - The code auto-adds
minecraft:prefix if not present
Yarn mappings require two separate remapping operations:
- Official → Intermediary: Remap from obfuscated to Fabric's stable intermediary names
- Intermediary → Yarn: Remap from intermediary to human-readable Yarn names
Why? Yarn builds on top of Intermediary to provide stable mappings across Minecraft versions.
Implementation (src/services/remap-service.ts):
// Step 1: official → intermediary
const intermediaryJar = await this.tinyRemapper.remap(
inputJar,
intermediaryPath,
intermediateMappings,
'official', 'intermediary'
);
// Step 2: intermediary → named (yarn)
const yarnJar = await this.tinyRemapper.remap(
intermediaryJar,
outputPath,
yarnMappings,
'intermediary', 'named'
);VineFlower creates these folders in the current working directory during decompilation:
libraries/- Extracted Minecraft libraries for dependency resolutionversions/- Minecraft version metadatalogs/- Decompilation logs
These are temporary and gitignored - but the actual decompiled sources go to AppData.
Tests the entire pipeline end-to-end:
- Version management (list, download)
- JAR download and caching
- Mapping download (Yarn)
- JAR remapping (Yarn 2-step process)
- Source code decompilation
- Registry extraction (blocks, items)
- MCP tool integration
- Error handling
Test Configuration (vitest.config.ts):
watch: false- Exit after tests finish (don't watch for changes)testTimeout: 600000- 10 minute timeout for long operations- Tests use version
1.21.10as the test target
Running Tests:
npm test # Runs all integration tests- Add the type to
src/types/minecraft.ts:MappingType - Create downloader in
src/downloaders/{type}-downloader.ts - Update
mapping-service.tsto handle the new type - Add test cases
- Check the Java command being executed (logged by
java-process.ts) - Verify you're using the server JAR, not client JAR
- For MC 1.18+, ensure
-DbundlerMainClass=net.minecraft.data.Mainis present - Check
registries.jsonlocation (may be inreports/orgenerated/reports/) - Verify registry names use singular form (
blocknotblocks)
The code should work automatically, but be aware:
- MC 1.18+: Requires bundler format and Java 17+
- MC 1.21+: May require Java 21+
- Registry output location may change between versions
- Always test with integration tests
- Network work uses retries/backoff; Java processes run with timeouts and stderr capture.
- Integrity checks: SHA-1/256 verification on downloads; cache rebuild on corruption.
- Security: path traversal guardrails on class names and file writes; Java processes memory-capped.
- Performance: favors lazy decompilation, parallel workers, and LRU-style cache eviction; compress/evict old versions if storage is tight.
- FabricMod-Remapper — exemplar for two-phase Yarn remapping strategy (official → intermediary → yarn).
- mojang2tiny — reference implementation for converting Mojang mappings to Tiny v2.
- tiny-remapper — upstream bytecode remapper we wrap; check changelog for behavior changes.
- Server JAR has built-in data generator (
--reportsflag) - Client JAR doesn't include data generation tools
- Server JAR can run obfuscated (no remapping needed)
- Yarn builds on Fabric's Intermediary mappings
- Intermediary provides stable names across versions
- This allows Yarn to update names without breaking between Minecraft versions
- Better Java 17+ support
- More accurate decompilation
- Better performance on large JARs
- Active maintenance
- Standard format for Fabric toolchain
- Supports multiple namespaces in one file
- Compact and efficient
- Well-supported by tools
→ Using client JAR instead of server JAR. Check registry-service.ts.
→ Ensure two-step process is happening (official → intermediary → yarn).
→ Expected VineFlower behavior. These folders are gitignored.
→ First run downloads ~50MB of JARs. Increase timeout or use cached versions.
→ MC 1.18+ requires Java 17+, MC 1.21+ requires Java 21+.
get_minecraft_source- Get decompiled source for a Minecraft classdecompile_minecraft_version- Trigger full decompilation of a versionlist_minecraft_versions- List available and cached versionsget_registry_data- Get registry data (blocks, items, entities)
remap_mod_jar- Remap Fabric mod JARs to human-readable namesfind_mapping- Lookup symbol mappings between namespacessearch_minecraft_code- Regex search in decompiled sourcecompare_versions- Compare classes/registries between versionsanalyze_mixin- Analyze and validate Mixin codevalidate_access_widener- Validate access widener filescompare_versions_detailed- AST-level version comparisonindex_minecraft_version- Create full-text search indexsearch_indexed- Fast FTS5 search on indexed versionsget_documentation- Get documentation for a classsearch_documentation- Search documentation
analyze_mod_jar- Analyze third-party mod JAR filesdecompile_mod_jar- Decompile mod JARs to readable Java sourcesearch_mod_code- Search decompiled mod source codeindex_mod- Create full-text search index for mod sourcesearch_mod_indexed- Fast FTS5 search on indexed mod source
Analyzes a mod JAR file to extract comprehensive metadata. Supports Fabric, Quilt, Forge, and NeoForge mods.
Input:
{
jarPath: string; // Local path to the mod JAR file
includeAllClasses?: boolean; // Include full class list (can be large)
includeRawMetadata?: boolean; // Include raw fabric.mod.json, mixin configs
}Output includes:
- Mod metadata: ID, version, name, description, authors, license
- Compatibility: Minecraft version, loader version, Java version, environment (client/server)
- Dependencies: Required, optional, incompatible mods with version constraints
- Entry points: Main, client, server initializers with class references
- Mixins: Config files, packages, mixin class lists (common/client/server)
- Class analysis: Total count, package breakdown, mixin detection via bytecode
- Nested JARs: Jar-in-Jar dependencies
Example usage (for LLM):
analyze_mod_jar({ jarPath: "C:/mods/meteor-client-1.21.10-32.jar" })
Returns JSON with full mod analysis including detected loader type, all dependencies, entry points, and mixin configurations.
Analyzes third-party mod JARs without requiring Java. Performs:
- Loader Detection: Checks for
fabric.mod.json,quilt.mod.json,META-INF/mods.toml - Metadata Parsing: Extracts mod ID, version, dependencies from loader-specific files
- Mixin Analysis: Parses mixin config JSON files, extracts packages and class lists
- Bytecode Analysis: Scans
.classfiles for@Mixinannotations in constant pool - Class Statistics: Counts classes per package, identifies entry points
Key types (src/types/minecraft.ts):
ModLoader:'fabric' | 'quilt' | 'forge' | 'neoforge' | 'unknown'ModAnalysisResult: Complete analysis output structureModClass: Class metadata including mixin detectionModMixinConfig: Parsed mixin configuration
Decompiles mod JARs to readable Java source code. Supports both original (intermediary) and remapped JARs.
Key features:
- Auto-detection: Automatically detects mod ID and version from JAR metadata
- Caching: Decompiled sources cached in
AppData/decompiled-mods/{modId}/{modVersion}/{mapping}/ - Progress tracking: Database-backed job tracking with progress updates
- VineFlower integration: Reuses same decompiler as Minecraft decompilation
- WSL compatibility: Full support for WSL and Windows path formats
Workflow:
remap_mod_jar- Remap mod JAR from intermediary → yarn/mojmap (optional, can skip if JAR already remapped)decompile_mod_jar- Decompile JAR to readable Java sourcesearch_mod_codeORindex_mod+search_mod_indexed- Search through decompiled source
Decompiles a mod JAR file to readable Java source code.
Input:
{
jarPath: string; // Path to mod JAR (WSL or Windows path)
mapping: 'yarn' | 'mojmap'; // Mapping type JAR uses
modId?: string; // Optional, auto-detected if not provided
modVersion?: string; // Optional, auto-detected if not provided
}Output: Decompiled source directory path, mod ID, and version
Example:
decompile_mod_jar({ jarPath: "C:/mods/meteor-remapped-yarn.jar", mapping: "yarn" })
Search for classes, methods, fields, or content in decompiled mod source code using regex patterns.
Input:
{
modId: string;
modVersion: string;
query: string; // Regex pattern or literal string
searchType: 'class' | 'method' | 'field' | 'content' | 'all';
mapping: 'yarn' | 'mojmap';
limit?: number; // Default: 50
}Example:
search_mod_code({ modId: "meteor-client", modVersion: "0.5.8", query: "onTick", searchType: "method", mapping: "yarn" })
Creates a full-text search index for decompiled mod source code using SQLite FTS5.
Input:
{
modId: string;
modVersion: string;
mapping: 'yarn' | 'mojmap';
force?: boolean; // Force re-indexing, default: false
}Benefits: Enables much faster searching via search_mod_indexed tool
Fast full-text search using pre-built mod index. Supports FTS5 syntax.
Input:
{
query: string; // FTS5 syntax: AND, OR, NOT, "phrase", prefix*
modId: string;
modVersion: string;
mapping: 'yarn' | 'mojmap';
types?: Array<'class' | 'method' | 'field'>; // Optional filter
limit?: number; // Default: 100
}Example:
search_mod_indexed({ query: "packet AND send", modId: "meteor-client", modVersion: "0.5.8", mapping: "yarn" })
The Phase 3 mod tools enable:
- Compatibility analysis: Understanding how other mods work for interop
- Learning: Studying mod development techniques from popular mods
- Debugging: Investigating mod interactions and conflicts
- Educational reference: Exploring Minecraft modding patterns
- Code search: Finding specific implementations across mod codebases