dejared-mcp 0.2.0 → 1.0.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/lib/jar-runner.js
CHANGED
|
@@ -138,9 +138,20 @@ async function run() {
|
|
|
138
138
|
const javaPath = resolveJava();
|
|
139
139
|
await ensureJar();
|
|
140
140
|
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
const logDir = process.env.DEJARED_LOG_DIR || path.join(CACHE_DIR, "logs");
|
|
142
|
+
fs.mkdirSync(logDir, { recursive: true });
|
|
143
|
+
|
|
144
|
+
const jvmArgs = [`-Ddejared.log.dir=${logDir}`];
|
|
145
|
+
|
|
146
|
+
if (process.env.DEJARED_LOG_LEVEL) {
|
|
147
|
+
jvmArgs.push(`-Ddejared.log.level=${process.env.DEJARED_LOG_LEVEL}`);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const child = spawn(
|
|
151
|
+
javaPath,
|
|
152
|
+
[...jvmArgs, "-jar", JAR_PATH, "--spring.profiles.active=file-logging"],
|
|
153
|
+
{ stdio: "inherit" },
|
|
154
|
+
);
|
|
144
155
|
|
|
145
156
|
child.on("error", (err) => {
|
|
146
157
|
log(`Failed to start Java: ${err.message}`);
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ description: >
|
|
|
15
15
|
| `dejared_list_packages` | Cheap | List all packages with class counts |
|
|
16
16
|
| `dejared_list_classes` | Cheap | List classes in a package (`recursive=true` for sub-packages) |
|
|
17
17
|
| `dejared_list_resources` | Cheap | List all non-class resource files with sizes |
|
|
18
|
-
| `dejared_read_resource` | Cheap | Read a resource file
|
|
18
|
+
| `dejared_read_resource` | Cheap | Read a text resource file from inside a JAR (content-based detection, no extension restrictions) |
|
|
19
19
|
| `dejared_dump_package_metadata` | Cheap | Batch metadata for multiple packages at once (annotations, fields, methods via ASM) |
|
|
20
20
|
| `dejared_get_metadata` | Cheap | Single class metadata (ASM-based, no decompilation) |
|
|
21
21
|
| `dejared_search_class` | Cheap | Find classes by name keyword (case-insensitive) |
|
|
@@ -25,7 +25,7 @@ description: >
|
|
|
25
25
|
## Shared Rules
|
|
26
26
|
|
|
27
27
|
- All tool calls require the **absolute path** to the JAR file.
|
|
28
|
-
-
|
|
28
|
+
- Check metadata before decompiling — it often provides enough information without the cost of full decompilation.
|
|
29
29
|
- Default decompiler: CFR. If output is broken, try `vineflower` or `procyon`.
|
|
30
30
|
- Report results in structured format.
|
|
31
31
|
|
|
@@ -33,21 +33,21 @@ description: >
|
|
|
33
33
|
|
|
34
34
|
## Quick Use Cases
|
|
35
35
|
|
|
36
|
-
**Quick Lookup**
|
|
36
|
+
**Quick Lookup** — find a class by name (`dejared_search_class`) or find a string in bytecode (`dejared_search_string`). One call, done.
|
|
37
37
|
|
|
38
|
-
**Read Config**
|
|
38
|
+
**Read Config** — `dejared_list_resources` to see what's in the JAR, then `dejared_read_resource` to read it (application.yml, pom.xml, logback.xml, etc.).
|
|
39
39
|
|
|
40
|
-
**Get Signatures**
|
|
40
|
+
**Get Signatures** — `dejared_get_metadata` for a single class, or `dejared_dump_package_metadata` for an entire package (accepts a list). Returns class hierarchy, annotations, fields, and method signatures without decompiling.
|
|
41
41
|
|
|
42
42
|
---
|
|
43
43
|
|
|
44
44
|
## Workflows
|
|
45
45
|
|
|
46
|
-
**Explore**
|
|
47
|
-
`dejared_list_packages` → `dejared_list_classes` (use `recursive=true`) → `dejared_list_resources` → `dejared_read_resource` for configs → `dejared_dump_package_metadata` (batch all important packages in one call) → selective `dejared_decompile_class` only where method body logic is needed.
|
|
46
|
+
**Explore** — top-down JAR mapping:
|
|
47
|
+
`dejared_list_packages` → `dejared_list_classes` (use `recursive=true`) → `dejared_list_resources` → `dejared_read_resource` for configs → `dejared_dump_package_metadata` (batch all important packages in one call) → selective `dejared_decompile_class` only where method body logic is needed. If CFR output has issues, retry with `vineflower` or `procyon`.
|
|
48
48
|
|
|
49
|
-
**Hunt**
|
|
50
|
-
Pick search tool (`dejared_search_class` or `dejared_search_string`) → triage results → `dejared_get_metadata` on promising matches → `dejared_decompile_class` only if needed.
|
|
49
|
+
**Hunt** — search-driven investigation:
|
|
50
|
+
Pick search tool (`dejared_search_class` or `dejared_search_string`) → triage results → `dejared_get_metadata` on promising matches → `dejared_decompile_class` only if needed.
|
|
51
51
|
|
|
52
|
-
**Deep Analysis**
|
|
52
|
+
**Deep Analysis** — single class investigation:
|
|
53
53
|
`dejared_get_metadata` first → `dejared_decompile_class` (CFR default) → cross-reference with `dejared_search_class` or `dejared_dump_package_metadata` if needed. If CFR output has issues (broken lambdas, `goto` statements, missing method bodies), retry with `vineflower` (best for modern Java features like records, sealed classes, pattern matching) or `procyon` (handles some obfuscated/edge-case bytecode better).
|