@adhisang/minecraft-modding-mcp 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -9,60 +9,54 @@
9
9
 
10
10
  ---
11
11
 
12
- `@adhisang/minecraft-modding-mcp` is an [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server that gives AI assistants deep access to Minecraft's source code, mappings, and mod tooling.
12
+ `@adhisang/minecraft-modding-mcp` is an [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server that gives AI assistants structured access to Minecraft source code, mappings, mod JARs, registry data, and validation workflows.
13
13
 
14
- It lets you explore decompiled Minecraft source, convert symbol names across four naming namespaces (`obfuscated`, `mojang`, `intermediary`, `yarn`), analyze and decompile Fabric/Forge/NeoForge mod JARs, validate Mixin and Access Widener files, read and patch NBT data, and query generated registry snapshots — all through a structured tool and resource interface designed for Claude Desktop, VS Code, and other MCP-capable clients.
14
+ [MCP](https://modelcontextprotocol.io/) is an open protocol that lets AI assistants call external tools through a structured interface. This server works with Claude Desktop, Claude Code, VS Code, Codex CLI, Gemini CLI, and other MCP-capable clients.
15
15
 
16
16
  **35 tools** (6 entry + 29 expert) | **7 resources** | **4 namespace mappings** | **SQLite-backed cache**
17
17
 
18
18
  ## Features
19
19
 
20
- - **Source Exploration** Browse and search decompiled Minecraft source code with line-level precision and cursor-paginated file listing
21
- - **Multi-Mapping Conversion** Translate class, field, and method names between `obfuscated`, `mojang`, `intermediary`, and `yarn` namespaces
22
- - **Symbol Lifecycle Tracking** Trace when a method or field first appeared, disappeared, or changed across Minecraft versions
23
- - **Mod JAR Analysis** Extract metadata, dependencies, entrypoints, and Mixin configs from Fabric/Forge/NeoForge mod JARs
24
- - **Mixin & Access Widener Validation** — Parse and validate Mixin source and `.accesswidener` files against a target Minecraft version
25
- - **NBT Round-Trip** Decode NBT binary to typed JSON, apply RFC 6902 patches, and re-encode back to NBT
26
- - **Registry Data** Query generated registry snapshots (blocks, items, entities, etc.) for any Minecraft version
27
- - **Version Comparison** Diff class signatures and registry entries between two Minecraft versions
28
- - **JAR Remapping** — Remap Fabric mod JARs from `intermediary` to `yarn` or `mojang` namespaces
29
- - **MCP Resources** — Access version lists, class source, artifact metadata, and mappings through URI-based resources
20
+ - **Source Exploration**: browse and search decompiled Minecraft source code with line-level precision and cursor-paginated file listing
21
+ - **Multi-Mapping Conversion**: translate class, field, and method names between `obfuscated`, `mojang`, `intermediary`, and `yarn`
22
+ - **Version Comparison**: diff class signatures and registry entries between Minecraft versions
23
+ - **Mod JAR Analysis**: extract metadata, dependencies, entrypoints, and Mixin configs from Fabric, Forge, and NeoForge mod JARs
24
+ - **Mixin and Access Widener Validation**: validate source and `.accesswidener` files against a target Minecraft version
25
+ - **NBT Round-Trip**: decode NBT binary to typed JSON, apply RFC 6902 patches, and encode it back to NBT
26
+ - **Registry Data and Runtime Metrics**: query generated registry snapshots and inspect cache and latency counters
27
+ - **MCP Resources**: expose versions, class source, artifact metadata, and mappings through URI-based resources
30
28
 
31
29
  ## Quick Start
32
30
 
33
- ### Prerequisites
34
- - Node.js 22+
35
- - pnpm
31
+ ### Package Users
36
32
 
37
- ### For Users (Installed Package)
38
- ```bash
39
- npx @adhisang/minecraft-modding-mcp
40
- ```
33
+ Requirements:
41
34
 
42
- ### CLI Agent Tools
35
+ - Node.js 22+
36
+ - Java is only required for `remap-mod-jar` and decompile or remap flows that need Vineflower or tiny-remapper
43
37
 
44
- #### Claude Code
38
+ Start the server locally:
45
39
 
46
40
  ```bash
47
- claude mcp add minecraft-modding -- npx -y @adhisang/minecraft-modding-mcp
48
- claude mcp list
41
+ npx -y @adhisang/minecraft-modding-mcp
49
42
  ```
50
43
 
51
- #### OpenAI Codex CLI
44
+ If automatic JAR downloads are blocked in your environment, set `MCP_VINEFLOWER_JAR_PATH` and `MCP_TINY_REMAPPER_JAR_PATH` in the client configuration.
52
45
 
53
- ```bash
54
- codex mcp add minecraft-modding -- npx -y @adhisang/minecraft-modding-mcp
55
- codex mcp list
56
- ```
46
+ ### Client Setup
57
47
 
58
- The stdio transport auto-detects both newline-delimited and `Content-Length` framing, so Codex and newline-based MCP clients can use the same server command.
48
+ CLI clients:
59
49
 
60
- The server now lazily initializes heavyweight source/index services on first MCP request, reducing initial process startup latency for clients that only perform handshake/tool discovery.
61
- To preserve handshake reliability across clients, startup does not eagerly pre-initialize `SourceService` before tool discovery.
50
+ - `Claude Code`: `claude mcp add minecraft-modding -- npx -y @adhisang/minecraft-modding-mcp`
51
+ - `OpenAI Codex CLI`: `codex mcp add minecraft-modding -- npx -y @adhisang/minecraft-modding-mcp`
62
52
 
63
- #### Gemini CLI
53
+ Run `claude mcp list` or `codex mcp list` after registration to verify the server is available.
64
54
 
65
- Add the following to `~/.gemini/settings.json`:
55
+ The stdio transport auto-detects both newline-delimited and `Content-Length` framing, so the same server command works across Codex and standard MCP clients.
56
+
57
+ #### Claude Desktop
58
+
59
+ Add the following to your `claude_desktop_config.json`:
66
60
 
67
61
  ```json
68
62
  {
@@ -75,59 +69,13 @@ Add the following to `~/.gemini/settings.json`:
75
69
  }
76
70
  ```
77
71
 
78
- Then run this command in Gemini CLI:
79
-
80
- ```text
81
- /mcp list
82
- ```
83
-
84
- ### For Developers (Repository)
85
- ```bash
86
- pnpm install
87
- ```
88
-
89
- ### Run (development)
90
- ```bash
91
- pnpm dev
92
- ```
93
-
94
- ### Build + Run (distribution shape)
95
- ```bash
96
- pnpm build
97
- pnpm start
98
- ```
99
-
100
- ### Validate
101
- ```bash
102
- pnpm check
103
- pnpm test
104
- pnpm test:coverage
105
- ```
106
-
107
- ### Coverage
108
- ```bash
109
- pnpm test:coverage
110
- ```
111
-
112
- Coverage thresholds: `lines=80`, `branches=70`, `functions=80`.
113
-
114
- Generate LCOV output for Codecov upload:
115
-
116
- ```bash
117
- pnpm test:coverage:lcov
118
- ```
119
-
120
- GitHub Actions upload workflow: `.github/workflows/codecov.yml` (temporarily disabled; when enabled, it runs on `v*` tags and manual dispatch).
121
-
122
- ### MCP Client Configuration
123
-
124
- #### Claude Desktop
72
+ #### VS Code
125
73
 
126
- Add the following to your `claude_desktop_config.json`:
74
+ Add the following to `.vscode/mcp.json` in your workspace:
127
75
 
128
76
  ```json
129
77
  {
130
- "mcpServers": {
78
+ "servers": {
131
79
  "minecraft-modding": {
132
80
  "command": "npx",
133
81
  "args": ["-y", "@adhisang/minecraft-modding-mcp"]
@@ -136,13 +84,13 @@ Add the following to your `claude_desktop_config.json`:
136
84
  }
137
85
  ```
138
86
 
139
- #### VS Code
87
+ #### Gemini CLI
140
88
 
141
- Add the following to `.vscode/mcp.json` in your workspace:
89
+ Add the following to `~/.gemini/settings.json`:
142
90
 
143
91
  ```json
144
92
  {
145
- "servers": {
93
+ "mcpServers": {
146
94
  "minecraft-modding": {
147
95
  "command": "npx",
148
96
  "args": ["-y", "@adhisang/minecraft-modding-mcp"]
@@ -151,6 +99,12 @@ Add the following to `.vscode/mcp.json` in your workspace:
151
99
  }
152
100
  ```
153
101
 
102
+ Then run:
103
+
104
+ ```text
105
+ /mcp list
106
+ ```
107
+
154
108
  #### Custom Environment
155
109
 
156
110
  Pass environment variables to override defaults:
@@ -170,35 +124,129 @@ Pass environment variables to override defaults:
170
124
  }
171
125
  ```
172
126
 
127
+ ## Start Here
128
+
129
+ These six top-level workflow tools cover the common workflows and return summary-first results, so they are the best default starting points for agents and MCP clients.
130
+
131
+ | Tool | Start here for |
132
+ | --- | --- |
133
+ | `inspect-minecraft` | versions, artifacts, classes, files, and source search |
134
+ | `analyze-symbol` | symbol existence checks, mapping conversion, lifecycle tracing, and workspace symbol resolution |
135
+ | `compare-minecraft` | version-pair diffs, class diffs, registry diffs, and migration-oriented overviews |
136
+ | `analyze-mod` | mod metadata, decompile/search flows, class source, and safe remap preview/apply |
137
+ | `validate-project` | workspace summaries plus direct Mixin and Access Widener validation |
138
+ | `manage-cache` | cache inventory, verification, and preview/apply cleanup workflows |
139
+
140
+ ### Workflow Notes
141
+
142
+ - These top-level workflow tools return `result.summary` first and include `summary.nextActions` when there is a clear follow-up step.
143
+ - `search-class-source` defaults to `queryMode="auto"` and keeps separator queries such as `foo.bar`, `foo_bar`, and `foo$bar` on the indexed path. Use `queryMode="literal"` for an explicit full substring scan.
144
+ - When a public parameter has a fixed safe default, `tools/list` exposes it through the JSON Schema `default` field.
145
+ - Error recovery `suggestedCall` payloads omit parameters when the supplied value already matches the tool default, keeping retry calls smaller without changing behavior.
146
+
147
+ ### Inspect Minecraft source from a version
148
+
149
+ ```json
150
+ {
151
+ "tool": "inspect-minecraft",
152
+ "arguments": {
153
+ "task": "class-source",
154
+ "subject": {
155
+ "kind": "class",
156
+ "className": "net.minecraft.server.Main",
157
+ "artifact": {
158
+ "type": "resolve-target",
159
+ "target": {
160
+ "kind": "version",
161
+ "value": "1.21.10"
162
+ }
163
+ }
164
+ }
165
+ }
166
+ }
167
+ ```
168
+
169
+ ### Map or check a symbol
170
+
171
+ ```json
172
+ {
173
+ "tool": "analyze-symbol",
174
+ "arguments": {
175
+ "task": "map",
176
+ "subject": {
177
+ "kind": "method",
178
+ "owner": "net.minecraft.server.Main",
179
+ "name": "tickServer"
180
+ },
181
+ "version": "1.21.10",
182
+ "sourceMapping": "mojang",
183
+ "targetMapping": "intermediary",
184
+ "signatureMode": "name-only"
185
+ }
186
+ }
187
+ ```
188
+
189
+ ### Summarize a mod JAR
190
+
191
+ ```json
192
+ {
193
+ "tool": "analyze-mod",
194
+ "arguments": {
195
+ "task": "summary",
196
+ "subject": {
197
+ "kind": "jar",
198
+ "jarPath": "/path/to/mymod-1.0.0.jar"
199
+ }
200
+ }
201
+ }
202
+ ```
203
+
204
+ ### Validate a workspace
205
+
206
+ ```json
207
+ {
208
+ "tool": "validate-project",
209
+ "arguments": {
210
+ "task": "project-summary",
211
+ "subject": {
212
+ "kind": "workspace",
213
+ "projectPath": "/workspace/modid",
214
+ "discover": ["mixins", "access-wideners"]
215
+ },
216
+ "preferProjectVersion": true,
217
+ "preferProjectMapping": true
218
+ }
219
+ }
220
+ ```
221
+
222
+ ## Documentation
223
+
224
+ - [Detailed example requests](docs/examples.md)
225
+ - [Tool and configuration reference](docs/tool-reference.md)
226
+ - [日本語 README](docs/README-ja.md)
227
+
173
228
  ## Tool Surface
174
229
 
175
- ### v3 Entry Tools
230
+ Start with these top-level workflow tools unless you already know the exact specialized operation you want. The lower-level tools remain available for narrow follow-up work and automation.
176
231
 
177
- These are the default starting points for v3 workflows. They keep the public `{ result?, error?, meta }` envelope, always return `result.summary`, and share `detail: "summary" | "standard" | "full"` plus opt-in `include[]` groups. Mutating entry tools use `executionMode: "preview" | "apply"` so preview is explicit in the public contract.
232
+ ### Top-Level Workflow Tools
178
233
 
234
+ <!-- BEGIN GENERATED TOOL TABLE: v3-entry-tools -->
179
235
  | Tool | Purpose | Key Inputs | Key Outputs |
180
236
  | --- | --- | --- | --- |
181
- | `inspect-minecraft` | Start from a version, artifact, class, file, search query, or workspace and route to the most relevant Minecraft inspection flow | `task?`, `subject?`, `detail?`, `include?`, `limit?`, `cursor?`, `includeSnapshots?` | `result.summary`, `subject`, `artifact?`, `class?`, `search?`, `file?`, `files?` |
237
+ | `inspect-minecraft` | Start from a version, artifact, class, file, search query, or workspace and route to the most relevant Minecraft inspection flow | `task?`, `subject?`, `detail?`, `include?`, `limit?`, `cursor?`, `includeSnapshots?` | `result.summary`, `versions?`, `subject`, `artifact?`, `class?`, `source?`, `members?`, `search?`, `file?`, `files?` |
182
238
  | `analyze-symbol` | One entry point for symbol existence checks, namespace mapping, lifecycle tracing, workspace symbol analysis, and API overview | `task`, `subject`, `version?`, `sourceMapping?`, `targetMapping?`, `projectPath?`, `classNameMapping?`, `signatureMode?`, `nameMode?`, `includeKinds?`, `maxRows?`, `maxCandidates?`, `detail?`, `include?` | `result.summary`, `match?`, `candidates?`, `ambiguity?`, `matrix?`, `workspace?` |
183
- | `compare-minecraft` | Compare version pairs, class signatures, registries, or produce a migration-oriented overview | `task?`, `subject`, `detail?`, `include?`, `sourcePriority?`, `maxClassResults?`, `maxEntriesPerRegistry?`, `includeFullDiff?`, `limit?` | `result.summary`, `comparison`, `classes?`, `classDiff?`, `registry?`, `migration?` |
239
+ | `compare-minecraft` | Compare version pairs, class signatures, registries, or produce a migration-oriented overview | `task?`, `subject`, `detail?`, `include?`, `subject.kind="class".sourcePriority?`, `maxClassResults?`, `maxEntriesPerRegistry?`, `includeFullDiff?`, `limit?` | `result.summary`, `comparison`, `classes?`, `classDiff?`, `registry?`, `migration?` |
184
240
  | `analyze-mod` | Metadata-first entry point for mod summary, decompile/search flows, class source, and safe remap previews/applies | `task`, `subject`, `query?`, `searchType?`, `targetMapping?`, `outputJar?`, `executionMode?`, `includeFiles?`, `maxFiles?`, `maxLines?`, `maxChars?`, `limit?`, `detail?`, `include?` | `result.summary`, `metadata?`, `decompile?`, `hits?`, `source?`, `operation?` |
185
- | `validate-project` | Project-level validation entry for workspace summaries plus direct Mixin and Access Widener validation | `task`, `subject`, `version?`, `mapping?`, `sourcePriority?`, `scope?`, `preferProjectVersion?`, `preferProjectMapping?`, `sourceRoots?`, `configPaths?`, `minSeverity?`, `hideUncertain?`, `explain?`, `warningMode?`, `warningCategoryFilter?`, `treatInfoAsWarning?`, `includeIssues?`, `detail?`, `include?` | `result.summary`, `project`, `workspace?`, `issues?`, `recovery?` |
241
+ | `validate-project` | Project-level validation entry for workspace summaries plus direct Mixin and Access Widener validation | `task`, `subject`, `version?`, `mapping?`, `sourcePriority?`, `scope?`, `preferProjectVersion?`, `preferProjectMapping?`, `sourceRoots?`, `configPaths?`, `minSeverity?`, `hideUncertain?`, `explain?`, `warningMode?`, `warningCategoryFilter?`, `treatInfoAsWarning?`, `includeIssues?`, `detail?`, `include?` | `result.summary`, `project`, `workspace?`, `issues?` |
186
242
  | `manage-cache` | User-facing cache summary, listing, verification, previewed deletion/pruning/rebuild, and explicit apply operations | `action`, `cacheKinds?`, `selector?`, `executionMode?`, `detail?`, `include?`, `limit?`, `cursor?` | `result.summary`, `stats?`, `cacheEntries?`, `operation?`, `meta.pagination.nextCursor?` |
187
-
188
- `compare-minecraft` forwards `sourcePriority` for class-diff flows, matching `diff-class-signatures`.
189
- `inspect-minecraft` also accepts `subject.kind="workspace"` with `focus.kind="class"` for `task="class-overview" | "class-source" | "class-members"` without requiring an explicit `artifact`; it resolves the artifact from the workspace version first.
190
- `compare-minecraft` summary-mode version comparisons now expose clipped class and registry samples through `meta.truncated`, including mixed `include=["classes"]` / `["registry"]` requests where the other summary-side group was clipped.
191
- When `registry-diff` can only load one side of detailed registry data, it returns `summary.status="partial"` plus recovery-oriented `nextActions` instead of failing the whole call.
192
-
193
- `manage-cache` list pagination returns `meta.pagination.nextCursor`.
194
- `selector.olderThan` accepts ISO-8601 durations such as `P30D`, `selector.status` uses the shared `healthy | partial | stale | orphaned | corrupt | in_use` vocabulary, and `jarPath` / `projectPath` matching normalizes WSL and Windows path forms before filtering.
195
-
196
- If you already know the exact low-level operation you want, the retained expert tools below are still available and remain the fastest way to do narrow follow-up work.
243
+ <!-- END GENERATED TOOL TABLE: v3-entry-tools -->
197
244
 
198
245
  ### Source Exploration
199
246
 
200
- Tools for browsing Minecraft versions, resolving source artifacts, and reading/searching decompiled source code.
247
+ Tools for browsing Minecraft versions, resolving source artifacts, and reading or searching decompiled source code.
201
248
 
249
+ <!-- BEGIN GENERATED TOOL TABLE: source-exploration -->
202
250
  | Tool | Purpose | Key Inputs | Key Outputs |
203
251
  | --- | --- | --- | --- |
204
252
  | `list-versions` | List available Minecraft versions from Mojang manifest + local cache | `includeSnapshots?`, `limit?` | `result.latest`, `result.releases[]`, `meta.warnings[]` |
@@ -210,21 +258,25 @@ Tools for browsing Minecraft versions, resolving source artifacts, and reading/s
210
258
  | `get-artifact-file` | Read full source file with byte guard | `artifactId`, `filePath`, `maxBytes?` | `content`, `contentBytes`, `truncated`, `mappingApplied`, `returnedNamespace`, `artifactContents` |
211
259
  | `list-artifact-files` | List indexed source file paths with cursor pagination | `artifactId`, `prefix?`, `limit?`, `cursor?` | `items[]`, `nextCursor?`, `mappingApplied`, `artifactContents`, `warnings[]` |
212
260
  | `index-artifact` | Rebuild index metadata for an existing artifact | `artifactId`, `force?` | `reindexed`, `reason`, `counts`, `indexedAt`, `durationMs` |
261
+ <!-- END GENERATED TOOL TABLE: source-exploration -->
213
262
 
214
263
  ### Version Comparison & Symbol Tracking
215
264
 
216
- Tools for comparing class/registry changes across Minecraft versions and tracing symbol existence over time.
265
+ Tools for comparing class and registry changes across Minecraft versions and tracing symbol existence over time.
217
266
 
267
+ <!-- BEGIN GENERATED TOOL TABLE: version-comparison-symbol-tracking -->
218
268
  | Tool | Purpose | Key Inputs | Key Outputs |
219
269
  | --- | --- | --- | --- |
220
270
  | `trace-symbol-lifecycle` | Trace when `Class.method` exists across Minecraft versions (`descriptor` omitted = name-only lookup) | `symbol`, `descriptor?`, `fromVersion?`, `toVersion?`, `mapping?`, `sourcePriority?`, `includeSnapshots?`, `maxVersions?`, `includeTimeline?` | `presence.firstSeen`, `presence.lastSeen`, `presence.missingBetween[]`, `presence.existsNow`, `timeline?`, `warnings[]` |
221
271
  | `diff-class-signatures` | Compare one class between two versions and return member deltas | `className`, `fromVersion`, `toVersion`, `mapping?`, `sourcePriority?`, `includeFullDiff?` | `classChange`, `constructors/methods/fields.{added,removed,modified}`, `modified`, `modified[].{key,changed,from?,to?}`, `summary`, `warnings[]` |
222
272
  | `compare-versions` | Compare class/registry changes between two versions | `fromVersion`, `toVersion`, `category?`, `packageFilter?`, `maxClassResults?` | `classes`, `registry`, `summary`, `warnings[]` |
273
+ <!-- END GENERATED TOOL TABLE: version-comparison-symbol-tracking -->
223
274
 
224
275
  ### Mapping & Symbols
225
276
 
226
277
  Tools for converting symbol names between namespaces and checking symbol existence.
227
278
 
279
+ <!-- BEGIN GENERATED TOOL TABLE: mapping-symbols -->
228
280
  | Tool | Purpose | Key Inputs | Key Outputs |
229
281
  | --- | --- | --- | --- |
230
282
  | `find-mapping` | Find mapping candidates for class/field/method symbols between namespaces | `version`, `kind`, `name`, `owner?`, `descriptor?`, `sourceMapping`, `targetMapping`, `sourcePriority?`, `disambiguation?`, `maxCandidates?` | `querySymbol`, `mappingContext`, `resolved`, `status`, `resolvedSymbol?`, `candidates[]`, `candidateCount`, `candidatesTruncated?`, `ambiguityReasons?`, `provenance?`, `meta.warnings[]` |
@@ -232,21 +284,25 @@ Tools for converting symbol names between namespaces and checking symbol existen
232
284
  | `get-class-api-matrix` | Show one class API as a mapping matrix (`obfuscated/mojang/intermediary/yarn`) | `version`, `className`, `classNameMapping`, `includeKinds?`, `sourcePriority?`, `maxRows?` | `classIdentity`, `rows[]`, `rowCount`, `rowsTruncated?`, `ambiguousRowCount?`, `meta.warnings[]` |
233
285
  | `resolve-workspace-symbol` | Resolve compile-visible symbol names for a Gradle workspace (`build.gradle/.kts`) | `projectPath`, `version`, `kind`, `name`, `owner?`, `descriptor?`, `sourceMapping`, `sourcePriority?`, `maxCandidates?` | `querySymbol`, `mappingContext`, `resolved`, `status`, `resolvedSymbol?`, `candidates[]`, `candidateCount`, `candidatesTruncated?`, `workspaceDetection`, `meta.warnings[]` |
234
286
  | `check-symbol-exists` | Strict symbol presence check for class/field/method | `version`, `kind`, `name`, `owner?`, `descriptor?`, `sourceMapping`, `sourcePriority?`, `nameMode?`, `signatureMode?`, `maxCandidates?` | `querySymbol`, `mappingContext`, `resolved`, `status`, `resolvedSymbol?`, `candidates[]`, `candidateCount`, `candidatesTruncated?`, `meta.warnings[]` |
287
+ <!-- END GENERATED TOOL TABLE: mapping-symbols -->
235
288
 
236
289
  ### NBT Utilities
237
290
 
238
291
  Tools for decoding, patching, and encoding Java Edition NBT binary data using a typed JSON representation.
239
292
 
293
+ <!-- BEGIN GENERATED TOOL TABLE: nbt-utilities -->
240
294
  | Tool | Purpose | Key Inputs | Key Outputs |
241
295
  | --- | --- | --- | --- |
242
296
  | `nbt-to-json` | Decode Java Edition NBT binary (`base64`) to typed JSON | `nbtBase64`, `compression?` (`none`, `gzip`, `auto`) | `typedJson`, `meta.compressionDetected`, `meta.inputBytes` |
243
297
  | `nbt-apply-json-patch` | Apply RFC 6902 patch (`add/remove/replace/test`) to typed NBT JSON | `typedJson`, `patch` | `typedJson`, `meta.appliedOps`, `meta.testOps`, `meta.changed` |
244
298
  | `json-to-nbt` | Encode typed JSON back to Java Edition NBT binary (`base64`) | `typedJson`, `compression?` (`none`, `gzip`) | `nbtBase64`, `meta.outputBytes`, `meta.compressionApplied` |
299
+ <!-- END GENERATED TOOL TABLE: nbt-utilities -->
245
300
 
246
301
  ### Mod Analysis
247
302
 
248
303
  Tools for extracting metadata from mod JARs, decompiling mod source, searching mod code, and remapping mod namespaces.
249
304
 
305
+ <!-- BEGIN GENERATED TOOL TABLE: mod-analysis -->
250
306
  | Tool | Purpose | Key Inputs | Key Outputs |
251
307
  | --- | --- | --- | --- |
252
308
  | `analyze-mod-jar` | Extract mod metadata/dependencies/entrypoints from mod JAR | `jarPath`, `includeClasses?` | `modId`, `loader`, `jarKind`, `dependencies`, `entrypoints`, `mixinConfigs`, class stats |
@@ -254,769 +310,106 @@ Tools for extracting metadata from mod JARs, decompiling mod source, searching m
254
310
  | `get-mod-class-source` | Read one class source from decompiled mod cache | `jarPath`, `className`, `maxLines?`, `maxChars?`, `outputFile?` | `className`, `content`, `totalLines`, `truncated?`, `charsTruncated?`, `outputFilePath?`, `warnings[]` |
255
311
  | `search-mod-source` | Search decompiled mod source by class/method/field/content | `jarPath`, `query`, `searchType?`, `limit?` | `hits[]`, `totalHits`, `truncated`, `warnings[]` |
256
312
  | `remap-mod-jar` | Remap a Fabric/Quilt mod JAR to yarn/mojang names; Mojang-mapped inputs are copied for `targetMapping="mojang"` | `inputJar`, `targetMapping`, `mcVersion?`, `outputJar?` | `outputJar`, `mcVersion`, `fromMapping`, `targetMapping`, `resolvedTargetNamespace`, `warnings[]` |
313
+ <!-- END GENERATED TOOL TABLE: mod-analysis -->
257
314
 
258
315
  ### Validation
259
316
 
260
317
  Tools for validating Mixin source and Access Widener files against a target Minecraft version.
261
318
 
319
+ <!-- BEGIN GENERATED TOOL TABLE: validation -->
262
320
  | Tool | Purpose | Key Inputs | Key Outputs |
263
321
  | --- | --- | --- | --- |
264
322
  | `validate-mixin` | Parse/validate Mixin source against target Minecraft version | `input`, `sourceRoots?`, `version`, `mapping?`, `sourcePriority?`, `projectPath?`, `scope?`, `preferProjectVersion?`, `minSeverity?`, `hideUncertain?`, `warningMode?`, `preferProjectMapping?`, `reportMode?`, `warningCategoryFilter?`, `treatInfoAsWarning?`, `explain?`, `includeIssues?` | `mode`, `results[].validationStatus`, `summary.partial`, `issueSummary?`, `provenance?`, `incompleteReasons?`, `toolHealth?`, `confidenceScore?`, `confidenceBreakdown?` |
265
323
  | `validate-access-widener` | Parse/validate Access Widener content against target version | `content`, `version`, `mapping?`, `sourcePriority?` | `valid`, `issues[]`, `warnings[]`, `summary` |
324
+ <!-- END GENERATED TOOL TABLE: validation -->
266
325
 
267
326
  ### Registry & Diagnostics
268
327
 
269
328
  Tools for querying generated registry data and inspecting server runtime state.
270
329
 
330
+ <!-- BEGIN GENERATED TOOL TABLE: registry-diagnostics -->
271
331
  | Tool | Purpose | Key Inputs | Key Outputs |
272
332
  | --- | --- | --- | --- |
273
333
  | `get-registry-data` | Get generated registry snapshots (blocks/items/entities etc.) | `version`, `registry?`, `includeData?`, `maxEntriesPerRegistry?` | `registries`, `data?`, `entryCount`, `returnedEntryCount?`, `registryEntryCounts?`, `dataTruncated?`, `warnings[]` |
274
334
  | `get-runtime-metrics` | Inspect runtime counters and latency snapshots | none | `result.*` runtime metrics, `meta` envelope |
335
+ <!-- END GENERATED TOOL TABLE: registry-diagnostics -->
275
336
 
276
- ### Tool Constraints
277
-
278
- `resolve-artifact` now takes `target: { kind, value }`.
279
- `get-class-source` requires `target`, where `target.type="artifact"` selects a previously resolved `artifactId` and `target.type="resolve"` supplies `{ kind, value }` directly.
280
- `get-class-members` requires the same `target` object shape and still needs a binary jar (`binaryJarPath`) to read `.class` entries.
281
- `get-class-members` returns `ERR_INVALID_INPUT` when a classfile contains malformed field or method descriptors instead of emitting malformed Java signature text from corrupted bytecode.
282
- Malformed `void` usage outside method return positions is rejected with descriptor-specific errors, so invalid method arguments now report as method descriptor failures instead of field descriptor failures.
283
- Error `suggestedCall` payloads now use the same `target` object schema instead of legacy `targetKind` / `targetValue` fields.
284
- Positive integer tool parameters accept numeric strings such as `"10"` in addition to JSON numbers.
285
- This numeric-string coercion only applies to documented top-level tool arguments; nested `typedJson` payloads and JSON Patch `value` objects are preserved verbatim.
286
- `resolve-artifact`, `get-class-source`, `get-class-members`, `search-class-source`, `get-artifact-file`, and `list-artifact-files` include `artifactContents` so clients can see whether the backing artifact is `source-jar` or `decompiled-binary`, whether resources are indexed (`resourcesIncluded=false` today), and whether source coverage is always `full` or `partial`.
287
- `get-class-source`, `get-class-members`, `search-class-source`, and `get-artifact-file` include `returnedNamespace`; compare it with `mappingApplied` when a tool returns remapped symbols instead of raw indexed source text.
288
- `list-artifact-files` warns when you probe `assets/` or `data/` prefixes because the current index stores Java source only, not non-Java resources.
289
- `get-class-source` and `get-class-members` can infer a missing artifact version from `projectPath` when `preferProjectVersion=true` and artifact metadata does not already contain a version.
290
- Heavy analysis tools (`trace-symbol-lifecycle`, `diff-class-signatures`, `compare-versions`, `find-mapping`, `resolve-method-mapping-exact`, `get-class-api-matrix`, `get-registry-data`) are serialized inside the server to protect stdio transport stability; when the queue is full they fail fast with `ERR_LIMIT_EXCEEDED`.
291
- The CLI stdio entrypoint now runs a supervised worker process. If the worker exits unexpectedly, the wrapper restarts it, replays MCP initialization for the current session, and keeps the same stdio connection usable; any request that was already in flight fails with a retryable JSON-RPC internal error instead of tearing down the whole transport.
292
- `find-mapping`, `resolve-method-mapping-exact`, `resolve-workspace-symbol`, and `check-symbol-exists` accept `maxCandidates` to cap `candidates[]`; `candidateCount` always reports the full pre-truncation candidate total and `candidatesTruncated=true` signals clipping.
293
- `get-class-api-matrix` accepts `maxRows`; `rowCount` reports the full pre-truncation row total and `rowsTruncated=true` signals clipping.
294
- `diff-class-signatures` supports `includeFullDiff=false` to omit `from`/`to` snapshots from `modified[]` entries and keep only `key` plus `changed`.
295
- `validate-mixin` requires `input.mode` to be exactly one of `inline`, `path`, `paths`, `config`, or `project`. `input.path`/`input.paths[]` are normalized for host/WSL path formats before file reads. `input.configPaths[]` reads mixin config JSON files and auto-discovers source files for batch validation (`sourceRoots[]` override lookup roots; otherwise common roots like `src/main/java`, `src/client/java`, `common/src/{main,client}/java`, `fabric/src/{main,client}/java`, `neoforge/src/{main,client}/java`, `forge/src/{main,client}/java`, and `quilt/src/{main,client}/java` are auto-detected from configured mixin classes). `input.mode="project"` recursively discovers `**/*.mixins.json` under `input.path`, then runs the same config-driven batch validation with `projectPath` defaulting to that workspace root.
296
- `validate-mixin` always returns `mode`, `results[]`, and `summary`; single-input modes still use a one-element `results[]` array.
297
- `validate-mixin` supports `includeIssues=false` for summary-first workflows that do not need per-result `issues[]`; combine it with `reportMode=compact` and `warningMode=aggregated` to keep responses small.
298
- `reportMode=summary-first` hoists shared provenance, warnings, and incomplete-reason summaries to the top level while trimming duplicate per-result metadata.
299
- `validate-mixin` per-result responses now include `validationStatus` (`full`, `partial`, `invalid`) plus `summary.membersValidated`, `summary.membersSkipped`, and `summary.membersMissing`; `quickSummary` now includes member coverage counts instead of only issue counts.
300
- `validate-mixin` batch `summary` now includes `partial` so callers can distinguish fully clean results from tool-limited-but-non-failing results.
301
- `validate-mixin` now reports `validation-incomplete` when target metadata cannot be loaded reliably, instead of misclassifying those tool-limited cases as confirmed missing classes.
302
- `validate-mixin` responses now include `confidenceBreakdown` alongside `confidenceScore`, exposing the base score plus the penalties that lowered confidence.
303
- `validate-mixin` per-result responses include `provenance.resolutionNotes?` when mapping fallback occurs.
304
- `validate-mixin` provenance now exposes `requestedScope` / `appliedScope` and `requestedSourcePriority` / `appliedSourcePriority` so fallback and retry behavior is explicit.
305
- `scope="loader"` currently resolves the same artifact class as `scope="merged"`; keep using `scope` to declare intent, but expect the same underlying lookup path today.
306
- For non-vanilla scopes such as `scope="merged"`, `validate-mixin` now performs bytecode lookup in the resolved artifact namespace before remapping members back to the requested namespace, so Mojang-mapped Loom workspaces validate against merged class names instead of reporting false partial results.
307
- `validate-mixin` automatically retries with `sourcePriority="maven-first"` after a partial `loom-first` validation caused by mapping/signature resolution limits, and records that retry in warnings plus provenance notes.
308
- `validate-mixin` validates `@Invoker` targets against methods only and `@Accessor` targets against fields only.
309
- `validate-mixin` parser supports both `.class` literal targets and `targets = "..."` / `targets = {"a", "b"}` string forms.
310
- `validate-mixin` parser handles multi-line annotations between `@Shadow`/`@Accessor` and declarations, and strips inline annotations from declaration lines.
311
- `validate-mixin` distinguishes `target-mapping-failed` (warning, uncertain) from `target-not-found` (error) when class mapping fails.
312
- `validate-mixin` issues and `structuredWarnings` include `category` (`mapping`, `configuration`, `validation`, `resolution`, or `parse`) to distinguish setup/tooling/parser limits from real validation errors.
313
- `validate-mixin` supports post-filtering with `minSeverity`, `hideUncertain`, and `warningCategoryFilter`; `treatInfoAsWarning=false` suppresses info-level entries in `structuredWarnings`.
314
- `validate-mixin` per-result responses include `resolvedMembers?` tracking each member's resolution status (`resolved` or `not-found`).
315
- `validate-mixin` with `explain=true` enriches each issue with `explanation` and `suggestedCall` (tool + params) for agent-driven recovery; generated `check-symbol-exists` recovery payloads now stay within that tool's public schema.
316
- Schema validation failures now also return the standard `ERR_INVALID_INPUT` envelope with `fieldErrors`, `hints`, and a mode-correct `suggestedCall` for common `validate-mixin` mistakes such as passing raw source text directly as `input`.
317
- Bare string `target` values now return `ERR_INVALID_INPUT` with a schema-correct `suggestedCall` wrapper for `resolve-artifact`, `get-class-source`, and `get-class-members`.
318
- `validate-mixin` summary uses `processingErrors`, `totalValidationErrors`, and `totalValidationWarnings`; the deprecated `summary.errors` field was removed.
319
- `check-symbol-exists` suppresses raw `No Loom tiny mapping files matched version ...` noise when Maven tiny mappings successfully satisfy the lookup; successful fallback now reports a single concise warning instead of repeating the Loom miss on every result.
320
- `resolve-artifact` with `target.kind=version` uses Loom cache discovery from `projectPath` only when `mapping=mojang`; mapping failures include `searchedPaths`, `candidateArtifacts`, and `recommendedCommand` in error details.
321
- `resolve-artifact` supports `scope` (`vanilla`/`merged`/`loader`) and optional `preferProjectVersion=true` to override `target.value` from `gradle.properties` (`minecraft_version`, `mc_version`, `minecraftVersion`) when `target.kind=version`.
322
- `resolve-artifact` with `target.kind=coordinate` searches the local Maven repository, the local Gradle `modules-2` cache, and configured `MCP_SOURCE_REPOS` before reporting `ERR_SOURCE_NOT_FOUND`.
323
- `resolve-artifact`, `get-class-source`, and `get-class-members` now preserve `ERR_JAR_NOT_FOUND` for missing or inaccessible `target.kind=jar` paths instead of surfacing raw filesystem exceptions.
324
- `resolve-artifact` includes `sampleEntries` only when a source JAR is resolved; decompile-only paths leave it unset.
325
- `resolve-artifact` adds `qualityFlags=["partial-source-no-net-minecraft"]` and a warning when a merged Loom source candidate does not contain `net.minecraft` sources; only candidates that still look like Minecraft source artifacts are auto-selected, while version-matching mod/library source jars remain diagnostics only. `get-class-source` now bypasses that sibling `*-sources.jar` during binary fallback so the fallback can actually reach the binary artifact.
326
- `find-class` returns type symbols (`class`/`interface`/`enum`/`record`) only; fully-qualified lookups are filtered by exact FQCN/file path to avoid false negatives when many classes share the same simple name.
327
- `find-class` returns an explanatory warning when an `obfuscated` artifact is queried with names that look like deobfuscated Mojang classes.
328
- `find-class` suppresses non-vanilla matches for vanilla-looking queries on artifacts flagged with `partial-source-no-net-minecraft`; in that situation it returns a warning instead of unrelated modded classes.
329
- `search-class-source` uses `limit: 20` by default.
330
- `search-class-source` `queryMode` controls text search strategy: `auto` (default) uses indexed token search with literal fallback for separator queries, `token` keeps indexed token behavior only, and `literal` uses substring scan only.
331
- `search-class-source` with `match=regex` enforces `query.length <= 200` and a strict result cap of `100`.
332
- `search-class-source` now returns compact file hits without snippets, line windows, relation expansion, or `totalApprox`.
333
- Use `get-artifact-file` or `get-class-source` to inspect returned files after search.
334
- `search-class-source` `symbolKind` is only supported when `intent=symbol`.
335
- `get-artifact-file` byte truncation now preserves UTF-8 character boundaries, preventing replacement-character (`�`) corruption when `maxBytes` cuts through multibyte text.
336
- `search-class-source` `fileGlob` supports `*`, `**`, and `?`; recursive patterns such as `net/minecraft/**/*.java` are supported.
337
- `get-class-source` fallback matching enforces package compatibility and returns `ERR_CLASS_NOT_FOUND` when only name-colliding classes from other packages exist.
338
- `get-class-source` now falls back to the sibling binary artifact when a source-backed artifact is only partial (for example, merged Loom sources without `net.minecraft` entries); if that fallback still cannot produce source, the error now carries the partial-source context and suggests `get-class-api-matrix` instead of `find-class`.
339
- `get-class-source` warns when fallback source text is returned in a different namespace than the requested mapping; the source text itself is not remapped.
340
- `get-class-source` mode defaults to `metadata` (symbol outline only); `mode=snippet` auto-sets `maxLines=200` when no line range/max is provided; `mode=full` returns the entire source. `outputFile` writes the selected text and returns the file path in `outputFile`.
341
- Decompile fallback for `resolve-artifact`/`get-class-source` now invokes Vineflower with flags before positional `<input-jar> <output-dir>` arguments to avoid false `ERR_DECOMPILER_FAILED` outcomes on valid jars.
342
- `resolve-artifact` with `target.kind=jar` only auto-adopts the exact sibling `"<jar-basename>-sources.jar"`. Other adjacent `*-sources.jar` files are returned as `adjacentSourceCandidates` info only and are never auto-selected.
343
- When a resolved artifact comes from a `*-sources.jar`, `get-class-members` now keeps the sibling binary jar (for example `minecraft-merged-<version>.jar`) instead of treating the source jar as bytecode, and it now looks up the class in the resolved artifact namespace before remapping member names back to the requested mapping.
344
- For `target.kind=coordinate` with a classifier (`group:artifact:version:classifier`), local Maven source lookup checks `<artifact>-<version>-<classifier>-sources.jar` first and then `<artifact>-<version>-sources.jar`.
345
- Mod tool `jarPath` inputs are normalized to a canonical local `.jar` file path before existence checks, cache keying, and processing.
346
- `search-mod-source` enforces `query.length <= 200` and `limit <= 200`.
347
- `search-mod-source` detects source-only jars and searches `.java` entries directly without decompilation.
348
- `get-mod-class-source` supports `maxLines`, `maxChars`, and `outputFile` with truncation behavior aligned to `get-class-source`; when `outputFile` is set, the written file reflects applied truncation.
349
- `decompile-mod-jar` supports `includeFiles=false` to skip the full class list and `maxFiles` to cap it when you only need counts or a sample. `returnedFileCount`, `filesTruncated`, and `filesOmitted` make the shaping explicit.
350
- `find-mapping` returns `ambiguityReasons` when `status=ambiguous` to explain why candidates could not be uniquely resolved.
351
- `get-class-api-matrix` returns `ambiguousRowCount` when one or more rows required ambiguity fallback.
352
- `check-symbol-exists` defaults to strict FQCN class inputs; set `nameMode=auto` to allow short class names (ambiguous matches return `status=ambiguous`).
353
- `check-symbol-exists` supports `signatureMode=name-only` to match methods by owner+name without requiring a descriptor. Single match returns `resolved`; multiple overloads return `ambiguous` with all candidates.
354
- `check-symbol-exists` always validates input shape first and returns `ERR_INVALID_INPUT` for invalid symbol combinations, even when mapping data is unavailable.
355
- `get-registry-data` now discards corrupt cached `registries.json` files, regenerates them when possible, and returns `ERR_REGISTRY_GENERATION_FAILED` if the regenerated snapshot is still unreadable.
356
- `get-registry-data` supports `includeData=false` to return registry names and counts without full entry bodies. `maxEntriesPerRegistry` caps returned entries per registry while preserving full `entryCount` and `registryEntryCounts`.
357
- Migration notes:
358
- - Start with `inspect-minecraft` for version/artifact/class/file/search workflows before dropping to `list-versions`, `resolve-artifact`, `get-class-source`, `get-class-members`, `search-class-source`, `get-artifact-file`, or `list-artifact-files`.
359
- - Start with `analyze-symbol` for symbol mapping/existence/lifecycle/workspace questions before using `find-mapping`, `resolve-method-mapping-exact`, `check-symbol-exists`, `trace-symbol-lifecycle`, `resolve-workspace-symbol`, or `get-class-api-matrix` directly.
360
- - Start with `compare-minecraft` for version-pair, class diff, registry diff, and migration-summary flows before using `compare-versions`, `diff-class-signatures`, or `get-registry-data` directly.
361
- - Start with `analyze-mod` for metadata-first mod inspection and safe remap previews/applies before using `analyze-mod-jar`, `decompile-mod-jar`, `get-mod-class-source`, `search-mod-source`, or `remap-mod-jar` directly.
362
- - Start with `validate-project` for workspace summaries and direct Mixin / Access Widener validation before using `validate-mixin` or `validate-access-widener` directly.
363
- - Start with `manage-cache` for cache inventory and safe cleanup; use `executionMode="preview"` to inspect deletion/prune/rebuild impact before `executionMode="apply"`.
364
- - Replace `resolve-artifact` `targetKind` + `targetValue` with `target: { kind, value }`.
365
- - Replace `get-class-source` / `get-class-members` top-level `artifactId` / `targetKind` / `targetValue` with `target: { type: "artifact", artifactId }` or `target: { type: "resolve", kind, value }`.
366
- - `resolve-method-mapping-exact` is method-only and no longer accepts `kind`.
367
- - Replace `validate-mixin` `source` / `sourcePath` / `sourcePaths` / `mixinConfigPath` / `sourceRoot` with `input.mode` plus `input.source` / `input.path` / `input.paths[]` / `input.configPaths[]` and `sourceRoots[]`. Use `input.mode="project"` when you want to discover `*.mixins.json` automatically from a workspace root. Use `summary.processingErrors` instead of `summary.errors`.
368
- - `search-class-source` removed `snippetLines`, `includeDefinition`, and `includeOneHop`; responses now contain compact `hits[]` plus `nextCursor?` only, and `symbolKind` may only be used with `intent=symbol`.
369
- `remap-mod-jar` requires Java to be installed and only supports Fabric/Quilt mods.
370
- Mojang-mapped inputs can be returned as-is for `targetMapping="mojang"`. `targetMapping="yarn"` still expects an intermediary-built input jar.
337
+ Detailed parameter constraints, migration notes, resource behavior, and the full environment-variable matrix live in [docs/tool-reference.md](docs/tool-reference.md).
371
338
 
372
339
  ## Resources
373
340
 
374
- MCP resources provide URI-based access to Minecraft data, usable by any MCP client that supports the resource protocol.
375
-
376
- ### Fixed Resources
377
-
378
- | Resource | URI | Description |
379
- | --- | --- | --- |
380
- | `versions-list` | `mc://versions/list` | List all available Minecraft versions with their metadata |
381
- | `runtime-metrics` | `mc://metrics` | Runtime metrics and performance counters for the MCP server |
382
-
383
- ### Template Resources
384
-
385
- | Resource | URI Template | Description |
386
- | --- | --- | --- |
387
- | `class-source` | `mc://source/{artifactId}/{className}` | Java source code for a class within a resolved artifact |
388
- | `artifact-file` | `mc://artifact/{artifactId}/files/{filePath}` | Raw content of a file within a resolved artifact |
389
- | `find-mapping` | `mc://mappings/{version}/{sourceMapping}/{targetMapping}/{kind}/{name}` | Look up a mapping between two naming namespaces |
390
- | `class-members` | `mc://artifact/{artifactId}/members/{className}` | List constructors, methods, and fields for a class |
391
- | `artifact-metadata` | `mc://artifact/{artifactId}` | Metadata for a previously resolved artifact |
392
-
393
- `versions-list`, `runtime-metrics`, `find-mapping`, `class-members`, and `artifact-metadata` return structured JSON envelopes on success (`{ result, meta }`) and failure (`{ error, meta }`).
394
- `class-source` and `artifact-file` keep raw text responses on success, but still return structured JSON errors on failure.
395
-
396
- ## Response Envelope
397
-
398
- All tools return exactly one of:
399
-
400
- - Success: `{ result: { ... }, meta: { requestId, tool, durationMs, warnings[] } }`
401
- - Failure: `{ error: { type, title, detail, status, code, instance, fieldErrors?, hints? }, meta: { requestId, tool, durationMs, warnings[] } }`
402
-
403
- JSON resources follow the same `result/error/meta` pattern. Text resources return plain text on success.
404
- The same JSON envelope is mirrored in MCP `structuredContent` for SDK-aware clients, and failures also set `isError=true`.
405
-
406
- ## Examples
407
-
408
- ### Source Exploration
409
-
410
- #### Resolve from Minecraft version
411
- ```json
412
- {
413
- "tool": "resolve-artifact",
414
- "arguments": {
415
- "target": {
416
- "kind": "version",
417
- "value": "1.21.10"
418
- },
419
- "mapping": "obfuscated",
420
- "allowDecompile": true,
421
- "projectPath": "/path/to/mod/workspace"
422
- }
423
- }
424
- ```
425
-
426
- #### Get class source with line window
427
- ```json
428
- {
429
- "tool": "get-class-source",
430
- "arguments": {
431
- "target": {
432
- "type": "artifact",
433
- "artifactId": "<artifact-id>"
434
- },
435
- "className": "net.minecraft.server.Main",
436
- "startLine": 50,
437
- "endLine": 180,
438
- "maxLines": 80
439
- }
440
- }
441
- ```
442
-
443
- #### Search by method symbol
444
- ```json
445
- {
446
- "tool": "search-class-source",
447
- "arguments": {
448
- "artifactId": "<artifact-id>",
449
- "query": "tickServer",
450
- "intent": "symbol",
451
- "match": "exact"
452
- }
453
- }
454
- ```
455
-
456
- #### Get class member list
457
- ```json
458
- {
459
- "tool": "get-class-members",
460
- "arguments": {
461
- "artifactId": "<artifact-id>",
462
- "className": "net.minecraft.server.Main",
463
- "mapping": "obfuscated",
464
- "access": "all",
465
- "includeInherited": true,
466
- "maxMembers": 300
467
- }
468
- }
469
- ```
470
-
471
- #### List artifact files with prefix filter
472
-
473
- List source files under a specific package to understand project structure:
474
-
475
- ```json
476
- {
477
- "tool": "list-artifact-files",
478
- "arguments": {
479
- "artifactId": "<artifact-id>",
480
- "prefix": "net/minecraft/world/level/",
481
- "limit": 50
482
- }
483
- }
484
- ```
485
-
486
- ### Version Comparison & Symbol Tracking
341
+ Fixed resources:
487
342
 
488
- #### Trace `Class.method` lifecycle
489
- ```json
490
- {
491
- "tool": "trace-symbol-lifecycle",
492
- "arguments": {
493
- "symbol": "net.minecraft.server.Main.tickServer",
494
- "descriptor": "()V",
495
- "fromVersion": "1.20.1",
496
- "toVersion": "1.21.10",
497
- "includeTimeline": true
498
- }
499
- }
500
- ```
343
+ - `mc://versions/list`
344
+ - `mc://metrics`
501
345
 
502
- #### Diff one class across two versions
503
- ```json
504
- {
505
- "tool": "diff-class-signatures",
506
- "arguments": {
507
- "className": "net.minecraft.server.Main",
508
- "fromVersion": "1.20.1",
509
- "toVersion": "1.21.10",
510
- "mapping": "obfuscated",
511
- "includeFullDiff": false
512
- }
513
- }
514
- ```
346
+ Template resources:
515
347
 
516
- #### Compare two Minecraft versions
348
+ - `mc://source/{artifactId}/{className}`
349
+ - `mc://artifact/{artifactId}/files/{filePath}`
350
+ - `mc://mappings/{version}/{sourceMapping}/{targetMapping}/{kind}/{name}`
351
+ - `mc://artifact/{artifactId}/members/{className}`
352
+ - `mc://artifact/{artifactId}`
517
353
 
518
- Get a high-level summary of what changed between two releases, including class additions/removals and registry diffs:
354
+ See [docs/tool-reference.md#resources](docs/tool-reference.md#resources) for the full resource table and response behavior.
519
355
 
520
- ```json
521
- {
522
- "tool": "compare-versions",
523
- "arguments": {
524
- "fromVersion": "1.20.4",
525
- "toVersion": "1.21.10",
526
- "category": "all",
527
- "packageFilter": "net.minecraft.world",
528
- "maxClassResults": 100
529
- }
530
- }
531
- ```
356
+ ## Response Model
532
357
 
533
- Registry deltas are returned under `result.registry` (not `registryDiff`).
534
- When `packageFilter` is provided, `result.classes.addedCount`, `removedCount`, and `unchanged`
535
- are all scoped to that filtered package set.
358
+ Tools and JSON resources return the standard `{ result?, error?, meta }` envelope. Text resources (`class-source` and `artifact-file`) return raw text on success and structured JSON on failure.
536
359
 
537
- ### Mapping & Symbols
360
+ See [docs/tool-reference.md#response-envelope](docs/tool-reference.md#response-envelope) for the exact envelope fields and error shape.
538
361
 
539
- #### Lookup mapping candidates
540
- ```json
541
- {
542
- "tool": "find-mapping",
543
- "arguments": {
544
- "version": "1.21.10",
545
- "kind": "class",
546
- "name": "a.b.C",
547
- "sourceMapping": "obfuscated",
548
- "targetMapping": "mojang",
549
- "sourcePriority": "loom-first",
550
- "maxCandidates": 10,
551
- "disambiguation": {
552
- "ownerHint": "net.minecraft"
553
- }
554
- }
555
- }
556
- ```
362
+ ## Common Environment Variables
557
363
 
558
- #### Lookup method mapping with descriptor
559
- ```json
560
- {
561
- "tool": "find-mapping",
562
- "arguments": {
563
- "version": "1.21.10",
564
- "kind": "method",
565
- "name": "tick",
566
- "owner": "a.b.C",
567
- "descriptor": "(I)V",
568
- "sourceMapping": "obfuscated",
569
- "targetMapping": "intermediary"
570
- }
571
- }
572
- ```
364
+ These are the most commonly changed settings. For the full supported list, see [docs/tool-reference.md#environment-variables](docs/tool-reference.md#environment-variables).
573
365
 
574
- #### Resolve exact method mapping
575
- ```json
576
- {
577
- "tool": "resolve-method-mapping-exact",
578
- "arguments": {
579
- "version": "1.21.10",
580
- "name": "f",
581
- "owner": "a.b.C",
582
- "descriptor": "(Ljava/lang/String;)V",
583
- "sourceMapping": "obfuscated",
584
- "targetMapping": "mojang"
585
- }
586
- }
587
- ```
588
-
589
- #### Show class API mapping matrix
590
- ```json
591
- {
592
- "tool": "get-class-api-matrix",
593
- "arguments": {
594
- "version": "1.21.10",
595
- "className": "a.b.C",
596
- "classNameMapping": "obfuscated",
597
- "includeKinds": "class,field,method",
598
- "maxRows": 100
599
- }
600
- }
601
- ```
602
-
603
- Add `maxCandidates` or `maxRows` when you only need the top matches or a bounded API slice.
604
-
605
- #### Resolve workspace compile-visible symbol
606
- ```json
607
- {
608
- "tool": "resolve-workspace-symbol",
609
- "arguments": {
610
- "projectPath": "/path/to/mod/workspace",
611
- "version": "1.21.10",
612
- "kind": "method",
613
- "name": "f",
614
- "owner": "a.b.C",
615
- "descriptor": "(Ljava/lang/String;)V",
616
- "sourceMapping": "obfuscated"
617
- }
618
- }
619
- ```
620
-
621
- #### Check symbol existence
622
- ```json
623
- {
624
- "tool": "check-symbol-exists",
625
- "arguments": {
626
- "version": "1.21.10",
627
- "kind": "method",
628
- "name": "f",
629
- "owner": "a.b.C",
630
- "descriptor": "(I)V",
631
- "sourceMapping": "obfuscated"
632
- }
633
- }
634
- ```
635
-
636
- #### Check class existence by short name (`nameMode=auto`)
637
- ```json
638
- {
639
- "tool": "check-symbol-exists",
640
- "arguments": {
641
- "version": "1.21.10",
642
- "kind": "class",
643
- "name": "Blocks",
644
- "nameMode": "auto",
645
- "sourceMapping": "mojang"
646
- }
647
- }
648
- ```
649
-
650
- ### NBT Utilities
651
-
652
- #### Decode Java NBT base64 to typed JSON
653
- ```json
654
- {
655
- "tool": "nbt-to-json",
656
- "arguments": {
657
- "nbtBase64": "<base64-nbt>",
658
- "compression": "auto"
659
- }
660
- }
661
- ```
662
-
663
- #### Patch typed NBT JSON
664
- ```json
665
- {
666
- "tool": "nbt-apply-json-patch",
667
- "arguments": {
668
- "typedJson": {
669
- "rootName": "Level",
670
- "root": { "type": "compound", "value": {} }
671
- },
672
- "patch": [
673
- { "op": "add", "path": "/root/value/name", "value": { "type": "string", "value": "Alex" } }
674
- ]
675
- }
676
- }
677
- ```
678
-
679
- #### Encode typed JSON back to NBT base64
680
- ```json
681
- {
682
- "tool": "json-to-nbt",
683
- "arguments": {
684
- "typedJson": {
685
- "rootName": "Level",
686
- "root": { "type": "compound", "value": {} }
687
- },
688
- "compression": "gzip"
689
- }
690
- }
691
- ```
692
-
693
- ### Mod Analysis Workflow
694
-
695
- A typical mod analysis workflow progresses through metadata extraction, decompilation, source reading, and search:
696
-
697
- #### 1. Analyze mod metadata
698
-
699
- Extract loader type, mod ID, dependencies, and Mixin configurations from a mod JAR:
700
-
701
- ```json
702
- {
703
- "tool": "analyze-mod-jar",
704
- "arguments": {
705
- "jarPath": "/path/to/mymod-1.0.0.jar",
706
- "includeClasses": true
707
- }
708
- }
709
- ```
710
-
711
- #### 2. Decompile the mod JAR
712
-
713
- Decompile all classes and optionally retrieve a specific class inline:
714
-
715
- ```json
716
- {
717
- "tool": "decompile-mod-jar",
718
- "arguments": {
719
- "jarPath": "/path/to/mymod-1.0.0.jar",
720
- "includeFiles": false,
721
- "className": "com.example.mymod.MyMod"
722
- }
723
- }
724
- ```
725
-
726
- #### 3. Read a specific class from decompiled source
727
-
728
- After decompilation, read any class without re-decompiling:
729
-
730
- ```json
731
- {
732
- "tool": "get-mod-class-source",
733
- "arguments": {
734
- "jarPath": "/path/to/mymod-1.0.0.jar",
735
- "className": "com.example.mymod.mixin.PlayerMixin",
736
- "maxLines": 120
737
- }
738
- }
739
- ```
740
-
741
- #### 4. Search across decompiled mod source
742
-
743
- Find method references, field usages, or text patterns across the entire decompiled mod:
744
-
745
- ```json
746
- {
747
- "tool": "search-mod-source",
748
- "arguments": {
749
- "jarPath": "/path/to/mymod-1.0.0.jar",
750
- "query": "onPlayerTick",
751
- "searchType": "method",
752
- "limit": 50
753
- }
754
- }
755
- ```
756
-
757
- #### 5. Remap mod JAR to readable names
758
-
759
- Remap a Fabric mod from `intermediary` to `yarn` names for easier reading:
760
-
761
- ```json
762
- {
763
- "tool": "remap-mod-jar",
764
- "arguments": {
765
- "inputJar": "/path/to/mymod-1.0.0.jar",
766
- "targetMapping": "yarn",
767
- "mcVersion": "1.21.10"
768
- }
769
- }
770
- ```
771
-
772
- If the input jar was already built with Mojang mappings, use `targetMapping: "mojang"` to get a copied output jar and a `fromMapping: "mojang"` result.
773
-
774
- ### Validation
775
-
776
- #### Validate Mixin source
777
-
778
- Check a Mixin class source for correctness against a target Minecraft version:
779
-
780
- ```json
781
- {
782
- "tool": "validate-mixin",
783
- "arguments": {
784
- "input": {
785
- "mode": "inline",
786
- "source": "@Mixin(PlayerEntity.class)\npublic abstract class PlayerMixin {\n @Inject(method = \"tick\", at = @At(\"HEAD\"))\n private void onTick(CallbackInfo ci) {}\n}"
787
- },
788
- "version": "1.21.10",
789
- "mapping": "yarn",
790
- "reportMode": "compact",
791
- "warningMode": "aggregated",
792
- "includeIssues": false
793
- }
794
- }
795
- ```
796
-
797
- #### Validate all Mixins in a project
798
-
799
- Discover `*.mixins.json` files from a workspace root and validate every referenced Mixin in one call:
800
-
801
- ```json
802
- {
803
- "tool": "validate-mixin",
804
- "arguments": {
805
- "input": {
806
- "mode": "project",
807
- "path": "/workspace/modid"
808
- },
809
- "version": "1.21.10",
810
- "projectPath": "/workspace/modid",
811
- "preferProjectVersion": true,
812
- "preferProjectMapping": true,
813
- "reportMode": "compact",
814
- "warningMode": "aggregated",
815
- "includeIssues": false
816
- }
817
- }
818
- ```
819
-
820
- #### Validate multiple Mixin files (batch)
821
-
822
- Run the same validation settings against multiple Mixin source files:
823
-
824
- ```json
825
- {
826
- "tool": "validate-mixin",
827
- "arguments": {
828
- "input": {
829
- "mode": "paths",
830
- "paths": [
831
- "/path/to/PlayerMixin.java",
832
- "/path/to/WorldMixin.java"
833
- ]
834
- },
835
- "version": "1.21.10",
836
- "mapping": "yarn",
837
- "reportMode": "compact",
838
- "warningMode": "aggregated",
839
- "includeIssues": false
840
- }
841
- }
842
- ```
843
-
844
- #### Validate Access Widener
845
-
846
- Check an Access Widener file for valid entries against the target version:
847
-
848
- ```json
849
- {
850
- "tool": "validate-access-widener",
851
- "arguments": {
852
- "content": "accessWidener v2 named\naccessible class net/minecraft/server/Main\naccessible method net/minecraft/server/Main tick ()V",
853
- "version": "1.21.10",
854
- "mapping": "yarn"
855
- }
856
- }
857
- ```
858
-
859
- ### Registry & Diagnostics
366
+ | Variable | Default | Description |
367
+ | --- | --- | --- |
368
+ | `MCP_CACHE_DIR` | `~/.cache/minecraft-modding-mcp` | Cache root for downloads and SQLite |
369
+ | `MCP_SOURCE_REPOS` | Maven Central + Fabric + Forge + NeoForge | Comma-separated Maven repository URLs |
370
+ | `MCP_MAPPING_SOURCE_PRIORITY` | `loom-first` | Mapping source priority (`loom-first` or `maven-first`) |
371
+ | `MCP_ENABLE_INDEXED_SEARCH` | `true` | Enable indexed search for `search-class-source` |
372
+ | `MCP_VINEFLOWER_JAR_PATH` | unset | Override the Vineflower JAR path |
373
+ | `MCP_TINY_REMAPPER_JAR_PATH` | unset | Override the tiny-remapper JAR path |
374
+ | `MCP_MAX_SEARCH_HITS` | `200` | Maximum search result count |
375
+ | `MCP_MAX_CACHE_BYTES` | `2147483648` | Maximum total cache size in bytes |
860
376
 
861
- #### Get all registries for a version
377
+ ## Development
862
378
 
863
- Retrieve the full set of generated registries (blocks, items, entities, etc.) for a Minecraft version:
379
+ Repository requirements:
864
380
 
865
- ```json
866
- {
867
- "tool": "get-registry-data",
868
- "arguments": {
869
- "version": "1.21.10",
870
- "includeData": false
871
- }
872
- }
873
- ```
874
-
875
- #### Get a single registry
381
+ - Node.js 22+
382
+ - `pnpm`
383
+ - Java when running remap or decompile flows locally
876
384
 
877
- Fetch only a specific registry type:
385
+ Setup and run the repository:
878
386
 
879
- ```json
880
- {
881
- "tool": "get-registry-data",
882
- "arguments": {
883
- "version": "1.21.10",
884
- "registry": "minecraft:block",
885
- "maxEntriesPerRegistry": 50
886
- }
887
- }
387
+ ```bash
388
+ pnpm install
389
+ pnpm dev
888
390
  ```
889
391
 
890
- #### Force reindex an artifact
891
-
892
- Rebuild the search index for an artifact after cache or tooling changes:
392
+ Build the packaged shape:
893
393
 
894
- ```json
895
- {
896
- "tool": "index-artifact",
897
- "arguments": {
898
- "artifactId": "<artifact-id>",
899
- "force": true
900
- }
901
- }
394
+ ```bash
395
+ pnpm build
396
+ pnpm start
902
397
  ```
903
398
 
904
- #### Inspect runtime metrics
905
-
906
- Check server performance counters, cache sizes, and latency snapshots:
399
+ Always run:
907
400
 
908
- ```json
909
- {
910
- "tool": "get-runtime-metrics",
911
- "arguments": {}
912
- }
401
+ ```bash
402
+ pnpm check
403
+ pnpm test
913
404
  ```
914
405
 
915
- Cache entry counts and byte accounting are maintained incrementally during `resolve-artifact`, `index-artifact`, cache hits, and eviction, so `get-runtime-metrics` remains cheap even after repeated artifact loads.
916
- Repeated mapping-heavy workflows such as `find-mapping`, `get-class-api-matrix`, `resolve-workspace-symbol`, `check-symbol-exists`, and `validate-mixin` also reuse hot-path resolution work to keep large batches responsive.
917
-
918
- ## Mapping Policy
919
-
920
- ### Namespace Definitions
921
-
922
- | Namespace | Description |
923
- | --- | --- |
924
- | `obfuscated` | Mojang obfuscated names (e.g. `a`, `b`, `c`) |
925
- | `mojang` | Mojang deobfuscated names from `client_mappings.txt` (e.g. `net.minecraft.server.Main`) |
926
- | `intermediary` | Fabric stable intermediary names (e.g. `net.minecraft.class_1234`, `method_5678`) |
927
- | `yarn` | Fabric community human-readable names (e.g. `net.minecraft.server.MinecraftServer`, `tick`) |
928
-
929
- The legacy public namespace name `official` was removed. Requests that still send `official` now fail validation and should be updated to `obfuscated`.
930
-
931
- ### Lookup Rules
932
-
933
- `find-mapping` supports lookup across `obfuscated`, `mojang`, `intermediary`, and `yarn`.
934
-
935
- Symbol query inputs use `kind` + `name` + optional `owner`/`descriptor`:
936
- - class: `kind=class`, `name=a.b.C` (default FQCN). For existence checks only, `nameMode=auto` allows short names like `C`.
937
- - field: `kind=field`, `owner=a.b.C`, `name=fieldName`
938
- - method: `kind=method`, `owner=a.b.C`, `name=methodName`, `descriptor=(I)V`
939
-
940
- `mapping: "mojang"` requires a source-backed artifact. If only decompile path is available, the server returns `ERR_MAPPING_NOT_APPLIED`.
941
-
942
- `resolve-artifact`, `get-class-members`, `trace-symbol-lifecycle`, and `diff-class-signatures` accept `obfuscated | mojang | intermediary | yarn` with constraints:
943
- - `intermediary` / `yarn` require a resolvable Minecraft version context (for example `target.kind=version` or a versioned coordinate).
944
- - for unobfuscated versions (for example 26.1+), requesting `intermediary` / `yarn` falls back to `obfuscated` with a warning.
945
- - `mojang` requires source-backed artifacts; decompile-only paths are rejected with `ERR_MAPPING_NOT_APPLIED`.
946
-
947
- When `trace-symbol-lifecycle` omits `descriptor`, the server resolves methods by owner+name and warns if overload ambiguity prevents a unique answer.
948
- For decompile-only `ERR_MAPPING_NOT_APPLIED` failures, error details include `artifactOrigin`, `nextAction`, and `suggestedCall` so clients can recover without guessing.
406
+ Run these when relevant:
949
407
 
950
- If `find-class` or `get-class-source` returns no hit on an `obfuscated` artifact for names like `net.minecraft.world.item.Item`, the tool now warns that `obfuscated` means Mojang's obfuscated runtime names and recommends retrying with `mapping="mojang"` or translating via `find-mapping`.
951
-
952
- Method descriptor precision is best on Tiny-backed paths (`intermediary`/`yarn`). For `obfuscated <-> mojang`, Mojang `client_mappings` do not carry JVM descriptors, so descriptor queries may fallback to name matching and emit a warning.
953
-
954
- Use `resolve-method-mapping-exact` when candidate ranking is not enough and the workflow needs strict `owner+name+descriptor` certainty.
955
- Use `find-mapping` `disambiguation.ownerHint` / `disambiguation.descriptorHint` to narrow ambiguous candidate sets.
956
- Use `resolve-workspace-symbol` when you need compile-visible names from actual Gradle Loom mappings in a workspace.
957
-
958
- ## Environment Variables
959
-
960
- ### Core
961
-
962
- | Variable | Default | Description |
963
- | --- | --- | --- |
964
- | `MCP_CACHE_DIR` | `~/.cache/minecraft-modding-mcp` | Cache root for downloads and SQLite |
965
- | `MCP_SQLITE_PATH` | `<cacheDir>/source-cache.db` | SQLite database path |
966
- | `MCP_SOURCE_REPOS` | Maven Central + Fabric + Forge + NeoForge | Comma-separated Maven repository URLs |
967
- | `MCP_LOCAL_M2` | `~/.m2/repository` | Local Maven repository path |
968
- | `MCP_ENABLE_INDEXED_SEARCH` | `true` | Enable indexed query path for `search-class-source` |
969
- | `MCP_MAPPING_SOURCE_PRIORITY` | `loom-first` | Mapping source priority (`loom-first` or `maven-first`) |
970
- | `MCP_VERSION_MANIFEST_URL` | Mojang manifest URL | Override manifest endpoint for testing/private mirrors |
971
-
972
- ### Limits & Tuning
973
-
974
- | Variable | Default | Description |
975
- | --- | --- | --- |
976
- | `MCP_MAX_CONTENT_BYTES` | `1000000` | Maximum bytes for file read operations |
977
- | `MCP_MAX_SEARCH_HITS` | `200` | Maximum search result count |
978
- | `MCP_MAX_ARTIFACTS` | `200` | Maximum cached artifacts |
979
- | `MCP_MAX_CACHE_BYTES` | `2147483648` | Maximum total cache size in bytes |
980
- | `MCP_FETCH_TIMEOUT_MS` | `15000` | HTTP request timeout in milliseconds |
981
- | `MCP_FETCH_RETRIES` | `2` | HTTP request retry count |
982
-
983
- ### Decompilation & Remapping
984
-
985
- | Variable | Default | Description |
986
- | --- | --- | --- |
987
- | `MCP_VINEFLOWER_JAR_PATH` | unset | External Vineflower JAR path (auto-downloaded if unset) |
988
- | `MCP_TINY_REMAPPER_JAR_PATH` | unset | External tiny-remapper JAR path (auto-downloaded if unset) |
989
- | `MCP_REMAP_TIMEOUT_MS` | `600000` | Remap operation timeout in milliseconds |
990
- | `MCP_REMAP_MAX_MEMORY_MB` | `4096` | Maximum JVM heap for remap operations |
991
-
992
- ### NBT
993
-
994
- | Variable | Default | Description |
995
- | --- | --- | --- |
996
- | `MCP_MAX_NBT_INPUT_BYTES` | `4194304` | Maximum decoded NBT input bytes accepted by `nbt-to-json` |
997
- | `MCP_MAX_NBT_INFLATED_BYTES` | `16777216` | Maximum gzip-inflated bytes accepted by `nbt-to-json` |
998
- | `MCP_MAX_NBT_RESPONSE_BYTES` | `8388608` | Maximum response payload bytes for NBT tools |
999
-
1000
- ## Architecture
1001
-
1002
- | Component | Technology |
1003
- | --- | --- |
1004
- | Runtime | Node.js 22+ (native `node:sqlite`) |
1005
- | Transport | stdio (MCP standard, auto-detects newline + `Content-Length` framing) |
1006
- | Storage | SQLite — artifact metadata, source index, mapping cache |
1007
- | Decompilation | [Vineflower](https://github.com/Vineflower/vineflower) (auto-downloaded) |
1008
- | Remapping | [tiny-remapper](https://github.com/FabricMC/tiny-remapper) (requires Java) |
1009
- | Mapping Sources | Mojang `client_mappings.txt`, Fabric Loom workspace, Maven Tiny v2 |
1010
-
1011
- The server runs as a single long-lived process communicating over stdio. Artifacts (source JARs, binary JARs, mapping files) are downloaded on demand and cached in SQLite. The search index is built lazily on first query and persisted for subsequent calls.
1012
-
1013
- ## Development Notes
1014
-
1015
- - `SourceService` is the canonical implementation for artifact resolution, ingestion, and source querying.
1016
- - `version` resolution downloads Mojang client JARs into cache and routes them through the same ingestion flow as `jar` and `coordinate` targets.
1017
- - Tool responses are always wrapped as `{ result?, error?, meta }`.
1018
- - Tool responses also mirror that envelope into MCP `structuredContent`, and failures set `isError=true`.
1019
- - `meta` includes `requestId`, `tool`, `durationMs`, and `warnings[]`.
408
+ - `pnpm test:manual:stdio-smoke` for MCP transport, registration, or manual workflow changes
409
+ - `pnpm test:manual:package-smoke` when checking packaged install and distribution behavior
410
+ - `pnpm test:perf` for search, index, or performance-sensitive changes
411
+ - `pnpm test:coverage` or `pnpm test:coverage:lcov` for coverage checks (`lines=80`, `branches=70`, `functions=80`)
412
+ - `pnpm validate` for the full local validation suite
1020
413
 
1021
414
  ## License
1022
415