dejared-mcp 0.1.3 → 0.1.4

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.
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "dejared-mcp-marketplace",
3
+ "owner": {
4
+ "name": "HuynhKhanh1402",
5
+ "email": "huynhkhanh14022004@gmail.com"
6
+ },
7
+ "metadata": {
8
+ "description": "MCP server and Claude Code plugin for exploring, analyzing, and decompiling Java JAR files"
9
+ },
10
+ "plugins": [
11
+ {
12
+ "name": "dejared",
13
+ "source": "./",
14
+ "description": "Explore, analyze, and decompile Java JAR files with structured workflows.",
15
+ "version": "0.1.4",
16
+ "author": {
17
+ "name": "HuynhKhanh1402"
18
+ },
19
+ "license": "MIT",
20
+ "keywords": ["java", "jar", "decompiler", "bytecode", "reverse-engineering", "mcp"],
21
+ "category": "development"
22
+ }
23
+ ]
24
+ }
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "dejared",
3
3
  "description": "Explore, analyze, and decompile Java JAR files with structured workflows.",
4
+ "version": "0.1.4",
4
5
  "author": {
5
6
  "name": "HuynhKhanh1402"
6
7
  },
7
8
  "repository": "https://github.com/HuynhKhanh1402/dejared-mcp",
8
9
  "license": "MIT",
9
- "keywords": ["java", "jar", "decompiler", "bytecode", "reverse-engineering", "mcp"]
10
+ "keywords": ["java", "jar", "decompiler", "bytecode", "reverse-engineering", "mcp"],
11
+ "mcpServers": {
12
+ "dejared": {
13
+ "command": "npx",
14
+ "args": ["-y", "dejared-mcp"]
15
+ }
16
+ }
10
17
  }
