@adhisang/minecraft-modding-mcp 2.0.0 → 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 (37) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +109 -29
  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 +392 -33
  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.js +9 -1
  10. package/dist/mapping-service.d.ts +9 -0
  11. package/dist/mapping-service.js +183 -60
  12. package/dist/minecraft-explorer-service.d.ts +0 -1
  13. package/dist/minecraft-explorer-service.js +119 -23
  14. package/dist/mixin-validator.d.ts +24 -2
  15. package/dist/mixin-validator.js +223 -98
  16. package/dist/mod-decompile-service.d.ts +5 -0
  17. package/dist/mod-decompile-service.js +40 -5
  18. package/dist/mod-remap-service.js +142 -30
  19. package/dist/path-resolver.js +41 -4
  20. package/dist/registry-service.d.ts +10 -1
  21. package/dist/registry-service.js +154 -22
  22. package/dist/search-hit-accumulator.js +23 -2
  23. package/dist/source-jar-reader.js +16 -2
  24. package/dist/source-resolver.js +6 -7
  25. package/dist/source-service.d.ts +42 -4
  26. package/dist/source-service.js +781 -127
  27. package/dist/stdio-supervisor.d.ts +46 -0
  28. package/dist/stdio-supervisor.js +349 -0
  29. package/dist/storage/files-repo.d.ts +3 -9
  30. package/dist/storage/files-repo.js +66 -43
  31. package/dist/symbols/symbol-extractor.js +6 -4
  32. package/dist/tool-execution-gate.d.ts +15 -0
  33. package/dist/tool-execution-gate.js +58 -0
  34. package/dist/version-diff-service.js +10 -5
  35. package/dist/version-service.js +7 -2
  36. package/dist/workspace-mapping-service.js +12 -0
  37. package/package.json +1 -1
@@ -0,0 +1,58 @@
1
+ import { createError, ERROR_CODES } from "./errors.js";
2
+ const DEFAULT_OPTIONS = {
3
+ maxConcurrent: 1,
4
+ maxQueue: 2
5
+ };
6
+ export class ToolExecutionGate {
7
+ maxConcurrent;
8
+ maxQueue;
9
+ activeCount = 0;
10
+ queue = [];
11
+ constructor(options = {}) {
12
+ this.maxConcurrent = Math.max(1, Math.trunc(options.maxConcurrent ?? DEFAULT_OPTIONS.maxConcurrent));
13
+ this.maxQueue = Math.max(0, Math.trunc(options.maxQueue ?? DEFAULT_OPTIONS.maxQueue));
14
+ }
15
+ run(tool, task) {
16
+ if (this.activeCount < this.maxConcurrent) {
17
+ return this.execute({ tool, task: task });
18
+ }
19
+ if (this.queue.length >= this.maxQueue) {
20
+ return Promise.reject(createError({
21
+ code: ERROR_CODES.LIMIT_EXCEEDED,
22
+ message: `Heavy tool queue is full; "${tool}" was not started.`,
23
+ details: {
24
+ tool,
25
+ activeCount: this.activeCount,
26
+ queuedCount: this.queue.length,
27
+ maxConcurrent: this.maxConcurrent,
28
+ maxQueue: this.maxQueue,
29
+ nextAction: "Retry after the current heavy analysis request completes. Avoid sending multiple heavy mapping/version analysis tools in parallel."
30
+ }
31
+ }));
32
+ }
33
+ return new Promise((resolve, reject) => {
34
+ this.queue.push({
35
+ tool,
36
+ task: task,
37
+ resolve: resolve,
38
+ reject
39
+ });
40
+ });
41
+ }
42
+ execute(entry) {
43
+ this.activeCount += 1;
44
+ return Promise.resolve()
45
+ .then(entry.task)
46
+ .finally(() => {
47
+ this.activeCount = Math.max(0, this.activeCount - 1);
48
+ this.drain();
49
+ });
50
+ }
51
+ drain() {
52
+ while (this.activeCount < this.maxConcurrent && this.queue.length > 0) {
53
+ const next = this.queue.shift();
54
+ this.execute(next).then(next.resolve, next.reject);
55
+ }
56
+ }
57
+ }
58
+ //# sourceMappingURL=tool-execution-gate.js.map
@@ -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": "2.0.0",
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",