@adhisang/minecraft-modding-mcp 1.2.1 → 2.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +184 -64
  3. package/dist/cli.js +31 -4
  4. package/dist/compat-stdio-transport.d.ts +2 -7
  5. package/dist/compat-stdio-transport.js +12 -154
  6. package/dist/index.js +537 -202
  7. package/dist/json-rpc-framing.d.ts +22 -0
  8. package/dist/json-rpc-framing.js +168 -0
  9. package/dist/mapping-pipeline-service.d.ts +1 -1
  10. package/dist/mapping-pipeline-service.js +13 -5
  11. package/dist/mapping-service.d.ts +12 -4
  12. package/dist/mapping-service.js +222 -105
  13. package/dist/mcp-helpers.d.ts +10 -2
  14. package/dist/mcp-helpers.js +59 -5
  15. package/dist/minecraft-explorer-service.d.ts +1 -2
  16. package/dist/minecraft-explorer-service.js +120 -24
  17. package/dist/mixin-validator.d.ts +24 -2
  18. package/dist/mixin-validator.js +228 -103
  19. package/dist/mod-decompile-service.d.ts +5 -0
  20. package/dist/mod-decompile-service.js +40 -5
  21. package/dist/mod-remap-service.js +142 -30
  22. package/dist/mojang-tiny-mapping-service.js +26 -26
  23. package/dist/path-resolver.js +41 -4
  24. package/dist/registry-service.d.ts +10 -1
  25. package/dist/registry-service.js +154 -22
  26. package/dist/resources.js +7 -7
  27. package/dist/search-hit-accumulator.d.ts +0 -3
  28. package/dist/search-hit-accumulator.js +27 -6
  29. package/dist/source-jar-reader.js +16 -2
  30. package/dist/source-resolver.d.ts +1 -0
  31. package/dist/source-resolver.js +93 -2
  32. package/dist/source-service.d.ts +76 -47
  33. package/dist/source-service.js +1344 -763
  34. package/dist/stdio-supervisor.d.ts +46 -0
  35. package/dist/stdio-supervisor.js +349 -0
  36. package/dist/storage/files-repo.d.ts +3 -0
  37. package/dist/storage/files-repo.js +66 -1
  38. package/dist/storage/migrations.d.ts +1 -1
  39. package/dist/storage/migrations.js +6 -2
  40. package/dist/storage/schema.d.ts +1 -0
  41. package/dist/storage/schema.js +7 -0
  42. package/dist/symbols/symbol-extractor.js +6 -4
  43. package/dist/tool-execution-gate.d.ts +15 -0
  44. package/dist/tool-execution-gate.js +58 -0
  45. package/dist/tool-input.d.ts +6 -0
  46. package/dist/tool-input.js +64 -0
  47. package/dist/types.d.ts +1 -1
  48. package/dist/version-diff-service.js +10 -5
  49. package/dist/version-service.js +7 -2
  50. package/dist/workspace-mapping-service.js +12 -0
  51. package/package.json +4 -1
@@ -0,0 +1,64 @@
1
+ const POSITIVE_INT_FIELD_NAMES = new Set([
2
+ "limit",
3
+ "startLine",
4
+ "endLine",
5
+ "maxLines",
6
+ "maxChars",
7
+ "maxMembers",
8
+ "maxBytes",
9
+ "maxVersions",
10
+ "maxClassResults"
11
+ ]);
12
+ const MAPPING_FIELD_NAMES = new Set(["mapping", "sourceMapping", "targetMapping", "classNameMapping"]);
13
+ function coerceTopLevelNumericStrings(value) {
14
+ if (typeof value !== "object" || value == null || Array.isArray(value)) {
15
+ return value;
16
+ }
17
+ const output = {};
18
+ for (const [key, entry] of Object.entries(value)) {
19
+ if (typeof entry === "string" && POSITIVE_INT_FIELD_NAMES.has(key)) {
20
+ const trimmed = entry.trim();
21
+ if (/^\d+$/.test(trimmed)) {
22
+ output[key] = Number.parseInt(trimmed, 10);
23
+ continue;
24
+ }
25
+ }
26
+ output[key] = entry;
27
+ }
28
+ return output;
29
+ }
30
+ function collectRemovedOfficialNamespacePaths(value) {
31
+ if (typeof value !== "object" || value == null || Array.isArray(value)) {
32
+ return [];
33
+ }
34
+ const matches = [];
35
+ for (const [key, entry] of Object.entries(value)) {
36
+ if (typeof entry === "string" && MAPPING_FIELD_NAMES.has(key) && entry.trim() === "official") {
37
+ matches.push(key);
38
+ }
39
+ }
40
+ return matches;
41
+ }
42
+ function replaceRemovedOfficialMappings(value) {
43
+ if (typeof value !== "object" || value == null || Array.isArray(value)) {
44
+ return undefined;
45
+ }
46
+ const output = {};
47
+ for (const [key, entry] of Object.entries(value)) {
48
+ output[key] =
49
+ typeof entry === "string" && MAPPING_FIELD_NAMES.has(key) && entry.trim() === "official"
50
+ ? "obfuscated"
51
+ : entry;
52
+ }
53
+ return output;
54
+ }
55
+ export function prepareToolInput(rawInput) {
56
+ const normalizedInput = coerceTopLevelNumericStrings(rawInput);
57
+ const removedOfficialPaths = collectRemovedOfficialNamespacePaths(normalizedInput);
58
+ return {
59
+ normalizedInput,
60
+ removedOfficialPaths,
61
+ suggestedReplacementInput: removedOfficialPaths.length > 0 ? replaceRemovedOfficialMappings(normalizedInput) : undefined
62
+ };
63
+ }
64
+ //# sourceMappingURL=tool-input.js.map
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type SourceOrigin = "local-jar" | "local-m2" | "remote-repo" | "decompiled";
2
- export type SourceMapping = "official" | "mojang" | "intermediary" | "yarn";
2
+ export type SourceMapping = "obfuscated" | "mojang" | "intermediary" | "yarn";
3
3
  export type MappingSourcePriority = "loom-first" | "maven-first";
