@creeperhost/modlens-mcp 1.6.20 → 1.6.21

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 (91) hide show
  1. package/ATTRIBUTION.md +8 -1
  2. package/README.md +67 -0
  3. package/RUNTIME.md +262 -0
  4. package/TESTING.md +8 -0
  5. package/dist/hosted-mod-license.d.ts +36 -0
  6. package/dist/hosted-mod-license.d.ts.map +1 -0
  7. package/dist/hosted-mod-license.js +65 -0
  8. package/dist/hosted-mod-license.js.map +1 -0
  9. package/dist/hosted-policy.d.ts +32 -0
  10. package/dist/hosted-policy.d.ts.map +1 -0
  11. package/dist/hosted-policy.js +257 -0
  12. package/dist/hosted-policy.js.map +1 -0
  13. package/dist/launcher.js +104 -89
  14. package/dist/launcher.js.map +1 -1
  15. package/dist/license-notices.d.ts +8 -0
  16. package/dist/license-notices.d.ts.map +1 -0
  17. package/dist/license-notices.js +10 -0
  18. package/dist/license-notices.js.map +1 -0
  19. package/dist/license-source-references.d.ts +12 -0
  20. package/dist/license-source-references.d.ts.map +1 -0
  21. package/dist/license-source-references.js +18 -0
  22. package/dist/license-source-references.js.map +1 -0
  23. package/dist/license-templates.d.ts +6 -0
  24. package/dist/license-templates.d.ts.map +1 -0
  25. package/dist/license-templates.js +55 -0
  26. package/dist/license-templates.js.map +1 -0
  27. package/dist/local-mod.d.ts +31 -0
  28. package/dist/local-mod.d.ts.map +1 -0
  29. package/dist/local-mod.js +71 -0
  30. package/dist/local-mod.js.map +1 -0
  31. package/dist/mod-license.d.ts +53 -0
  32. package/dist/mod-license.d.ts.map +1 -0
  33. package/dist/mod-license.js +617 -0
  34. package/dist/mod-license.js.map +1 -0
  35. package/dist/runtime/cli.d.ts +2 -0
  36. package/dist/runtime/cli.d.ts.map +1 -0
  37. package/dist/runtime/cli.js +163 -0
  38. package/dist/runtime/cli.js.map +1 -0
  39. package/dist/runtime/companion.d.ts +32 -0
  40. package/dist/runtime/companion.d.ts.map +1 -0
  41. package/dist/runtime/companion.js +135 -0
  42. package/dist/runtime/companion.js.map +1 -0
  43. package/dist/runtime/guidance.d.ts +73 -0
  44. package/dist/runtime/guidance.d.ts.map +1 -0
  45. package/dist/runtime/guidance.js +40 -0
  46. package/dist/runtime/guidance.js.map +1 -0
  47. package/dist/runtime/hub.d.ts +150 -0
  48. package/dist/runtime/hub.d.ts.map +1 -0
  49. package/dist/runtime/hub.js +561 -0
  50. package/dist/runtime/hub.js.map +1 -0
  51. package/dist/runtime/modlens-agent.jar +0 -0
  52. package/dist/runtime/protocol.d.ts +202 -0
  53. package/dist/runtime/protocol.d.ts.map +1 -0
  54. package/dist/runtime/protocol.js +91 -0
  55. package/dist/runtime/protocol.js.map +1 -0
  56. package/dist/runtime/requests.d.ts +367 -0
  57. package/dist/runtime/requests.d.ts.map +1 -0
  58. package/dist/runtime/requests.js +57 -0
  59. package/dist/runtime/requests.js.map +1 -0
  60. package/dist/server.js +125 -36
  61. package/dist/server.js.map +1 -1
  62. package/dist/tools/project.d.ts +7 -3
  63. package/dist/tools/project.d.ts.map +1 -1
  64. package/dist/tools/project.js +45 -3
  65. package/dist/tools/project.js.map +1 -1
  66. package/dist/tools/report-issue.d.ts +77 -0
  67. package/dist/tools/report-issue.d.ts.map +1 -0
  68. package/dist/tools/report-issue.js +92 -0
  69. package/dist/tools/report-issue.js.map +1 -0
  70. package/dist/tools/runtime.d.ts +6 -0
  71. package/dist/tools/runtime.d.ts.map +1 -0
  72. package/dist/tools/runtime.js +18 -0
  73. package/dist/tools/runtime.js.map +1 -0
  74. package/dist/tools/source.d.ts +1 -1
  75. package/dist/tools/source.d.ts.map +1 -1
  76. package/dist/tools/source.js +5 -1
  77. package/dist/tools/source.js.map +1 -1
  78. package/package.json +4 -1
  79. package/scripts/build-runtime-agent.mjs +64 -0
  80. package/scripts/fixtures/mod-license-corpus.json +154 -0
  81. package/scripts/gradle/modlens-runtime.init.gradle +17 -0
  82. package/scripts/runtime-test-client.mjs +36 -0
  83. package/scripts/test-hosted-policy.mjs +123 -0
  84. package/scripts/test-mod-licenses-live.mjs +86 -0
  85. package/scripts/test-package.mjs +44 -0
  86. package/scripts/test-project-http.mjs +46 -3
  87. package/scripts/test-runtime-gradle.mjs +107 -0
  88. package/scripts/test-runtime-minecraft.mjs +190 -0
  89. package/scripts/test-runtime-native.mjs +120 -0
  90. package/scripts/test-runtime-remote.mjs +209 -0
  91. package/scripts/update-license-templates.mjs +14 -0
