mcinsight-mcp-server 0.0.0-stage → 0.1.0-beta.1

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 (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +175 -2
  3. package/dist/client/mcClient.d.ts +68 -0
  4. package/dist/client/mcClient.js +231 -0
  5. package/dist/client/mcClient.js.map +1 -0
  6. package/dist/decompiler/jarInspector.d.ts +139 -0
  7. package/dist/decompiler/jarInspector.js +1119 -0
  8. package/dist/decompiler/jarInspector.js.map +1 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.js +73 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/parsers/modParsers/ae2Parser.d.ts +2 -0
  13. package/dist/parsers/modParsers/ae2Parser.js +61 -0
  14. package/dist/parsers/modParsers/ae2Parser.js.map +1 -0
  15. package/dist/parsers/modParsers/arsNouveauParser.d.ts +2 -0
  16. package/dist/parsers/modParsers/arsNouveauParser.js +63 -0
  17. package/dist/parsers/modParsers/arsNouveauParser.js.map +1 -0
  18. package/dist/parsers/modParsers/createParser.d.ts +2 -0
  19. package/dist/parsers/modParsers/createParser.js +108 -0
  20. package/dist/parsers/modParsers/createParser.js.map +1 -0
  21. package/dist/parsers/modParsers/farmersDelightParser.d.ts +2 -0
  22. package/dist/parsers/modParsers/farmersDelightParser.js +51 -0
  23. package/dist/parsers/modParsers/farmersDelightParser.js.map +1 -0
  24. package/dist/parsers/modParsers/index.d.ts +24 -0
  25. package/dist/parsers/modParsers/index.js +61 -0
  26. package/dist/parsers/modParsers/index.js.map +1 -0
  27. package/dist/parsers/modParsers/mekanismParser.d.ts +2 -0
  28. package/dist/parsers/modParsers/mekanismParser.js +103 -0
  29. package/dist/parsers/modParsers/mekanismParser.js.map +1 -0
  30. package/dist/parsers/modParsers/oritechParser.d.ts +2 -0
  31. package/dist/parsers/modParsers/oritechParser.js +59 -0
  32. package/dist/parsers/modParsers/oritechParser.js.map +1 -0
  33. package/dist/parsers/modParsers/tofucraftParser.d.ts +2 -0
  34. package/dist/parsers/modParsers/tofucraftParser.js +83 -0
  35. package/dist/parsers/modParsers/tofucraftParser.js.map +1 -0
  36. package/dist/parsers/modParsers/types.d.ts +34 -0
  37. package/dist/parsers/modParsers/types.js +87 -0
  38. package/dist/parsers/modParsers/types.js.map +1 -0
  39. package/dist/parsers/modVersion.d.ts +3 -0
  40. package/dist/parsers/modVersion.js +41 -0
  41. package/dist/parsers/modVersion.js.map +1 -0
  42. package/dist/parsers/nativeParsers.d.ts +83 -0
  43. package/dist/parsers/nativeParsers.js +332 -0
  44. package/dist/parsers/nativeParsers.js.map +1 -0
  45. package/dist/server.d.ts +10 -0
  46. package/dist/server.js +70 -0
  47. package/dist/server.js.map +1 -0
  48. package/dist/tools/codeTools.d.ts +7 -0
  49. package/dist/tools/codeTools.js +110 -0
  50. package/dist/tools/codeTools.js.map +1 -0
  51. package/dist/tools/guideTools.d.ts +3 -0
  52. package/dist/tools/guideTools.js +51 -0
  53. package/dist/tools/guideTools.js.map +1 -0
  54. package/dist/tools/helpers.d.ts +58 -0
  55. package/dist/tools/helpers.js +68 -0
  56. package/dist/tools/helpers.js.map +1 -0
  57. package/dist/tools/mechanicsTools.d.ts +3 -0
  58. package/dist/tools/mechanicsTools.js +332 -0
  59. package/dist/tools/mechanicsTools.js.map +1 -0
  60. package/dist/tools/registryTools.d.ts +3 -0
  61. package/dist/tools/registryTools.js +57 -0
  62. package/dist/tools/registryTools.js.map +1 -0
  63. package/dist/tools/worldStateTools.d.ts +3 -0
  64. package/dist/tools/worldStateTools.js +54 -0
  65. package/dist/tools/worldStateTools.js.map +1 -0
  66. package/dist/transports/http.d.ts +9 -0
  67. package/dist/transports/http.js +48 -0
  68. package/dist/transports/http.js.map +1 -0
  69. package/dist/transports/stdio.d.ts +2 -0
  70. package/dist/transports/stdio.js +7 -0
  71. package/dist/transports/stdio.js.map +1 -0
  72. package/package.json +59 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Minetake
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,176 @@
1
- # Temporary Holding Version
1
+ # McInsightMCP
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **English** | [日本語](README.ja.md)
4
+
5
+ [![CI](https://github.com/minetake01/McInsightMCP/actions/workflows/ci.yml/badge.svg)](https://github.com/minetake01/McInsightMCP/actions/workflows/ci.yml)
6
+ [![Release](https://img.shields.io/github/v/release/minetake01/McInsightMCP?include_prereleases&label=release)](https://github.com/minetake01/McInsightMCP/releases)
7
+ [![Status: Beta](https://img.shields.io/badge/Status-Beta-yellow.svg)](CHANGELOG.md)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
9
+ [![Minecraft](https://img.shields.io/badge/Minecraft-NeoForge%20%7C%20Fabric-62B47A.svg)](https://github.com/minetake01/McInsightMCP/releases)
10
+
11
+ **Ask your AI assistant about the Minecraft world you are actually playing.**
12
+
13
+ McInsightMCP connects MCP-compatible AI assistants (Claude Desktop, Cursor, Claude Code, VS Code, and others) directly to your running **Minecraft** game. Instead of guessing from outdated wikis, your AI can look up real recipes in your modpack (including KubeJS and datapack tweaks), see what block or machine you are looking at, check your inventory, read in-game guidebooks and quests, and inspect how unfamiliar mods actually work.
14
+
15
+ > [!NOTE]
16
+ > **Beta Release (`0.1.0-beta.1`)**: McInsightMCP is currently in beta. MCP tool schemas, response formats, and configuration options may change before `1.0.0`. Bug reports and feedback are welcome via [GitHub Issues](https://github.com/minetake01/McInsightMCP/issues).
17
+
18
+ ---
19
+
20
+ ## Why Use McInsightMCP?
21
+
22
+ - **Accurate to Your Modpack**: Reads live recipes, ore generation, loot tables, villager trades, advancements, and KubeJS/datapack overrides straight from the running game.
23
+ - **100% Read-Only & Safe**: Never breaks blocks, edits your world, moves your player, or sends commands. It only observes.
24
+ - **Local-Only by Default**: Runs on `127.0.0.1` on your machine — no external servers, no telemetry, and no screen capture.
25
+ - **Client-Friendly Multiplayer**: Works on multiplayer servers even when installed only on your client (recipes, inventory, raycast target, and guides). In singleplayer — or when also installed on the server — it additionally reads full machine/chest NBT and dynamic loot tables.
26
+ - **Works With Any Modpack**: Automatically integrates with optional mods when installed, and can even inspect mod resources or decompile mod classes when documentation is missing.
27
+
28
+ ---
29
+
30
+ ## What You Can Ask Your AI
31
+
32
+ - *"How do I craft or obtain `mekanism:atomic_alloy` in this pack, and do I already have the materials in my inventory?"*
33
+ - *"What is this machine I'm looking at right now, and why isn't it running?"*
34
+ - *"At what Y-level and in which biomes does this modpack's osmium or platinum ore generate?"*
35
+ - *"Search the Patchouli / FTB Quests / Create Ponder / GuideME docs for how to automate this resource."*
36
+ - *"I can't find any wiki page for this modded item — check the mod itself and explain how the mechanic works."*
37
+
38
+ ---
39
+
40
+ ## Requirements & Supported Integrations
41
+
42
+ | Component | Requirement |
43
+ |---|---|
44
+ | **Minecraft** | Currently `1.21.1` (Java 21) — see [Releases](https://github.com/minetake01/McInsightMCP/releases) for supported versions |
45
+ | **NeoForge** | Standalone — no required mod dependencies |
46
+ | **Fabric** | Requires [Fabric API](https://modrinth.com/mod/fabric-api) |
47
+ | **MCP Server** | [Node.js](https://nodejs.org/) `>= 20` |
48
+
49
+ ### Optional In-Game Integrations (Auto-Detected)
50
+ - **JEI** (categories, catalysts, and JEI item info pages)
51
+ - **In-Game Guides & Quests**: Patchouli, GuideME, FTB Quests, Create Ponder, Oracle Index, and mod language files
52
+
53
+ ### Built-In Mod Recipe Formatting
54
+ Works with **any** modpack via raw recipe data, and includes dedicated structured recipe formatting for **Create**, **Mekanism**, **Applied Energistics 2**, **Oritech**, **Farmer's Delight**, **Ars Nouveau**, and **TofuCraftReload**.
55
+
56
+ ---
57
+
58
+ ## Quick Start
59
+
60
+ ### Step 1: Install the Minecraft Mod
61
+
62
+ 1. Download the mod JAR for your Minecraft version and loader from [GitHub Releases](https://github.com/minetake01/McInsightMCP/releases):
63
+ - **NeoForge**: `mcinsight-neoforge-<mc_version>-<version>.jar`
64
+ - **Fabric**: `mcinsight-fabric-<mc_version>-<version>.jar` (also make sure **Fabric API** is in `mods/`)
65
+ 2. Place the JAR into your Minecraft instance's `mods/` folder.
66
+ 3. Launch Minecraft and load into a world.
67
+
68
+ ### Step 2: Connect Your AI Client
69
+
70
+ #### Option A: `stdio` via `npx` / `pnpx` (Recommended for Claude Desktop, Cursor, Claude Code, VS Code)
71
+
72
+ Add this to your MCP client configuration:
73
+
74
+ ```json
75
+ {
76
+ "mcpServers": {
77
+ "mcinsight": {
78
+ "command": "npx",
79
+ "args": ["-y", "mcinsight-mcp-server@beta", "--stdio"]
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ With `pnpm`, you can also use `"command": "pnpx"` and `"args": ["mcinsight-mcp-server@beta", "--stdio"]`.
86
+
87
+ #### Option B: Streamable HTTP
88
+
89
+ Start the server locally:
90
+
91
+ ```bash
92
+ npx -y mcinsight-mcp-server@beta --http --port 3876
93
+ # or with pnpm:
94
+ pnpx mcinsight-mcp-server@beta --http --port 3876
95
+ ```
96
+
97
+ Then point your MCP client to `http://127.0.0.1:3876/mcp`.
98
+
99
+ #### Manual / Offline Setup (GitHub Releases)
100
+
101
+ You can also download and extract `mcinsight-mcp-server-<version>` from [GitHub Releases](https://github.com/minetake01/McInsightMCP/releases), install runtime dependencies inside the extracted folder (`pnpm install --prod` or `npm install --omit=dev`), and run `node /path/to/mcinsight-mcp-server/dist/index.js --stdio` (or build from source — see below).
102
+
103
+ > **Tip**: By default, the MCP server automatically discovers a running McInsight mod on `127.0.0.1` ports `25580..25599` — no manual port configuration needed.
104
+
105
+ ---
106
+
107
+ ## Optional Configuration
108
+
109
+ ### Minecraft Mod (`config/mcinsight.json`)
110
+
111
+ Generated automatically on first launch:
112
+
113
+ | Key | Default | Description |
114
+ |---|---|---|
115
+ | `enabled` | `true` | Enable or disable the local HTTP API |
116
+ | `port` | `25580` | Starting loopback port to bind (`1024..65535`) |
117
+ | `portRangeSize` | `20` | Number of consecutive ports to try if the port is busy (`1..50`) |
118
+ | `authToken` | `""` | Optional Bearer token required for API requests |
119
+ | `maxScanRadius` | `16` | Maximum radius for nearby area scans (`1..32`) |
120
+ | `maxRecipeResults` | `100` | Maximum recipes returned per query (`1..500`) |
121
+
122
+ ### MCP Server CLI Flags & Environment Variables
123
+
124
+ | CLI Flag | Environment Variable | Purpose |
125
+ |---|---|---|
126
+ | `--stdio` | — | Run over stdio (default) |
127
+ | `--http` | — | Run as a local Streamable HTTP server |
128
+ | `--port <port>` | `MCP_PORT` | HTTP server port (default `3876`) |
129
+ | `--mc-url <url>` | `MCINSIGHT_URL` | Explicit mod URL (skips port auto-discovery) |
130
+ | `--token <token>` | `MCINSIGHT_TOKEN` | Bearer token matching `authToken` in `mcinsight.json` |
131
+ | `--mods-dir <path>` | `MCINSIGHT_MODS_DIR` | Mods folder path for offline JAR inspection |
132
+ | `--game-dir <path>` | `MCINSIGHT_GAME_DIR` | Game folder path for offline KubeJS / FTB Quests scanning |
133
+ | `--tools-dir <path>` | `MCINSIGHT_TOOLS_DIR` | Cache directory for downloaded decompiler tools (Vineflower) |
134
+
135
+ ---
136
+
137
+ ## Available AI Tools
138
+
139
+ McInsightMCP exposes 11 tools to your AI assistant:
140
+
141
+ - **World & Player**: `mc_status`, `mc_player_state`, `mc_observe_world` (what you are looking at or nearby blocks/entities)
142
+ - **Items & Blocks**: `mc_search_registry`, `mc_inspect` (block properties, tags, JEI info)
143
+ - **Progression & Crafting**: `mc_query_item_flow`, `mc_query_recipes`, `mc_query_world_data` (worldgen, loot tables, trades, NeoForge data maps), `mc_query_advancements`
144
+ - **Guides & Mod Internals**: `mc_guides` (Patchouli, GuideME, FTB Quests, Ponder, Oracle Index, lang), `mc_inspect_code` (resource/script search & Java class inspection)
145
+
146
+ ---
147
+
148
+ ## Building from Source
149
+
150
+ Requires **JDK 21** for the mod and **Node.js >= 20** + **pnpm** for the MCP server.
151
+
152
+ ```bash
153
+ # 1. Build the NeoForge and Fabric mod JARs
154
+ cd mod
155
+ ./gradlew :neoforge:build :fabric:build
156
+ # Output JARs:
157
+ # mod/neoforge/build/libs/mcinsight-neoforge-<mc_version>-0.1.0-beta.1.jar
158
+ # mod/fabric/build/libs/mcinsight-fabric-<mc_version>-0.1.0-beta.1.jar
159
+
160
+ # 2. Build and test the MCP server
161
+ cd ../mcp-server
162
+ pnpm install
163
+ pnpm typecheck
164
+ pnpm build
165
+ pnpm test
166
+ ```
167
+
168
+ ---
169
+
170
+ ## Documentation & Links
171
+
172
+ - [Architecture & Protocol Specification](docs/ARCHITECTURE.md) — Technical details, parser tiers, HTTP endpoints, and threading model
173
+ - [Contributing Guide](CONTRIBUTING.md) — Development setup, testing, and how to add mod parsers
174
+ - [Security Policy](SECURITY.md) — Read-only & loopback guarantees and vulnerability reporting
175
+ - [Changelog](CHANGELOG.md) — Release history
176
+ - [License (MIT)](LICENSE)
@@ -0,0 +1,68 @@
1
+ export declare class McConnectionError extends Error {
2
+ constructor(message: string);
3
+ }
4
+ export declare class McApiError extends Error {
5
+ readonly statusCode: number;
6
+ readonly code: string;
7
+ constructor(statusCode: number, code: string, message: string);
8
+ }
9
+ export interface McModInfo {
10
+ id: string;
11
+ name: string;
12
+ version: string;
13
+ description?: string;
14
+ jarPath?: string;
15
+ }
16
+ export interface McStatusResponse {
17
+ ok: boolean;
18
+ modId: string;
19
+ modVersion: string;
20
+ minecraftVersion: string;
21
+ loader: string;
22
+ loaderVersion: string;
23
+ port: number;
24
+ side: string;
25
+ gameDir: string;
26
+ modsDir: string;
27
+ configDir: string;
28
+ integratedOrDedicatedServerActive: boolean;
29
+ isSingleplayer: boolean;
30
+ worldLoaded: boolean;
31
+ dimension?: string;
32
+ difficulty?: string;
33
+ integrations?: Record<string, boolean>;
34
+ modCount: number;
35
+ mods?: McModInfo[];
36
+ }
37
+ export interface McClientOptions {
38
+ baseUrl?: string;
39
+ authToken?: string;
40
+ portStart?: number;
41
+ portEnd?: number;
42
+ timeoutMs?: number;
43
+ metadataTtlMs?: number;
44
+ }
45
+ export declare class McHttpClient {
46
+ private discoveredUrl;
47
+ private probeInFlight;
48
+ private cachedModVersions;
49
+ private modVersionsInFlight;
50
+ private cachedPaths;
51
+ private pathsInFlight;
52
+ private readonly explicitUrl?;
53
+ private readonly authToken?;
54
+ private readonly portStart;
55
+ private readonly portEnd;
56
+ private readonly timeoutMs;
57
+ private readonly metadataTtlMs;
58
+ constructor(opts?: McClientOptions);
59
+ invalidateCache(): void;
60
+ private probeHostParallel;
61
+ private probeBaseUrl;
62
+ private buildHeaders;
63
+ get<T = Record<string, unknown>>(endpoint: string, query?: Record<string, string | number | boolean | undefined>): Promise<T>;
64
+ private fetchAndCachePaths;
65
+ tryGetModsDir(): Promise<string | undefined>;
66
+ tryGetGameDir(): Promise<string | undefined>;
67
+ tryGetLoadedModVersions(): Promise<Map<string, string> | undefined>;
68
+ }
@@ -0,0 +1,231 @@
1
+ export class McConnectionError extends Error {
2
+ constructor(message) {
3
+ super(message);
4
+ this.name = 'McConnectionError';
5
+ }
6
+ }
7
+ export class McApiError extends Error {
8
+ statusCode;
9
+ code;
10
+ constructor(statusCode, code, message) {
11
+ super(message);
12
+ this.statusCode = statusCode;
13
+ this.code = code;
14
+ this.name = 'McApiError';
15
+ }
16
+ }
17
+ const DEFAULT_METADATA_TTL_MS = 60_000;
18
+ export class McHttpClient {
19
+ discoveredUrl;
20
+ probeInFlight;
21
+ cachedModVersions;
22
+ modVersionsInFlight;
23
+ cachedPaths;
24
+ pathsInFlight;
25
+ explicitUrl;
26
+ authToken;
27
+ portStart;
28
+ portEnd;
29
+ timeoutMs;
30
+ metadataTtlMs;
31
+ constructor(opts = {}) {
32
+ this.explicitUrl = opts.baseUrl;
33
+ this.authToken = opts.authToken;
34
+ this.portStart = opts.portStart ?? 25580;
35
+ this.portEnd = opts.portEnd ?? 25599;
36
+ this.timeoutMs = opts.timeoutMs ?? 12000;
37
+ this.metadataTtlMs = opts.metadataTtlMs ?? DEFAULT_METADATA_TTL_MS;
38
+ }
39
+ invalidateCache() {
40
+ this.cachedModVersions = undefined;
41
+ this.cachedPaths = undefined;
42
+ }
43
+ async probeHostParallel(host) {
44
+ const controller = new AbortController();
45
+ const timeoutId = setTimeout(() => controller.abort(), 500);
46
+ const probes = [];
47
+ for (let port = this.portStart; port <= this.portEnd; port++) {
48
+ const candidate = `http://${host}:${port}`;
49
+ probes.push((async () => {
50
+ const res = await fetch(`${candidate}/api/v1/status`, {
51
+ headers: this.buildHeaders(),
52
+ signal: controller.signal,
53
+ });
54
+ if (!res.ok) {
55
+ throw new Error(`HTTP ${res.status}`);
56
+ }
57
+ const data = (await res.json());
58
+ if (data?.modId !== 'mcinsight') {
59
+ throw new Error('Not mcinsight');
60
+ }
61
+ return candidate;
62
+ })());
63
+ }
64
+ try {
65
+ const winner = await Promise.any(probes);
66
+ controller.abort();
67
+ return winner;
68
+ }
69
+ catch {
70
+ return null;
71
+ }
72
+ finally {
73
+ clearTimeout(timeoutId);
74
+ }
75
+ }
76
+ async probeBaseUrl() {
77
+ if (this.explicitUrl) {
78
+ return this.explicitUrl.replace(/\/+$/, '');
79
+ }
80
+ if (this.discoveredUrl) {
81
+ return this.discoveredUrl;
82
+ }
83
+ if (this.probeInFlight) {
84
+ return this.probeInFlight;
85
+ }
86
+ const promise = (async () => {
87
+ const ipv4Hit = await this.probeHostParallel('127.0.0.1');
88
+ if (ipv4Hit) {
89
+ this.discoveredUrl = ipv4Hit;
90
+ return ipv4Hit;
91
+ }
92
+ const ipv6Hit = await this.probeHostParallel('[::1]');
93
+ if (ipv6Hit) {
94
+ this.discoveredUrl = ipv6Hit;
95
+ return ipv6Hit;
96
+ }
97
+ throw new McConnectionError(`Could not find a running McInsight mod on 127.0.0.1:${this.portStart}-${this.portEnd}. Ensure Minecraft with the McInsight mod is running (or pass --mc-url / MCINSIGHT_URL).`);
98
+ })();
99
+ this.probeInFlight = promise;
100
+ try {
101
+ return await promise;
102
+ }
103
+ finally {
104
+ if (this.probeInFlight === promise) {
105
+ this.probeInFlight = undefined;
106
+ }
107
+ }
108
+ }
109
+ buildHeaders() {
110
+ const headers = { Accept: 'application/json' };
111
+ if (this.authToken) {
112
+ headers.Authorization = `Bearer ${this.authToken}`;
113
+ }
114
+ return headers;
115
+ }
116
+ async get(endpoint, query) {
117
+ const baseUrl = await this.probeBaseUrl();
118
+ const url = new URL(`${baseUrl}${endpoint}`);
119
+ if (query) {
120
+ for (const [k, v] of Object.entries(query)) {
121
+ if (v !== undefined && v !== '') {
122
+ url.searchParams.set(k, String(v));
123
+ }
124
+ }
125
+ }
126
+ let res;
127
+ try {
128
+ res = await fetch(url, {
129
+ headers: this.buildHeaders(),
130
+ signal: AbortSignal.timeout(this.timeoutMs),
131
+ });
132
+ }
133
+ catch (err) {
134
+ // Clear cached port/metadata and retry discovery once if explicit URL wasn't pinned
135
+ if (!this.explicitUrl && this.discoveredUrl) {
136
+ this.discoveredUrl = undefined;
137
+ this.invalidateCache();
138
+ const freshBase = await this.probeBaseUrl();
139
+ const retryUrl = new URL(`${freshBase}${endpoint}`);
140
+ retryUrl.search = url.search;
141
+ res = await fetch(retryUrl, {
142
+ headers: this.buildHeaders(),
143
+ signal: AbortSignal.timeout(this.timeoutMs),
144
+ });
145
+ }
146
+ else {
147
+ throw new McConnectionError(`Failed to connect to McInsight HTTP API at ${url.toString()}: ${err instanceof Error ? err.message : String(err)}`);
148
+ }
149
+ }
150
+ const body = (await res.json());
151
+ if (!res.ok || body.ok === false) {
152
+ throw new McApiError(res.status, String(body.code ?? 'HTTP_ERROR'), String(body.error ?? `HTTP ${res.status} from ${endpoint}`));
153
+ }
154
+ return body;
155
+ }
156
+ async fetchAndCachePaths() {
157
+ const now = Date.now();
158
+ if (this.cachedPaths && this.cachedPaths.expiresAt > now) {
159
+ return this.cachedPaths;
160
+ }
161
+ if (this.pathsInFlight) {
162
+ return this.pathsInFlight;
163
+ }
164
+ const promise = (async () => {
165
+ try {
166
+ const status = await this.get('/api/v1/status');
167
+ const entry = {
168
+ expiresAt: Date.now() + this.metadataTtlMs,
169
+ modsDir: status.modsDir,
170
+ gameDir: status.gameDir,
171
+ };
172
+ this.cachedPaths = entry;
173
+ return entry;
174
+ }
175
+ catch {
176
+ return undefined;
177
+ }
178
+ })();
179
+ this.pathsInFlight = promise;
180
+ try {
181
+ return await promise;
182
+ }
183
+ finally {
184
+ if (this.pathsInFlight === promise) {
185
+ this.pathsInFlight = undefined;
186
+ }
187
+ }
188
+ }
189
+ async tryGetModsDir() {
190
+ return (await this.fetchAndCachePaths())?.modsDir;
191
+ }
192
+ async tryGetGameDir() {
193
+ return (await this.fetchAndCachePaths())?.gameDir;
194
+ }
195
+ async tryGetLoadedModVersions() {
196
+ const now = Date.now();
197
+ if (this.cachedModVersions && this.cachedModVersions.expiresAt > now) {
198
+ return this.cachedModVersions.map;
199
+ }
200
+ if (this.modVersionsInFlight) {
201
+ return this.modVersionsInFlight;
202
+ }
203
+ const promise = (async () => {
204
+ try {
205
+ const res = await this.get('/api/v1/mods');
206
+ const map = new Map();
207
+ for (const m of res.mods ?? []) {
208
+ map.set(m.id, m.version);
209
+ }
210
+ this.cachedModVersions = {
211
+ expiresAt: Date.now() + this.metadataTtlMs,
212
+ map,
213
+ };
214
+ return map;
215
+ }
216
+ catch {
217
+ return undefined;
218
+ }
219
+ })();
220
+ this.modVersionsInFlight = promise;
221
+ try {
222
+ return await promise;
223
+ }
224
+ finally {
225
+ if (this.modVersionsInFlight === promise) {
226
+ this.modVersionsInFlight = undefined;
227
+ }
228
+ }
229
+ }
230
+ }
231
+ //# sourceMappingURL=mcClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcClient.js","sourceRoot":"","sources":["../../src/client/mcClient.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,MAAM,OAAO,UAAW,SAAQ,KAAK;IAEjB;IACA;IAFlB,YACkB,UAAkB,EAClB,IAAY,EAC5B,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,eAAU,GAAV,UAAU,CAAQ;QAClB,SAAI,GAAJ,IAAI,CAAQ;QAI5B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAyCD,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAEvC,MAAM,OAAO,YAAY;IACf,aAAa,CAAqB;IAClC,aAAa,CAA8B;IAE3C,iBAAiB,CAA8D;IAC/E,mBAAmB,CAAuD;IAE1E,WAAW,CAAwE;IACnF,aAAa,CAA0E;IAE9E,WAAW,CAAU;IACrB,SAAS,CAAU;IACnB,SAAS,CAAS;IAClB,OAAO,CAAS;IAChB,SAAS,CAAS;IACl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,CAAC,EAAE,CAAC;QAEL,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC;QACnC,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC;QACvB,CAAC;gBAAS,CAAC;YACT,IAAI,IAAI,CAAC,mBAAmB,KAAK,OAAO,EAAE,CAAC;gBACzC,IAAI,CAAC,mBAAmB,GAAG,SAAS,CAAC;YACvC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,139 @@
1
+ export interface JarMatch {
2
+ jarPath: string;
3
+ fileName: string;
4
+ matchedEntry?: string;
5
+ }
6
+ export interface JarSearchHit {
7
+ jarFile: string;
8
+ entryName: string;
9
+ kind: 'class' | 'resource';
10
+ }
11
+ export interface JarContentHit {
12
+ jarFile: string;
13
+ entryName: string;
14
+ kind: 'resource' | 'class_string';
15
+ snippet: string;
16
+ }
17
+ export interface SearchJarContentsOptions {
18
+ modIdOrJar?: string;
19
+ filePattern?: string;
20
+ includeClassStrings?: boolean;
21
+ limit?: number;
22
+ }
23
+ export declare function extractClassUtf8Strings(buf: Buffer): string[];
24
+ export interface PackFileHit {
25
+ relativePath: string;
26
+ snippet: string;
27
+ }
28
+ export interface DeclaredFieldCandidate {
29
+ jarFile: string;
30
+ declaringClass: string;
31
+ fieldName: string;
32
+ descriptor: string;
33
+ matchedLiteral: string;
34
+ }
35
+ export interface FieldReferenceHit {
36
+ jarFile: string;
37
+ className: string;
38
+ referencedField: string;
39
+ isDatagenOrMeta: boolean;
40
+ }
41
+ export interface IdTraceResult {
42
+ query: string;
43
+ declaredFields: DeclaredFieldCandidate[];
44
+ fieldReferences: FieldReferenceHit[];
45
+ directStringMatches: Array<{
46
+ jarFile: string;
47
+ className: string;
48
+ matchedStrings: string[];
49
+ }>;
50
+ resourceMatches: JarContentHit[];
51
+ packMatches?: PackFileHit[];
52
+ }
53
+ export interface TraceIdOptions {
54
+ modIdOrJar?: string;
55
+ crossMod?: boolean;
56
+ gameDir?: string;
57
+ limit?: number;
58
+ }
59
+ interface ParsedClassInfo {
60
+ thisClassInternal: string;
61
+ thisClassDot: string;
62
+ stringLiterals: string[];
63
+ fieldRefs: Array<{
64
+ owner: string;
65
+ name: string;
66
+ descriptor: string;
67
+ }>;
68
+ scanClinitBindings(matchFn: (lit: string) => boolean): Array<{
69
+ literal: string;
70
+ owner: string;
71
+ fieldName: string;
72
+ descriptor: string;
73
+ }>;
74
+ }
75
+ export declare function inspectClassBytecode(buf: Buffer): ParsedClassInfo | null;
76
+ interface IndexedJarEntry {
77
+ name: string;
78
+ nameLower: string;
79
+ dotClassLower: string;
80
+ isClass: boolean;
81
+ }
82
+ interface IndexedJarFile {
83
+ jarPath: string;
84
+ fileName: string;
85
+ fileNameLower: string;
86
+ mtimeMs: number;
87
+ size: number;
88
+ entries: IndexedJarEntry[];
89
+ entryNamesSet: Set<string>;
90
+ declaredModIds: Set<string>;
91
+ namespaces: Set<string>;
92
+ }
93
+ interface DirJarIndex {
94
+ jarsByPath: Map<string, IndexedJarFile>;
95
+ sortedJarPaths: string[];
96
+ classToJar: Map<string, IndexedJarFile>;
97
+ modIdToJar: Map<string, IndexedJarFile>;
98
+ }
99
+ export declare class JarInspector {
100
+ private readonly toolsDir;
101
+ private readonly dirIndexCache;
102
+ private readonly dirIndexInFlight;
103
+ private readonly jdkToolCache;
104
+ private readonly decompileCache;
105
+ constructor(toolsDir: string);
106
+ listModJars(modsDir: string): Promise<string[]>;
107
+ private getOrBuildDirIndex;
108
+ private refreshDirIndex;
109
+ private indexSingleJar;
110
+ searchJarEntries(modsDir: string, query: string, modIdOrJar?: string, limit?: number): Promise<JarSearchHit[]>;
111
+ searchJarContents(modsDir: string, query: string, options?: SearchJarContentsOptions): Promise<JarContentHit[]>;
112
+ traceIdUsage(modsDir: string, query: string, options?: TraceIdOptions): Promise<IdTraceResult>;
113
+ searchPackFiles(gameDir: string, query: string, limit?: number): Promise<PackFileHit[]>;
114
+ private walkTextFiles;
115
+ findJarByModOrClass(modsDir: string, target: {
116
+ modId?: string;
117
+ className?: string;
118
+ resourcePath?: string;
119
+ }, preloadedIndex?: DirJarIndex): Promise<JarMatch | null>;
120
+ listJarEntries(modsDir: string, modIdOrJarName: string, prefix?: string, limit?: number): Promise<{
121
+ jarPath: string;
122
+ entries: string[];
123
+ }>;
124
+ readJarResource(modsDir: string, modIdOrJarName: string, internalPath: string): Promise<{
125
+ jarPath: string;
126
+ entryName: string;
127
+ content: string;
128
+ }>;
129
+ decompileClass(modsDir: string, className: string, mode?: 'vineflower' | 'javap'): Promise<{
130
+ jarPath: string;
131
+ className: string;
132
+ mode: string;
133
+ source: string;
134
+ }>;
135
+ private resolveJarPath;
136
+ private ensureVineflowerJar;
137
+ private resolveJdkTool;
138
+ }
139
+ export {};