4
4
  export type ArtifactTargetKind = "version" | "jar" | "coordinate";
5
5
  export type ArtifactScope = "vanilla" | "merged" | "loader";
@@ -22,6 +22,9 @@ function filterByPackage(classes, prefix) {
22
22
  const normalized = prefix.endsWith(".") ? prefix : `${prefix}.`;
23
23
  return classes.filter((fqn) => fqn.startsWith(normalized));
24
24
  }
25
+ function filterSetByPackage(classes, prefix) {
26
+ return new Set(filterByPackage([...classes], prefix));
27
+ }
25
28
  function diffSets(from, to) {
26
29
  const added = [];
27
30
  const removed = [];
@@ -162,11 +165,13 @@ export class VersionDiffService {
162
165
  ]);
163
166
  const fromClasses = extractClassEntries(fromEntries);
164
167
  const toClasses = extractClassEntries(toEntries);
165
- let { added, removed, unchanged } = diffSets(fromClasses, toClasses);
166
- if (input.packageFilter) {
167
- added = filterByPackage(added, input.packageFilter);
168
- removed = filterByPackage(removed, input.packageFilter);
169
- }
168
+ const filteredFromClasses = input.packageFilter
169
+ ? filterSetByPackage(fromClasses, input.packageFilter)
170
+ : fromClasses;
171
+ const filteredToClasses = input.packageFilter
172
+ ? filterSetByPackage(toClasses, input.packageFilter)
173
+ : toClasses;
174
+ const { added, removed, unchanged } = diffSets(filteredFromClasses, filteredToClasses);
170
175
  const truncatedAdded = added.slice(0, maxClassResults);
171
176
  const truncatedRemoved = removed.slice(0, maxClassResults);
172
177
  if (added.length > maxClassResults) {
@@ -401,8 +401,13 @@ export class VersionService {
401
401
  }
402
402
  trimVersionDetailCache() {
403
403
  const maxEntries = Math.max(1, this.config.maxVersionDetailCache ?? 256);
404
- while (this.versionDetailCache.size > maxEntries) {
405
- const oldest = this.versionDetailCache.keys().next().value;
404
+ const overflow = this.versionDetailCache.size - maxEntries;
405
+ if (overflow <= 0) {
406
+ return;
407
+ }
408
+ const keyIterator = this.versionDetailCache.keys();
409
+ for (let index = 0; index < overflow; index += 1) {
410
+ const oldest = keyIterator.next().value;
406
411
  if (!oldest) {
407
412
  return;
408
413
  }
@@ -22,6 +22,18 @@ function detectMappingsFromContent(content) {
22
22
  reason: "mappings net.fabricmc:intermediary"
23
23
  });
24
24
  }
25
+ if (/\bid\s*(?:\(\s*)?["']net\.neoforged\.moddev["']\s*\)?/i.test(content)) {
26
+ detections.push({
27
+ mapping: "mojang",
28
+ reason: "net.neoforged.moddev plugin"
29
+ });
30
+ }
31
+ if (/\bneoForge\s*\{[\s\S]*?\bparchment\s*\{/i.test(content)) {
32
+ detections.push({
33
+ mapping: "mojang",
34
+ reason: "neoForge parchment block"
35
+ });
36
+ }
25
37
  return detections;
26
38
  }
27
39
  export class WorkspaceMappingService {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhisang/minecraft-modding-mcp",
3
- "version": "1.2.1",
3
+ "version": "2.1.0",
4
4
  "description": "MCP server with utilities for Minecraft modding workflows",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -39,6 +39,9 @@
39
39
  ],
40
40
  "author": "adhi-jp",
41
41
  "license": "MIT",
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
42
45
  "repository": "github:adhi-jp/minecraft-modding-mcp",
43
46
  "bugs": "https://github.com/adhi-jp/minecraft-modding-mcp/issues",
44
47
  "homepage": "https://github.com/adhi-jp/minecraft-modding-mcp#readme",