package/ATTRIBUTION.md CHANGED
@@ -6,4 +6,11 @@ If ModLens substantially powers an end-user-facing feature in your product or se
6
6
 
7
7
  Suggested wording:
8
8
 
9
- Powered by ModLens by CreeperHost
9
+ Powered by ModLens by CreeperHost
10
+
11
+ ## Third-party license reference data
12
+
13
+ The hosted mod license matcher includes selected standard license texts from
14
+ [SPDX License List Data 3.27.0](https://github.com/spdx/license-list-data/tree/v3.27.0),
15
+ whose data is dedicated to the public domain under CC0-1.0. These reference
16
+ texts identify grants; they do not themselves license any Minecraft or mod code.
package/README.md CHANGED
@@ -4,6 +4,33 @@ MCP server and CLI for browsing, decompiling, and analyzing Minecraft mod JARs.
4
4
 
5
5
  Store mod metadata, class indexes, mixin targets, AT/AW entries, and decompiled source in a local database — **embedded SQLite by default** (zero setup), or PostgreSQL/PGlite if you want them. Query everything via AI (MCP) or command line (CLI).
6
6
 
7
+ ## Optional live development client
8
+
9
+ The `runtime` MCP tool can prepare and launch a **Minecraft 26.3 / Java 25** dev
10
+ client, detect IntelliJ launches, monitor JVM failures and memory pressure, and
11
+ control input without desktop automation. It supports normal, visible watch-only,
12
+ and hidden windows. Ask the AI to call `runtime` with `action:"help"` or set it up
13
+ for your mod project. With remote MCP, Codex runs the local `--runtime` helper;
14
+ with local stdio MCP, the tools execute directly. No second MCP connection is needed.
15
+ See [runtime setup, examples, and compatibility limits](RUNTIME.md).
16
+
17
+ ## Reporting an issue from your coding agent
18
+
19
+ Ask your agent to **report a ModLens issue on GitHub**. The `report_issue` MCP tool
20
+ works locally and remotely: `action:"help"` explains the workflow, and
21
+ `action:"prepare"` produces a draft from a title, summary, reproduction steps,
22
+ expected/actual behavior, environment and an optional sanitized diagnostic excerpt.
23
+ It includes the ModLens server version automatically.
24
+
25
+ The tool directs the agent to check for duplicates and submit to
26
+ [CreeperHost/modlens-mcp](https://github.com/CreeperHost/modlens-mcp/issues) using
27
+ its existing GitHub connector or `gh issue create --body-file`. Without GitHub
28
+ access, it returns a draft and a manual submission link. ModLens needs no GitHub
29
+ credentials and does not publish the report itself; `executed:false` means only
30
+ the draft was prepared. Remove credentials, private source and personal details
31
+ before supplying diagnostic excerpts. Reports are submitted when the user requests
32
+ it, rather than automatically for every error.
33
+
7
34
  ## Installation
8
35
 
9
36
  ### Option A — npx (recommended, no clone required)
@@ -1036,6 +1063,46 @@ node dist/cli.js check-updates 2
1036
1063
 
1037
1064
  ---
1038
1065
 
1066
+ ## Hosted access limits
1067
+
1068
+ HTTP MCP (`MCP_PORT`) enables hosted limits by default. Local stdio retains its existing access. Hosted developers can browse source in pages, search, inspect bytecode and members, compare versions, inspect mixins and data, and upload their private Gradle environments. Bulk decompile/index commands, source/graph/embedding exports, raw JAR reads, host paths and filesystem administration are reserved for the local operator. KubeJS directory access and compatibility checks using host-local JAR paths are also local-only.
1069
+
1070
+ | Setting | Default | Scope |
1071
+ | --- | --- | --- |
1072
+ | `MODLENS_HOSTED_SOURCE_LINES` | 200 | Source/bytecode lines per response, shared across search snippets |
1073
+ | `MODLENS_HOSTED_RESPONSE_BYTES` | 131072 (128 KiB) | Serialized text content per tool response |
1074
+ | `MODLENS_HOSTED_DAILY_BYTES` | 5242880 (5 MiB) | Delivered tool content per account per UTC day |
1075
+ | `MODLENS_HOSTED_PERIOD_BYTES` | 52428800 (50 MiB) | Delivered tool content per account per fixed 30-day period |
1076
+ | `MODLENS_HOSTED_DAILY_REQUESTS` | 1000 | Tool calls per account per UTC day |
1077
+ | `MODLENS_HOSTED_MINUTE_REQUESTS` | 120 | Tool calls per account per minute |
1078
+
1079
+ The byte allowance includes all successful tool content, including metadata, search snippets and bytecode. It measures UTF-8 JSON content before transport compression. Cached files and inbound upload bytes are excluded. Each source text field has a 32 KiB cap. Searches with `limit`/`top` are capped at 50 results; responses exceeding the byte limit require a narrower query.
1080
+
1081
+ Use `startLine` (1-based) and `maxLines` for `mc_source get_source/bytecode`, `mod source/decompile_class`, `mod_bytecode bytecode`, and `project source/bytecode`. A range may start anywhere; the hosted cap bounds its length. Prepare shared indexes and ingest mods through the operator's local interface; hosted clients can upload their own Gradle environment through `project`.
1082
+
1083
+ ### Mod source access
1084
+
1085
+ Hosted mod source responses include licence and attribution notices. Use `mod_license` with `action=check` and `modId`/`dbId` to check availability. For uploaded projects, supply `projectKey`, `environmentId` and `className` instead.
1086
+
1087
+ When hosted source is unavailable, `action=local_plan` provides instructions for decompiling your local JAR with your explicit consent. Run the returned request on your computer:
1088
+
1089
+ ```bash
1090
+ npx -y @creeperhost/modlens-mcp --local-mod --request-file local-request.json
1091
+ ```
1092
+
1093
+ ### Bind allowances to authenticated accounts
1094
+
1095
+ For public HTTP access, put an authenticated HTTPS gateway in front of the server. Set `MODLENS_HOSTED_PROXY_SECRET` to a random secret of at least 32 characters. The gateway must remove caller-provided `x-modlens-*` headers and inject:
1096
+
1097
+ - `x-modlens-proxy-secret`: the server's secret, never sent to clients.
1098
+ - `x-modlens-user-id`: a stable, verified account identifier selected by the gateway. Reconnecting, rotating tokens, or using another client must retain this identifier.
1099
+
1100
+ Restrict network access to the origin to that gateway and protect the gateway-to-server connection. The server checks the secret and account on every MCP request and binds each session to its account. The gateway manages authentication and account access. Multiple login methods for one account must use the same identifier.
1101
+
1102
+ Without the proxy secret, callers share a single global allowance, regardless of self-asserted user IDs or tokens. This fallback provides limits, **not authentication**, and one caller can exhaust it for everyone. `MODLENS_HOSTED_LIMITS=0` disables these controls and gateway-secret checking entirely; use it only for trusted private HTTP deployments.
1103
+
1104
+ Usage persists in `hosted_usage` in the configured database. Checks and updates are atomic, including parallel calls; reconnects and server restarts do not reset usage. All replicas must use the same persistent database and account mapping. The 30-day periods align to Unix-epoch boundaries, rather than rolling with each request. Restoring an older database restores its older counters. Database failures reject hosted tool calls before releasing output.
1105
+
1039
1106
  ## Acknowledgements
1040
1107
 
1041
1108
  ### Services & APIs
package/RUNTIME.md ADDED
@@ -0,0 +1,262 @@
1
+ # Optional live Minecraft development runtime
2
+
3
+ ModLens can launch or detect a **Minecraft Java 26.3 / Java 25** development client,
4
+ observe JVM health and failures, and send inputs directly through LWJGL's SDL3
5
+ bindings. Desktop automation and an IntelliJ plugin are not required. This is an
6
+ initial 26.3 adapter, not a claim of compatibility with older versions or every modpack.
7
+
8
+ ## Let the AI set it up
9
+
10
+ Use your existing **remote or local** ModLens MCP connection and ask:
11
+
12
+ > Set up ModLens runtime monitoring for this 26.3 mod project. Let me launch it
13
+ > from IntelliJ, and keep the client visible but watch-only while you control it.
14
+
15
+ The always-discoverable `runtime` MCP tool describes this workflow. The AI calls:
16
+
17
+ ```json
18
+ {"action":"setup","projectDir":"F:/Git/my-mod","mcVersion":"26.3","mode":"observe","gradleTask":"runClient"}
19
+ ```
20
+
21
+ With local stdio, that tool call executes directly. With remote MCP, it returns
22
+ `executed:false` and a **local execution plan**. Codex writes the supplied JSON
23
+ request to a local file and invokes the version-matched helper through its local
24
+ terminal tools. A returned plan is not a completed setup or game action.
25
+
26
+ For example, save the setup JSON above as `runtime-request.json`, then run on the
27
+ Minecraft PC (use the package version returned by your remote MCP):
28
+
29
+ ```sh
30
+ npx -y @creeperhost/modlens-mcp@<version> --runtime --request-file runtime-request.json
31
+ ```
32
+
33
+ For this unpublished source build, use the built checkout instead:
34
+
35
+ ```sh
36
+ node /path/to/modlens-mcp/dist/launcher.js --runtime --request-file runtime-request.json
37
+ ```
38
+
39
+ The helper automatically starts an authenticated loopback companion. It stays
40
+ running between commands, detects configured IntelliJ launches, and collects
41
+ events while Codex is doing other work. It requires Node.js and the same Minecraft
42
+ JDK as the direct MCP workflow; it does not bootstrap a source database or modify
43
+ MCP configuration. There is no second local MCP connection, Cloudflare dependency,
44
+ public runtime endpoint, or automatic upload of diagnostics to remote ModLens.
45
+ Codex must have local terminal/file access on the Minecraft PC; a cloud-only shell
46
+ does not provide that access.
47
+
48
+ All JSON requests in this document work through the helper. Short commands are
49
+ also available:
50
+
51
+ ```sh
52
+ modlens-mcp --runtime help
53
+ modlens-mcp --runtime sessions
54
+ modlens-mcp --runtime status
55
+ modlens-mcp --runtime stop
56
+ ```
57
+
58
+ Use the same `npx ...` or `node .../dist/launcher.js` prefix if the command is not
59
+ installed globally. The companion stores its private credentials and journal in
60
+ `<MODLENS_CACHE_ROOT>/runtime` (by default `~/.modlens-cache/runtime`). Stop ends
61
+ monitoring, leaving running game processes alive; held inputs expire on connection
62
+ loss. Switch to interactive mode first if you want to continue playing manually.
63
+ The next helper request starts it again. An existing local stdio bridge and the
64
+ helper cannot own the same runtime cache simultaneously; stop the current owner
65
+ before switching between these two arrangements.
66
+ Stop and restart the companion when switching package versions so it runs the
67
+ helper code and bundled agent from the selected installation.
68
+
69
+ Successful local setup copies the bundled agent into the project and creates **ModLens Client** in
70
+ IntelliJ's run configurations. Select that configuration and press Run. The AI can
71
+ also call `runtime` with `action:"launch"` and the returned `projectId`; supply
72
+ `javaHome` if the server's `JAVA_HOME` does not select a suitable JDK.
73
+
74
+ For multi-project builds, select the actual client task, e.g. `:fabric:runClient`.
75
+ The task must extend Gradle `JavaExec`. A generated init script adds the agent to
76
+ that task only. Custom launch plugins which don't expose a JavaExec task get an
77
+ actionable error. Setup also returns `vmOptions` for the actual game JVM in an
78
+ existing Application run configuration. Add every entry, including
79
+ `-XX:StackShadowPages=32`: the 26.3 client needs this setting independently of the
80
+ agent. The generated Gradle/IntelliJ launch supplies it automatically, only to the
81
+ selected client task. **Do not put these options on IntelliJ itself or the Gradle
82
+ daemon.** Quote each whole VM option if it contains spaces. The singular `vmOption`
83
+ field remains available for callers that only need the agent argument.
84
+
85
+ Setup only creates `.modlens/runtime/` and `.run/ModLens Client.run.xml`. It does
86
+ not edit existing run configurations or build files, and refuses to overwrite a
87
+ non-ModLens run configuration. `.modlens/runtime/` contains a local `.gitignore`:
88
+ its connection token and runtime files must stay private. Published npm releases
89
+ include the compiled agent; end users do not need to compile it.
90
+
91
+ ## Modes
92
+
93
+ | Mode | Display | Input |
94
+ | --- | --- | --- |
95
+ | `interactive` | Visible game window | Human controls; MCP input rejected |
96
+ | `observe` | Visible game window | MCP controls; physical game input filtered |
97
+ | `hidden` | Hidden game window | MCP controls; physical game input filtered |
98
+
99
+ Switch a connected client with:
100
+
101
+ ```json
102
+ {"action":"command","sessionId":"<id>","command":{"type":"mode","mode":"hidden"}}
103
+ ```
104
+
105
+ Observe mode uses the actual game window as a watch-only display. OS window
106
+ management, including closing it, remains available. Hidden mode still uses a
107
+ graphics device and desktop/display environment; it is not a GPU-free server.
108
+ Input interception covers the normal SDL paths. Mods using another native input
109
+ path need a separate adapter. This is a development convenience, not an OS security
110
+ boundary. Switching to interactive returns control; click the game to resume mouse
111
+ capture normally.
112
+
113
+ ## AI workflow and tool examples
114
+
115
+ 1. `help` / `status`: discover setup, configured projects, and whether the JAR is packaged.
116
+ 2. `setup`: prepare a specific project (explicitly opts it in).
117
+ 3. `launch`, or let the developer use IntelliJ.
118
+ 4. `sessions`: discover client session IDs, PID, connection status and capabilities.
119
+ 5. `status` with a session ID: read metrics, mode, screen, world state and coordinates.
120
+ 6. `events` with `afterCursor` and `waitMs:30000`: wait for new events without flooding context.
121
+ 7. `command`: send input or request diagnostic artifacts; `artifact` reads the result.
122
+
123
+ ```json
124
+ {"action":"command","sessionId":"<id>","command":{"type":"key","key":"W","down":true,"holdMs":500}}
125
+ {"action":"command","sessionId":"<id>","command":{"type":"mouse_move","x":20,"y":-5,"relative":true}}
126
+ {"action":"command","sessionId":"<id>","command":{"type":"mouse_button","button":1,"down":true,"holdMs":100}}
127
+ {"action":"command","sessionId":"<id>","command":{"type":"text","text":"Hello"}}
128
+ {"action":"command","sessionId":"<id>","command":{"type":"screenshot"}}
129
+ {"action":"artifact","sessionId":"<id>","artifactName":"<returned artifact name>"}
130
+ ```
131
+
132
+ Key names include A–Z, 0–9, SPACE, ENTER, ESCAPE, TAB, arrows, modifiers and F1–F12.
133
+ Numeric strings outside single digits represent SDL scancodes. Mouse buttons are
134
+ 1=left, 2=middle, 3=right. Coordinates are **window pixels**, not scaled GUI units;
135
+ relative movements are deltas. Text sends text-input events independently of keys.
136
+ `scroll` accepts `x` and `y`. Inputs are delivered to the event loop; they do not
137
+ guarantee a particular gameplay result. Observe state or take a screenshot afterward.
138
+
139
+ Held keys/buttons expire within 10 seconds, and are released when the bridge has
140
+ been unreachable for five seconds (as soon as the game event loop runs). Use
141
+ `release_all` to cancel held inputs. Commands have deadlines and aren't replayed
142
+ automatically after uncertain delivery. A timeout means execution is unknown;
143
+ inspect state before retrying an action.
144
+
145
+ Screenshots use 26.3's own renderer-independent screenshot API, after
146
+ `state.observation.gameLoaded` becomes true. PNGs are returned as MCP image content
147
+ by `artifact` over local stdio MCP. The CLI returns the local PNG path for Codex's
148
+ image viewer instead of base64 in terminal text. `threads` writes a thread dump including detected deadlock IDs;
149
+ `recording` writes the recent JFR recording. Files live under
150
+ `.modlens/runtime/sessions/<sessionId>/`. Diagnostic artifacts are local and may
151
+ contain application data; delete old session directories when finished.
152
+
153
+ ## Monitoring and failure semantics
154
+
155
+ The agent samples heap/non-heap usage, thread counts and GC counters every second,
156
+ keeps a bounded two-minute/16 MiB JFR recording, captures uncaught exceptions while
157
+ chaining the previous handler, and hooks the game's fatal crash reporting path.
158
+ It does not intercept every logged/caught exception or exceptions consumed by a
159
+ custom per-thread handler. The optional Minecraft crash hook covers the normal
160
+ client fatal-report path independently of the default uncaught handler.
161
+ Memory-pressure alerts combine sustained collection activity with heap pressure.
162
+ Collection time can include concurrent GC work: it is **not** a stop-the-world
163
+ pause percentage or proof of a memory leak.
164
+
165
+ For allocation churn in your own mod, request a report and read its returned
166
+ artifact through MCP:
167
+
168
+ ```json
169
+ {"action":"command","sessionId":"<id>","command":{"type":"allocations","packagePrefix":"com.example.mymod","windowSeconds":30,"limit":20}}
170
+ {"action":"artifact","sessionId":"<id>","artifactName":"<returned artifact name>"}
171
+ ```
172
+
173
+ The JSON report groups JFR allocation samples by allocated class and matching
174
+ caller, with sample weights and example stacks. Filtering matches callers in the
175
+ package, so allocations made inside Java/Minecraft libraries on behalf of the mod
176
+ can appear too. Omit the filter to inspect all sampled allocation sites. These are
177
+ statistical estimates of allocation pressure, not exact byte counts or retained
178
+ object sizes. Empty or sparse samples are inconclusive; reproduce the workload
179
+ and compare reports alongside heap/GC metrics. Reports use the bounded rolling JFR
180
+ recording, which may contain less history than the requested 5–120 seconds.
181
+ No heap dump or full-GC operation is requested. Retaining paths and GC roots are
182
+ outside this first version. See the [JFR sample-weight definition](https://github.com/openjdk/jdk/blob/jdk-25-ga/src/hotspot/share/jfr/metadata/metadata.xml).
183
+
184
+ The bridge keeps bounded event history with cursors, deduplicates agent replays,
185
+ and persists a rolling journal. A new JVM gets a new session ID. Connection loss
186
+ is reported separately from a crash; native failures/OOM may prevent in-process
187
+ delivery. The generated Gradle run redirects JVM fatal-error logs into
188
+ `.modlens/runtime/`. Commands and telemetry never use Minecraft's network protocol.
189
+
190
+ An active AI task can monitor using bounded event waits. Capturing an event does
191
+ not guarantee an idle Codex task wakes up; host scheduling is separate from MCP.
192
+
193
+ ## Scope and maintenance
194
+
195
+ - Source-analysis use starts no runtime listener. An explicit local helper command
196
+ starts its loopback companion; only setup opts a project in, and only launch
197
+ starts a client process.
198
+ - A previously configured local project reconnects when its ModLens server starts.
199
+ - One local bridge owns a runtime cache at a time; a second connection reports the
200
+ existing owner instead of stealing active clients. Multiple game sessions are
201
+ supported through that bridge.
202
+ - HTTP MCP returns explicit local execution plans. The local helper performs
203
+ runtime actions on the Minecraft PC using the same request schema and dispatcher
204
+ as local stdio MCP. HTTP handlers never execute user-supplied local paths.
205
+ - The agent connects only to authenticated loopback HTTP; no browser control routes.
206
+ - SDL events, keyboard state and mouse state are kept consistent. Input/window code
207
+ lives in `SdlAdapter`; optional game APIs live in `Minecraft263`.
208
+ - Exact transformation descriptors live in `Transformer`. It uses Java 25's
209
+ standard Class-File API and an isolated bootstrap bridge, with no ASM/Gson or
210
+ native agent dependencies to collide with mod loaders.
211
+ - Setup accepts `minecraftHooks:false` to isolate compatibility problems. SDL
212
+ controls and JVM diagnostics remain available; screenshots and structured game
213
+ state require the Minecraft adapter. A GLFW backend belongs to a future backport:
214
+ vanilla 26.3 uses SDL3.
215
+ - Capability presence and validation are distinct. Tests cover selected environments;
216
+ Fabric/NeoForge launchers and rendering replacements still require their own runs.
217
+
218
+ ## Building and testing
219
+
220
+ The initial validation ran on Windows with Java 25, LWJGL 3.4.3, Gradle 9.6 and
221
+ vanilla Minecraft 26.3 using OpenGL. It includes a real hidden client screenshot
222
+ and input delivery, native SDL controls/diagnostics, the Gradle launch path, and a
223
+ fresh npm-package MCP installation. World gameplay and the full mod-loader/rendering
224
+ matrix have not been validated yet.
225
+
226
+ ```sh
227
+ npm ci
228
+ npm run build
229
+ # JAVA_HOME must point to JDK 25 or later:
230
+ npm run build:agent
231
+ npm test
232
+ ```
233
+
234
+ The optional agent build is separate so source-analysis-only development and Docker
235
+ builds retain their existing Java requirements. The npm release workflow builds and
236
+ ships the agent. `npm run test:runtime:native` exercises an actual hidden SDL window;
237
+ set `JAVA_HOME` and `MODLENS_SDL_CLASSPATH` to LWJGL 3.4.3 core/SDL Java and native
238
+ JARs for your platform. It checks input delivery, polling consistency, hardware-like
239
+ event suppression, key expiry, Unicode text, diagnostics and uncaught exceptions.
240
+
241
+ `node scripts/test-runtime-minecraft.mjs` validates an isolated hidden vanilla 26.3
242
+ demo client without reading accounts or worlds. Set `JAVA_HOME`,
243
+ `MODLENS_TEST_MC_MANIFEST`, `MODLENS_TEST_MC_CLIENT`, `MODLENS_TEST_MC_ASSETS`,
244
+ `MODLENS_TEST_MC_ASSET_INDEX` and `MODLENS_TEST_MAVEN_CACHE`. It uses supplied cached
245
+ artifacts and downloads missing libraries with manifest checksum verification.
246
+ Evidence is retained in the printed temporary directory. The test includes the
247
+ required `-XX:StackShadowPages=32` setting and checks a Minecraft allocation report
248
+ alongside screenshots and input. Use `--baseline` to compare startup without the
249
+ agent while retaining the required client JVM options; this baseline can show a
250
+ normal game window.
251
+
252
+ `node scripts/test-runtime-remote.mjs` tests an isolated HTTP MCP server returning
253
+ plans which local CLI processes execute against a real instrumented SDL JVM. It
254
+ checks setup, session persistence, input, allocation reports, crash events, helper
255
+ restart/reconnection, and shutdown without creating a local source database. Set the same JDK/SDL variables
256
+ as the native test. Add `--helper` to the Minecraft or Gradle tests to exercise
257
+ their complete workflows through the CLI companion too.
258
+
259
+ `node scripts/test-runtime-gradle.mjs` tests the generated launch path in a
260
+ disposable JavaExec project, including paths with spaces and exclusion of unrelated
261
+ tasks. Set `JAVA_HOME` and `MODLENS_TEST_GRADLE_HOME` (Gradle 9.6). This tests the
262
+ Gradle integration; it does not replace mod-loader-specific client tests.
package/TESTING.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Run the deterministic regressions with `npm test`. Run `npm run build` before the MCP and package checks below.
4
4
 
5
+ For a package that includes live runtime support, also run `npm run build:agent`
6
+ with JDK 25 before `npm run test:package`. The npm release workflow does this
7
+ automatically. Runtime protocol tests are part of `npm test`; native SDL and real
8
+ 26.3 client checks are described in [RUNTIME.md](RUNTIME.md).
9
+ The packaged-consumer test also exercises the persistent `--runtime` helper.
10
+ `node scripts/test-runtime-remote.mjs` validates HTTP MCP guidance followed by local
11
+ CLI execution against a real Java agent; Minecraft and Gradle tests accept `--helper`.
12
+
5
13
  `npm test` works directly after `npm ci`, before a build. Vitest generates the SQLite client before importing the tests. SQLite integration tests create a temporary template from the Prisma schema, use a fresh database for each test, and isolate their artifact cache. They do not depend on `dist/`, the packaged `template.db`, or earlier test results.
6
14
 
7
15
  ## Minecraft era matrix
@@ -0,0 +1,36 @@
1
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
2
+ import { type LicenseDecision } from "./mod-license.js";
3
+ export declare function localModPlan(decision: LicenseDecision, args: Record<string, unknown>, accepted?: boolean): {
4
+ execution: string;
5
+ executed: boolean;
6
+ requiresUserConsent: boolean;
7
+ reason: string;
8
+ sha256: string;
9
+ selectedOrigin: import("./mod-license.js").LicenseOrigin | undefined;
10
+ steps: string[];
11
+ invocation: {
12
+ executable: string;
13
+ arguments: string[];
14
+ };
15
+ sourceCheckout: {
16
+ executable: string;
17
+ arguments: string[];
18
+ };
19
+ request: {
20
+ localJarPath: string;
21
+ sha256: string;
22
+ className: string;
23
+ operation: string;
24
+ acceptedLocalDecompilation: boolean;
25
+ startLine: {};
26
+ maxLines: {};
27
+ };
28
+ notice: string;
29
+ };
30
+ export declare function reviewHostedMod(args: Record<string, unknown>): Promise<LicenseDecision>;
31
+ export declare function guardHostedMod(tool: string, args: Record<string, unknown>): Promise<{
32
+ blocked?: CallToolResult;
33
+ notices?: LicenseDecision[];
34
+ }>;
35
+ export declare function attachLicenseNotices(result: CallToolResult, decisions: LicenseDecision[]): CallToolResult;
36
+ //# sourceMappingURL=hosted-mod-license.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-mod-license.d.ts","sourceRoot":"","sources":["../src/hosted-mod-license.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAGzE,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAO1E,wBAAgB,YAAY,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,UAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBtG;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAW7F;AAED,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;IAAE,OAAO,CAAC,EAAE,cAAc,CAAC;IAAC,OAAO,CAAC,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC,CAWpJ;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,cAAc,CAOzG"}
@@ -0,0 +1,65 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { resolveModRef } from "./repositories/mod.js";
3
+ import { cachedModLicense } from "./mod-license.js";
4
+ import { projectLicenseArtifact } from "./tools/project.js";
5
+ import { compactNotices } from "./license-notices.js";
6
+ const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
7
+ const out = (value) => ({ content: [{ type: "text", text: JSON.stringify(value) }] });
8
+ export function localModPlan(decision, args, accepted = false) {
9
+ const className = typeof args.className === "string" ? args.className : typeof args.path === "string" ? args.path.replace(/\.java$/, "") : "<class-name>";
10
+ return {
11
+ execution: "local_helper_required", executed: false, requiresUserConsent: !accepted,
12
+ reason: decision.reason, sha256: decision.sha256, selectedOrigin: decision.selectedOrigin,
13
+ steps: [
14
+ "Explain the license decision and obtain the user's explicit acceptance of local decompilation for this exact artifact. Never infer acceptance from requesting hosted source.",
15
+ "Locate this JAR on the user's computer (for example their mods directory or Gradle cache). The helper verifies the SHA-256. Do not use a path on the hosted server.",
16
+ "Write the request below as a UTF-8 JSON file locally. Replace the local JAR path and class name as needed. Set acceptedLocalDecompilation only after user acceptance; otherwise the helper prompts in an interactive terminal.",
17
+ "Execute the helper with the local terminal tool and read its JSON result. It provisions the existing Java/decompiler tooling as needed. No hosted upload or second MCP connection is required.",
18
+ ],
19
+ invocation: { executable: "npx", arguments: ["-y", `@creeperhost/modlens-mcp@${pkg.version}`, "--local-mod", "--request-file", "<local-request.json>"] },
20
+ sourceCheckout: { executable: "node", arguments: ["<local-modlens-checkout>/dist/launcher.js", "--local-mod", "--request-file", "<local-request.json>"] },
21
+ request: { localJarPath: "<absolute-path-to-local-mod.jar>", sha256: decision.sha256, className,
22
+ operation: args.action === "bytecode" ? "bytecode" : "source", acceptedLocalDecompilation: accepted,
23
+ startLine: args.startLine ?? 1, maxLines: args.maxLines ?? 200 },
24
+ notice: "Local acceptance is not permission from the copyright holder and does not authorize hosted redistribution. Keep restricted output local.",
25
+ };
26
+ }
27
+ export async function reviewHostedMod(args) {
28
+ if (args.projectKey !== undefined) {
29
+ const artifact = await projectLicenseArtifact(String(args.projectKey), String(args.environmentId ?? ""), String(args.className ?? ""));
30
+ return cachedModLicense(artifact);
31
+ }
32
+ const ref = args.dbId ?? args.modId;
33
+ if (typeof ref !== "string" && typeof ref !== "number")
34
+ throw new Error("Specify modId/dbId, or a project class, to inspect its license.");
35
+ const mod = await resolveModRef(ref);
36
+ if (!mod)
37
+ throw new Error("Mod not found.");
38
+ const metadata = mod.metadata;
39
+ return cachedModLicense(mod.jarPath, { version: mod.version, sourceUrl: typeof metadata?.sourceUrl === "string" ? metadata.sourceUrl : undefined });
40
+ }
41
+ export async function guardHostedMod(tool, args) {
42
+ const action = String(args.action);
43
+ const modSource = tool === "mod" && ["source", "decompile_class", "search_source", "search_indexed", "graph_query", "graph_report"].includes(action);
44
+ const bytecode = tool === "mod_bytecode" && action === "bytecode";
45
+ const project = tool === "project" && ["source", "bytecode"].includes(action);
46
+ if (!modSource && !bytecode && !project)
47
+ return {};
48
+ if (!project && args.modId === undefined && args.dbId === undefined && args.dbIdA === undefined)
49
+ return { blocked: out({ execution: "license_review_required", executed: false,
50
+ reason: "Specify modId/dbId for hosted source search so the correct artifact license can be checked. Metadata/class searches remain available." }) };
51
+ const decision = await reviewHostedMod(args);
52
+ if (decision.disposition !== "hosted_allowed")
53
+ return { blocked: out({ licenseReview: decision, local: localModPlan(decision, args) }) };
54
+ return { notices: [decision] };
55
+ }
56
+ export function attachLicenseNotices(result, decisions) {
57
+ if (result.isError || !decisions.length)
58
+ return result;
59
+ return { ...result, content: [...result.content, { type: "text", text: JSON.stringify({ licenseCompliance: decisions.map(d => ({
60
+ sha256: d.sha256, license: d.selectedLicense, origin: d.selectedOrigin, notices: compactNotices(d.notices), conditions: d.conditions,
61
+ sourceUrl: d.sourceUrl, modifiedAt: new Date().toISOString(),
62
+ notice: `ModLens reconstructed or excerpted this output. Any ModLens contributions to this output are offered under ${d.selectedLicense}. Retain these notices with copies. No warranty is provided. This licence applies to the mod output, not unrelated Minecraft code or ModLens itself.`,
63
+ })) }) }] };
64
+ }
65
+ //# sourceMappingURL=hosted-mod-license.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-mod-license.js","sourceRoot":"","sources":["../src/hosted-mod-license.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAwB,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1F,MAAM,GAAG,GAAG,CAAC,KAAc,EAAkB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAE/G,MAAM,UAAU,YAAY,CAAC,QAAyB,EAAE,IAA6B,EAAE,QAAQ,GAAG,KAAK;IACnG,MAAM,SAAS,GAAG,OAAO,IA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,CAAC,CAAC;wBAC3H,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC,CAAC,cAAc,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU;wBACpI,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;wBAC5D,MAAM,EAAE,8GAA8G,CAAC,CAAC,eAAe,sJAAsJ;qBAChS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAChB,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { IncomingHttpHeaders } from "node:http";
2
+ import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
+ export interface HostedLimits {
4
+ lines: number;
5
+ responseBytes: number;
6
+ dailyBytes: number;
7
+ periodBytes: number;
8
+ dailyRequests: number;
9
+ minuteRequests: number;
10
+ }
11
+ export declare function hostedLimits(env?: NodeJS.ProcessEnv): HostedLimits;
12
+ export declare class HostedPolicyError extends Error {
13
+ }
14
+ /** Only an authenticated gateway may choose the stable account identifier. */
15
+ export declare function hostedPrincipal(headers: IncomingHttpHeaders, secret?: string): string;
16
+ export declare const HOSTED_ACTIONS: Record<string, readonly string[]>;
17
+ export declare function prepareHostedArgs(tool: string, input: Record<string, unknown>, limits: HostedLimits): Record<string, unknown>;
18
+ export interface BudgetDatabase {
19
+ $executeRawUnsafe(query: string, ...values: any[]): Promise<number>;
20
+ $queryRawUnsafe<T>(query: string, ...values: any[]): Promise<T>;
21
+ }
22
+ /** Atomic shared-database accounting: session churn, parallel calls and restarts do not reset it. */
23
+ export declare class HostedBudget {
24
+ private database;
25
+ private now;
26
+ private ready?;
27
+ constructor(database?: () => Promise<BudgetDatabase>, now?: () => number);
28
+ charge(subject: string, limits: HostedLimits, requests: number, bytes: number): Promise<void>;
29
+ }
30
+ export declare function boundHostedResult(tool: string, args: Record<string, unknown>, result: CallToolResult, limits: HostedLimits): CallToolResult;
31
+ export declare function runHostedTool(tool: string, input: Record<string, unknown>, subject: string, limits: HostedLimits, budget: HostedBudget, run: (args: Record<string, unknown>) => Promise<CallToolResult>): Promise<CallToolResult>;
32
+ //# sourceMappingURL=hosted-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted-policy.d.ts","sourceRoot":"","sources":["../src/hosted-policy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAIzE,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,YAAY,CAiB/E;AAED,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C,8EAA8E;AAC9E,wBAAgB,eAAe,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAUrF;AAID,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CA2B5D,CAAC;AAQF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyC7H;AAED,MAAM,WAAW,cAAc;IAC3B,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,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