package/README.md CHANGED
@@ -1,15 +1,51 @@
1
+ [![npm version](https://img.shields.io/npm/v/dejared-mcp?style=flat-square)](https://www.npmjs.com/package/dejared-mcp)
2
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](LICENSE)
3
+ [![Node.js](https://img.shields.io/badge/Node.js-18%2B-339933?style=flat-square&logo=node.js&logoColor=white)]()
4
+ [![Java](https://img.shields.io/badge/Java-21%2B-ED8B00?style=flat-square&logo=openjdk&logoColor=white)]()
5
+
1
6
  # dejared-mcp
2
7
 
3
- An MCP (Model Context Protocol) server that lets AI assistants explore, analyze, and decompile Java JAR files.
8
+ A Model Context Protocol (MCP) server for exploring, analyzing, and decompiling Java JAR files.
9
+ Designed for AI-powered development tools, dejared-mcp connects your IDE or CLI assistant
10
+ to inspect package structures, search bytecode, and decompile classes
11
+ using CFR, Vineflower, or Procyon.
12
+
13
+ ## Table of Contents
14
+
15
+ - [Overview](#overview)
16
+ - [Prerequisites](#prerequisites)
17
+ - [Quick Start](#quick-start)
18
+ - [Features](#features)
19
+ - [Decompiler Engines](#decompiler-engines)
20
+ - [Installation and Configuration](#installation-and-configuration)
21
+ - [Custom Java Path](#custom-java-path)
22
+ - [Server Configuration](#server-configuration)
23
+ - [How It Works](#how-it-works)
24
+ - [FAQ and Troubleshooting](#faq-and-troubleshooting)
25
+ - [Contributing](#contributing)
26
+ - [Third-Party Licenses](#third-party-licenses)
27
+ - [License](#license)
28
+
29
+ ## Overview
30
+
31
+ dejared-mcp is a Java-based MCP server distributed as an npm package.
32
+ It provides nine tools organized into three categories: discovery, hunting,
33
+ and deep analysis. AI assistants use these tools to navigate JAR file
34
+ structures, search for classes and string literals in bytecode, and
35
+ decompile `.class` files back to readable Java source code.
36
+
37
+ The npm package acts as a thin wrapper that downloads and caches the
38
+ server JAR on first run, then spawns it via `java -jar` using stdio
39
+ transport.
4
40
 
5
41
  ## Prerequisites
6
42
 
7
- - **Node.js 18+** - required for the `npx` wrapper (not needed for pure Java usage)
8
- - **Java 21+** - JRE is sufficient
43
+ - **Node.js** 18 or later
44
+ - **Java** 21 or later (JRE is sufficient)
9
45
 
10
46
  ## Quick Start
11
47
 
12
- Most MCP-compatible tools use a JSON configuration like this:
48
+ Add the following to your MCP client configuration:
13
49
 
14
50
  ```json
15
51
  {
@@ -22,17 +58,56 @@ Most MCP-compatible tools use a JSON configuration like this:
22
58
  }
23
59
  ```
24
60
 
25
- See below for tool-specific instructions.
61
+ See [Installation and Configuration](#installation-and-configuration)
62
+ for tool-specific instructions.
26
63
 
27
- ## Configuration by Tool
64
+ ## Features
28
65
 
29
- <details>
30
- <summary><strong>Claude Desktop</strong></summary>
66
+ ### Discovery
31
67
 
32
- Edit the Claude Desktop config file:
68
+ Browse and read JAR contents.
33
69
 
34
- - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
35
- - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
70
+ | Tool | Description |
71
+ |------|-------------|
72
+ | `dejared_list_packages` | List all packages with class counts |
73
+ | `dejared_list_classes` | List classes in a specific package |
74
+ | `dejared_list_resources` | List non-class resource files |
75
+ | `dejared_read_resource` | Read text resources (YAML, XML, properties, JSON, and others) |
76
+
77
+ ### Hunting
78
+
79
+ Search inside JAR files.
80
+
81
+ | Tool | Description |
82
+ |------|-------------|
83
+ | `dejared_search_class` | Search classes by name |
84
+ | `dejared_search_string` | Search string literals in bytecode (URLs, SQL, error messages) |
85
+
86
+ ### Deep Analysis
87
+
88
+ Inspect metadata and decompile classes.
89
+
90
+ | Tool | Description |
91
+ |------|-------------|
92
+ | `dejared_get_metadata` | Extract class metadata via ASM (fast, no decompilation) |
93
+ | `dejared_dump_package_metadata` | Batch metadata extraction for entire packages |
94
+ | `dejared_decompile_class` | Decompile `.class` files to Java source code |
95
+
96
+ ## Decompiler Engines
97
+
98
+ dejared-mcp supports three decompiler engines. The engine can be
99
+ specified per request via the `dejared_decompile_class` tool.
100
+
101
+ | Engine | Description |
102
+ |--------|-------------|
103
+ | **CFR** (default) | Reliable general-purpose decompiler |
104
+ | **Vineflower** | Modern fork of FernFlower, handles newer Java features well |
105
+ | **Procyon** | Alternative engine, can handle some edge cases better |
106
+
107
+ ## Installation and Configuration
108
+
109
+ The standard configuration below works with most MCP-compatible tools.
110
+ Expand the relevant section for tool-specific instructions.
36
111
 
37
112
  ```json
38
113
  {
@@ -45,20 +120,32 @@ Edit the Claude Desktop config file:
45
120
  }
46
121
  ```
47
122
 
48
- Restart Claude Desktop after saving.
123
+ <details>
124
+ <summary><strong>Amp</strong></summary>
49
125
 
50
- </details>
126
+ Add via the Amp VS Code extension settings screen or by updating your `settings.json` file:
51
127
 
52
- <details>
53
- <summary><strong>Claude Code (CLI)</strong></summary>
128
+ ```json
129
+ "amp.mcpServers": {
130
+ "dejared": {
131
+ "command": "npx",
132
+ "args": ["-y", "dejared-mcp"]
133
+ }
134
+ }
135
+ ```
54
136
 
55
- Run this command in your terminal:
137
+ **Amp CLI:**
56
138
 
57
139
  ```bash
58
- claude mcp add dejared -- npx -y dejared-mcp
140
+ amp mcp add dejared -- npx -y dejared-mcp
59
141
  ```
60
142
 
61
- Or add it to your project's `.mcp.json`:
143
+ </details>
144
+
145
+ <details>
146
+ <summary><strong>Antigravity Editor</strong></summary>
147
+
148
+ Edit `~/.gemini/antigravity/mcp_config.json`:
62
149
 
63
150
  ```json
64
151
  {
@@ -71,19 +158,88 @@ Or add it to your project's `.mcp.json`:
71
158
  }
72
159
  ```
73
160
 
161
+ Or install through the MCP Store if available.
162
+
74
163
  </details>
75
164
 
76
165
  <details>
77
- <summary><strong>Cursor</strong></summary>
166
+ <summary><strong>Claude Code</strong></summary>
167
+
168
+ ```bash
169
+ claude mcp add dejared -- npx -y dejared-mcp
170
+ ```
171
+
172
+ Or add it to your project's `.mcp.json` using the standard config above.
173
+
174
+ **Plugin (Marketplace)** installs both the MCP server and the `/jar-analysis` skill:
175
+
176
+ ```bash
177
+ claude plugin marketplace add HuynhKhanh1402/dejared-mcp
178
+ claude plugin install dejared@dejared-mcp-marketplace
179
+ ```
180
+
181
+ </details>
182
+
183
+ <details>
184
+ <summary><strong>Claude Desktop</strong></summary>
185
+
186
+ Edit the Claude Desktop config file:
187
+
188
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
189
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
190
+
191
+ Add the standard config above and restart Claude Desktop.
78
192
 
79
- Create or edit `.cursor/mcp.json` in your project root (project-level) or `~/.cursor/mcp.json` (global):
193
+ </details>
194
+
195
+ <details>
196
+ <summary><strong>Cline</strong></summary>
197
+
198
+ Add the standard config above to your MCP settings file.
199
+
200
+ </details>
201
+
202
+ <details>
203
+ <summary><strong>Codex</strong></summary>
204
+
205
+ ```bash
206
+ codex mcp add dejared npx "-y dejared-mcp"
207
+ ```
208
+
209
+ Or edit `~/.codex/config.toml`:
210
+
211
+ ```toml
212
+ [mcp_servers.dejared]
213
+ command = "npx"
214
+ args = ["-y", "dejared-mcp"]
215
+ ```
216
+
217
+ </details>
218
+
219
+ <details>
220
+ <summary><strong>Copilot CLI</strong></summary>
221
+
222
+ Interactive:
223
+
224
+ ```
225
+ /mcp add
226
+ ```
227
+
228
+ Then fill in:
229
+ - **Server Name**: `dejared`
230
+ - **Server Type**: `STDIO`
231
+ - **Command**: `npx -y dejared-mcp`
232
+
233
+ Or edit `~/.copilot/mcp-config.json`:
80
234
 
81
235
  ```json
82
236
  {
83
237
  "mcpServers": {
84
238
  "dejared": {
239
+ "type": "local",
85
240
  "command": "npx",
86
- "args": ["-y", "dejared-mcp"]
241
+ "args": ["-y", "dejared-mcp"],
242
+ "tools": ["*"]
87
243
  }
88
244
  }
89
245
  }
@@ -92,29 +248,34 @@ Create or edit `.cursor/mcp.json` in your project root (project-level) or `~/.cu
92
248
  </details>
93
249
 
94
250
  <details>
95
- <summary><strong>VS Code (GitHub Copilot)</strong></summary>
251
+ <summary><strong>Cursor</strong></summary>
96
252
 
97
- Create or edit `.vscode/mcp.json` in your project root:
253
+ Create or edit `.cursor/mcp.json` in your project root (project-level) or `~/.cursor/mcp.json` (global) using the standard config above.
98
254
 
99
- ```json
100
- {
101
- "servers": {
102
- "dejared": {
103
- "command": "npx",
104
- "args": ["-y", "dejared-mcp"]
105
- }
106
- }
107
- }
255
+ </details>
256
+
257
+ <details>
258
+ <summary><strong>Gemini CLI</strong></summary>
259
+
260
+ ```bash
261
+ gemini mcp add dejared npx -y dejared-mcp
108
262
  ```
109
263
 
110
- Or add to your VS Code `settings.json` for global availability.
264
+ Or edit `~/.gemini/settings.json` (global) or `.gemini/settings.json` (project) using the standard config above.
111
265
 
112
- After saving, click the **Start** button that appears in the MCP config file, then use Agent mode in Copilot Chat.
266
+ Use `/mcp` in a Gemini CLI session to verify the server is connected.
113
267
 
114
268
  </details>
115
269
 
116
270
  <details>
117
- <summary><strong>JetBrains IDEs (GitHub Copilot)</strong></summary>
271
+ <summary><strong>Goose</strong></summary>
272
+
273
+ Go to **Advanced settings** > **Extensions** > **Add custom extension**. Name to your liking, use type `STDIO`, and set the command to `npx -y dejared-mcp`.
274
+
275
+ </details>
276
+
277
+ <details>
278
+ <summary><strong>JetBrains IDEs</strong></summary>
118
279
 
119
280
  Go to **Settings** > **Tools** > **AI Assistant** > **Model Context Protocol (MCP)**.
120
281
 
@@ -128,39 +289,47 @@ Click **+ Add** and configure:
128
289
  </details>
129
290
 
130
291
  <details>
131
- <summary><strong>Gemini CLI</strong></summary>
292
+ <summary><strong>Kiro</strong></summary>
132
293
 
133
- **Option A** - CLI command:
294
+ Create or edit `.kiro/settings/mcp.json` using the standard config above.
134
295
 
135
- ```bash
136
- gemini mcp add dejared npx -y dejared-mcp
137
- ```
296
+ </details>
138
297
 
139
- **Option B** - Edit `~/.gemini/settings.json` (global) or `.gemini/settings.json` (project):
298
+ <details>
299
+ <summary><strong>opencode</strong></summary>
300
+
301
+ Edit `~/.config/opencode/opencode.json`:
140
302
 
141
303
  ```json
142
304
  {
143
- "mcpServers": {
305
+ "$schema": "https://opencode.ai/config.json",
306
+ "mcp": {
144
307
  "dejared": {
145
- "command": "npx",
146
- "args": ["-y", "dejared-mcp"]
308
+ "type": "local",
309
+ "command": ["npx", "-y", "dejared-mcp"],
310
+ "enabled": true
147
311
  }
148
312
  }
149
313
  }
150
314
  ```
151
315
 
152
- Use `/mcp` in a Gemini CLI session to verify the server is connected.
316
+ </details>
317
+
318
+ <details>
319
+ <summary><strong>Qodo Gen</strong></summary>
320
+
321
+ Open [Qodo Gen](https://docs.qodo.ai/qodo-documentation/qodo-gen) chat panel in VS Code or IntelliJ > Connect more tools > + Add new MCP > Paste the standard config above > Save.
153
322
 
154
323
  </details>
155
324
 
156
325
  <details>
157
- <summary><strong>Antigravity Editor</strong></summary>
326
+ <summary><strong>VS Code (GitHub Copilot)</strong></summary>
158
327
 
159
- Edit `~/.gemini/antigravity/mcp_config.json`:
328
+ Create or edit `.vscode/mcp.json` in your project root:
160
329
 
161
330
  ```json
162
331
  {
163
- "mcpServers": {
332
+ "servers": {
164
333
  "dejared": {
165
334
  "command": "npx",
166
335
  "args": ["-y", "dejared-mcp"]
@@ -169,38 +338,14 @@ Edit `~/.gemini/antigravity/mcp_config.json`:
169
338
  }
170
339
  ```
171
340
 
172
- Or install through the MCP Store if available.
341
+ After saving, click the **Start** button that appears in the MCP config file, then use Agent mode in Copilot Chat.
173
342
 
174
343
  </details>
175
344
 
176
345
  <details>
177
- <summary><strong>GitHub Copilot CLI</strong></summary>
178
-
179
- **Option A** - Interactive:
180
-
181
- ```
182
- /mcp add
183
- ```
184
-
185
- Then fill in:
186
- - **Server Name**: `dejared`
187
- - **Server Type**: `STDIO`
188
- - **Command**: `npx -y dejared-mcp`
346
+ <summary><strong>Windsurf</strong></summary>
189
347
 
190
- **Option B** - Edit `~/.copilot/mcp-config.json`:
191
-
192
- ```json
193
- {
194
- "mcpServers": {
195
- "dejared": {
196
- "type": "local",
197
- "command": "npx",
198
- "args": ["-y", "dejared-mcp"],
199
- "tools": ["*"]
200
- }
201
- }
202
- }
203
- ```
348
+ Open Windsurf settings, navigate to MCP servers, and add a new server using the `command` type with `npx -y dejared-mcp`. Or add the standard config under `mcpServers` in your settings.
204
349
 
205
350
  </details>
206
351
 
@@ -211,31 +356,24 @@ If you prefer to run the server JAR directly without Node.js:
211
356
 
212
357
  1. Download the latest JAR from [GitHub Releases](https://github.com/HuynhKhanh1402/dejared-mcp/releases).
213
358
 
214
- Direct link pattern:
215
- ```
216
- https://github.com/HuynhKhanh1402/dejared-mcp/releases/download/v{VERSION}/dejared-mcp-{VERSION}.jar
217
- ```
218
-
219
359
  2. Run it:
220
360
  ```bash
221
- java -jar dejared-mcp-0.1.1.jar
361
+ java -jar dejared-mcp-0.1.3.jar
222
362
  ```
223
363
 
224
- 3. Configure your MCP client to use the JAR directly instead of `npx`. For example, in Claude Desktop:
364
+ 3. Configure your MCP client to use the JAR directly instead of `npx`:
225
365
 
226
366
  ```json
227
367
  {
228
368
  "mcpServers": {
229
369
  "dejared": {
230
370
  "command": "java",
231
- "args": ["-jar", "/path/to/dejared-mcp-0.1.1.jar"]
371
+ "args": ["-jar", "/path/to/dejared-mcp-0.1.3.jar"]
232
372
  }
233
373
  }
234
374
  }
235
375
  ```
236
376
 
237
- Replace `/path/to/dejared-mcp-0.1.1.jar` with the actual path where you saved the JAR. This works with any MCP client that supports stdio transport.
238
-
239
377
  </details>
240
378
 
241
379
  ## Custom Java Path
@@ -256,50 +394,92 @@ If Java is not in your system PATH, set the `DEJARED_JAVA_PATH` environment vari
256
394
  }
257
395
  ```
258
396
 
259
- ## Features
397
+ ## Server Configuration
260
398
 
261
- **Discovery** - Browse JAR structure:
262
- - `dejared_list_packages` - List all packages with class counts
263
- - `dejared_list_classes` - List classes in a specific package
264
- - `dejared_list_resources` - List non-class resource files
265
- - `dejared_read_resource` - Read text resources (yml, xml, properties, json, etc.)
399
+ | Property | Default | Description |
400
+ |----------|---------|-------------|
401
+ | `dejared.cache.max-size` | `500` | Max entries in the decompilation LRU cache |
402
+ | `dejared.security.max-resource-size` | `5242880` | Max resource file size (bytes) |
403
+ | `dejared.security.decompile-timeout-seconds` | `30` | Timeout per decompilation |
266
404
 
267
- **Hunting** - Search inside JARs:
268
- - `dejared_search_class` - Search classes by name
269
- - `dejared_search_string` - Search string literals in bytecode (URLs, SQL, error messages, etc.)
405
+ ## How It Works
270
406
 
271
- **Deep Analysis** - Inspect and decompile:
272
- - `dejared_get_metadata` - Extract class metadata via ASM (fast, no decompilation)
273
- - `dejared_dump_package_metadata` - Batch metadata for entire packages
274
- - `dejared_decompile_class` - Decompile `.class` to Java source code
407
+ The npm package is a thin Node.js wrapper. On first run it:
275
408
 
276
- ## Decompiler Engines
409
+ 1. Checks the platform cache directory for a cached JAR matching the current version.
410
+ - **Linux**: `$XDG_CACHE_HOME/dejared-mcp` (defaults to `~/.cache/dejared-mcp`)
411
+ - **macOS**: `~/Library/Caches/dejared-mcp`
412
+ - **Windows**: `%LOCALAPPDATA%\dejared-mcp`
413
+ 2. Downloads the JAR from GitHub Releases if not cached.
414
+ 3. Spawns `java -jar` with stdio inherited for MCP transport.
277
415
 
278
- | Engine | Description |
279
- |--------|-------------|
280
- | **CFR** (default) | Reliable general-purpose decompiler |
281
- | **Vineflower** | Modern fork of FernFlower, good with newer Java features |
282
- | **Procyon** | Alternative engine, can handle some edge cases better |
416
+ The server communicates over stdio using the Model Context Protocol.
283
417
 
284
- ## How It Works
418
+ ## FAQ and Troubleshooting
285
419
 
286
- The npm package is a thin Node.js wrapper. On first run it:
287
- 1. Checks the platform cache directory for a cached JAR matching the current version
288
- - Linux: `$XDG_CACHE_HOME/dejared-mcp` (default `~/.cache/dejared-mcp`)
289
- - macOS: `~/Library/Caches/dejared-mcp`
290
- - Windows: `%LOCALAPPDATA%\dejared-mcp`
291
- 2. Downloads the JAR from GitHub Releases if not cached
292
- 3. Spawns `java -jar` with stdio inherited for MCP transport
420
+ **Q: Java is installed but the server cannot find it.**
293
421
 
294
- The server communicates over stdio.
422
+ Set the `DEJARED_JAVA_PATH` environment variable in your MCP
423
+ configuration. See [Custom Java Path](#custom-java-path).
295
424
 
296
- ## Server Configuration
425
+ **Q: The server fails to start with a permission error.**
297
426
 
298
- | Property | Default | Description |
299
- |----------|---------|-------------|
300
- | `dejared.cache.max-size` | `500` | Max entries in the decompilation LRU cache |
301
- | `dejared.security.max-resource-size` | `5242880` | Max resource file size (bytes) |
302
- | `dejared.security.decompile-timeout-seconds` | `30` | Timeout per decompilation |
427
+ Ensure that the cached JAR file is readable. The cache location
428
+ depends on your platform. See [How It Works](#how-it-works) for
429
+ the cache directory paths.
430
+
431
+ **Q: Decompilation times out or returns an error.**
432
+
433
+ Some classes are difficult to decompile. Try a different engine
434
+ by specifying `vineflower` or `procyon` in the `dejared_decompile_class`
435
+ tool. The default timeout is 30 seconds and can be adjusted via
436
+ `dejared.security.decompile-timeout-seconds`.
437
+
438
+ **Q: Which Java version do I need?**
439
+
440
+ Java 21 or later. A JRE is sufficient; you do not need a full JDK.
441
+
442
+ **Q: Can I run the server without Node.js?**
443
+
444
+ Yes. Download the JAR from GitHub Releases and run it directly
445
+ with `java -jar`. See the "Pure Java" section under
446
+ [Installation and Configuration](#installation-and-configuration).
447
+
448
+ ## Contributing
449
+
450
+ Contributions are welcome. Please follow these guidelines:
451
+
452
+ 1. Fork the repository and create a feature branch from `master`.
453
+ 2. Ensure your changes compile and pass existing tests.
454
+ 3. Write clear commit messages describing the purpose of each change.
455
+ 4. Open a pull request against `master` with a description of what
456
+ the change does and why.
457
+
458
+ ### Project Structure
459
+
460
+ ```
461
+ dejared-mcp/
462
+ ├── bin/ # Node.js CLI entry point
463
+ ├── lib/ # Node.js wrapper (JAR download and process management)
464
+ ├── java-mcp/ # Java MCP server (Spring Boot, Gradle)
465
+ │ └── src/
466
+ ├── skills/ # Claude Code plugin skills
467
+ ├── package.json # npm package manifest
468
+ └── server.json # MCP Registry manifest
469
+ ```
470
+
471
+ ### Building from Source
472
+
473
+ ```bash
474
+ cd java-mcp
475
+ ./gradlew build
476
+ ```
477
+
478
+ ### Reporting Issues
479
+
480
+ Open an issue on [GitHub Issues](https://github.com/HuynhKhanh1402/dejared-mcp/issues)
481
+ with steps to reproduce the problem, your Java version, and your
482
+ Node.js version.
303
483
 
304
484
  ## Third-Party Licenses
305
485
 
@@ -316,4 +496,4 @@ This project uses the following open-source libraries:
316
496
 
317
497
  ## License
318
498
 
319
- [MIT](LICENSE)
499
+ This project is licensed under the [MIT License](LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dejared-mcp",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "mcpName": "io.github.HuynhKhanh1402/dejared",
5
5
  "description": "Explore, analyze, and decompile Java JAR files via MCP",
6
6
  "bin": {
@@ -1,16 +1,13 @@
1
1
  ---
2
2
  name: jar-analysis
3
3
  description: >
4
- Explore, search, and decompile Java JAR files. Three workflows: Explore
5
- (top-down structure mapping), Hunt (search for specific code/strings),
6
- and Deep Analysis (single-class investigation). Use the workflow that
7
- matches the task.
4
+ Explore, search, and decompile Java JAR files. Quick use cases for
5
+ common tasks (lookup, read config, get signatures) and workflows for
6
+ deeper analysis (Explore, Hunt, Deep Analysis).
8
7
  ---
9
8
 
10
9
  # JAR Analysis
11
10
 
12
- Three workflows for working with Java JAR files. Pick the one that fits your goal.
13
-
14
11
  ## Available Tools
15
12
 
16
13
  | Tool | Cost | Purpose |
@@ -34,106 +31,23 @@ Three workflows for working with Java JAR files. Pick the one that fits your goa
34
31
 
35
32
  ---
36
33
 
37
- ## Workflow 1: Explore
38
-
39
- Use when exploring unknown JARs or understanding JAR architecture. Top-down approach: cheap tools first, decompilation last.
40
-
41
- ### Step 1: Map Package Structure
42
- Call `dejared_list_packages` to get the full layout.
43
- - Identify the root application package (highest class count, deepest nesting).
44
- - Distinguish app code from shaded/third-party dependencies.
45
-
46
- ### Step 2: List Classes
47
- Call `dejared_list_classes` with `recursive=true` on the root application package to get all classes in one call.
48
- - For targeted exploration of specific packages, use `recursive=false`.
49
-
50
- ### Step 3: Discover Resources
51
- Call `dejared_list_resources` to see what non-class files exist in the JAR.
34
+ ## Quick Use Cases
52
35
 
53
- ### Step 4: Read Configuration
54
- Call `dejared_read_resource` for files discovered in Step 3:
55
- - `application.yml` / `application.yaml` / `application.properties`
56
- - `META-INF/spring.factories` or `META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports`
57
- - `logback.xml` / `log4j2.xml`
36
+ **Quick Lookup** - find a class by name (`dejared_search_class`) or find a string in bytecode (`dejared_search_string`). One call, done.
58
37
 
59
- ### Step 5: Batch Metadata
60
- Call `dejared_dump_package_metadata` with **all important packages at once** (it accepts a list).
61
- Example: `packageNames: ["com.example.service", "com.example.config", "com.example.controller"]`
62
- - Returns annotations, fields, and method signatures for every class.
63
- - One call replaces dozens of individual `dejared_get_metadata` calls.
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.)
64
39
 
65
- ### Step 6: Selective Decompilation
66
- Call `dejared_decompile_class` ONLY for classes where you need method body logic.
67
- - You MUST have reviewed metadata from Step 5 first.
68
- - Decompile one class at a time; summarize before continuing.
69
- - For JARs with >20 packages, group by prefix and summarize before diving in.
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.
70
41
 
71
42
  ---
72
43
 
73
- ## Workflow 2: Hunt
74
-
75
- Use when looking for specific functionality, URLs, SQL, error messages, or credentials. Search-driven approach.
76
-
77
- ### Search Tools
78
-
79
- **`dejared_search_class`** -- Find by class name.
80
- Case-insensitive keyword match against simple class names.
81
- - Find specific classes: "UserService", "DatabaseConfig"
82
- - Find patterns: "Controller", "Repository", "Factory", "Handler"
83
-
84
- **`dejared_search_string`** -- Find by string literal.
85
- Scans bytecode constant pools across all classes (case-insensitive).
86
- - URLs, endpoints, API paths
87
- - SQL queries, table names
88
- - Error messages, log messages
89
- - Config keys, credentials, secrets
90
- - Useful keywords for security audits: "password", "secret", "token", "key", "jdbc", "http://"
91
-
92
- ### Steps
93
-
94
- 1. **Search** -- Pick the right search tool based on the goal.
95
- 2. **Triage** -- Review results, identify most relevant matches.
96
- 3. **Inspect** -- Call `dejared_get_metadata` on promising classes to understand their role (annotations, fields, methods).
97
- 4. **Decompile** -- Call `dejared_decompile_class` ONLY on classes where you need to see method body logic. Never skip step 3.
98
- 5. **Report** -- Summarize findings with context and implications.
99
-
100
- Note: String search finds compiled constants only, not runtime-generated strings.
101
-
102
- ---
103
-
104
- ## Workflow 3: Deep Analysis
105
-
106
- Use when investigating a single class in detail. Combines metadata extraction with multi-engine decompilation.
107
-
108
- ### Step 1: Metadata First
109
- Call `dejared_get_metadata` to extract:
110
- - Class hierarchy (superclass, interfaces)
111
- - Annotations (`@Service`, `@Entity`, `@Controller`, etc.)
112
- - Fields (state the class holds)
113
- - Methods (behavior -- names, return types, parameters)
114
-
115
- This tells you the class's role and size before decompiling.
116
-
117
- ### Step 2: Decompile
118
- Call `dejared_decompile_class` (default engine: CFR). Analyze:
119
- - Constructor logic and dependency injection
120
- - Method implementations and business logic
121
- - Error handling patterns
122
- - Interactions with other classes
44
+ ## Workflows
123
45
 
124
- ### Step 3: Cross-Reference (if needed)
125
- If decompiled code references important classes:
126
- - `dejared_search_class` to find them by name.
127
- - `dejared_dump_package_metadata` on the same package to see sibling classes (accepts a list of packages).
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.
128
48
 
129
- ### Step 4: Try Alternative Engine (if needed)
130
- If CFR output has problems (broken lambdas, goto statements, placeholder bodies):
131
- - `vineflower` -- best for modern Java features.
132
- - `procyon` -- good for edge cases.
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. Never skip the metadata step.
133
51
 
134
- ### Report Structure
135
- 1. **Role** -- What this class does (one sentence).
136
- 2. **Framework Integration** -- Annotations, Spring beans, injection points.
137
- 3. **Key Methods** -- Important methods and what they do.
138
- 4. **Dependencies** -- Other classes/services it uses.
139
- 5. **Notable Patterns** -- Design patterns, security concerns, performance notes.
52
+ **Deep Analysis** - single class investigation:
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).