dejared-mcp 0.1.0 → 0.1.2
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/README.md +238 -11
- package/lib/jar-runner.js +43 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -2,9 +2,151 @@
|
|
|
2
2
|
|
|
3
3
|
An MCP (Model Context Protocol) server that lets AI assistants explore, analyze, and decompile Java JAR files.
|
|
4
4
|
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- **Node.js 18+** - required for the `npx` wrapper (not needed for pure Java usage)
|
|
8
|
+
- **Java 21+** - JRE is sufficient
|
|
9
|
+
|
|
5
10
|
## Quick Start
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
Most MCP-compatible tools use a JSON configuration like this:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"mcpServers": {
|
|
17
|
+
"dejared": {
|
|
18
|
+
"command": "npx",
|
|
19
|
+
"args": ["-y", "dejared-mcp"]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
See below for tool-specific instructions.
|
|
26
|
+
|
|
27
|
+
## MCP Registry
|
|
28
|
+
|
|
29
|
+
This server is published to the [MCP Registry](https://registry.modelcontextprotocol.io) as `io.github.huynhkhanh1402/dejared`.
|
|
30
|
+
|
|
31
|
+
You can verify it via the registry API:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
curl "https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.huynhkhanh1402/dejared"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Configuration by Tool
|
|
38
|
+
|
|
39
|
+
<details>
|
|
40
|
+
<summary><strong>Claude Desktop</strong></summary>
|
|
41
|
+
|
|
42
|
+
Edit the Claude Desktop config file:
|
|
43
|
+
|
|
44
|
+
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
45
|
+
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"dejared": {
|
|
51
|
+
"command": "npx",
|
|
52
|
+
"args": ["-y", "dejared-mcp"]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Restart Claude Desktop after saving.
|
|
59
|
+
|
|
60
|
+
</details>
|
|
61
|
+
|
|
62
|
+
<details>
|
|
63
|
+
<summary><strong>Claude Code (CLI)</strong></summary>
|
|
64
|
+
|
|
65
|
+
Run this command in your terminal:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
claude mcp add dejared -- npx -y dejared-mcp
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Or add it to your project's `.mcp.json`:
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"dejared": {
|
|
77
|
+
"command": "npx",
|
|
78
|
+
"args": ["-y", "dejared-mcp"]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
</details>
|
|
85
|
+
|
|
86
|
+
<details>
|
|
87
|
+
<summary><strong>Cursor</strong></summary>
|
|
88
|
+
|
|
89
|
+
Create or edit `.cursor/mcp.json` in your project root (project-level) or `~/.cursor/mcp.json` (global):
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcpServers": {
|
|
94
|
+
"dejared": {
|
|
95
|
+
"command": "npx",
|
|
96
|
+
"args": ["-y", "dejared-mcp"]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
</details>
|
|
103
|
+
|
|
104
|
+
<details>
|
|
105
|
+
<summary><strong>VS Code (GitHub Copilot)</strong></summary>
|
|
106
|
+
|
|
107
|
+
Create or edit `.vscode/mcp.json` in your project root:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"servers": {
|
|
112
|
+
"dejared": {
|
|
113
|
+
"command": "npx",
|
|
114
|
+
"args": ["-y", "dejared-mcp"]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Or add to your VS Code `settings.json` for global availability.
|
|
121
|
+
|
|
122
|
+
After saving, click the **Start** button that appears in the MCP config file, then use Agent mode in Copilot Chat.
|
|
123
|
+
|
|
124
|
+
</details>
|
|
125
|
+
|
|
126
|
+
<details>
|
|
127
|
+
<summary><strong>JetBrains IDEs (GitHub Copilot)</strong></summary>
|
|
128
|
+
|
|
129
|
+
Go to **Settings** > **Tools** > **AI Assistant** > **Model Context Protocol (MCP)**.
|
|
130
|
+
|
|
131
|
+
Click **+ Add** and configure:
|
|
132
|
+
|
|
133
|
+
- **Name**: `dejared`
|
|
134
|
+
- **Transport**: `Stdio`
|
|
135
|
+
- **Command**: `npx`
|
|
136
|
+
- **Arguments**: `-y dejared-mcp`
|
|
137
|
+
|
|
138
|
+
</details>
|
|
139
|
+
|
|
140
|
+
<details>
|
|
141
|
+
<summary><strong>Gemini CLI</strong></summary>
|
|
142
|
+
|
|
143
|
+
**Option A** - CLI command:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
gemini mcp add dejared npx -y dejared-mcp
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Option B** - Edit `~/.gemini/settings.json` (global) or `.gemini/settings.json` (project):
|
|
8
150
|
|
|
9
151
|
```json
|
|
10
152
|
{
|
|
@@ -17,11 +159,98 @@ Add to your MCP client configuration:
|
|
|
17
159
|
}
|
|
18
160
|
```
|
|
19
161
|
|
|
20
|
-
|
|
162
|
+
Use `/mcp` in a Gemini CLI session to verify the server is connected.
|
|
21
163
|
|
|
22
|
-
|
|
164
|
+
</details>
|
|
23
165
|
|
|
24
|
-
|
|
166
|
+
<details>
|
|
167
|
+
<summary><strong>Antigravity Editor</strong></summary>
|
|
168
|
+
|
|
169
|
+
Edit `~/.gemini/antigravity/mcp_config.json`:
|
|
170
|
+
|
|
171
|
+
```json
|
|
172
|
+
{
|
|
173
|
+
"mcpServers": {
|
|
174
|
+
"dejared": {
|
|
175
|
+
"command": "npx",
|
|
176
|
+
"args": ["-y", "dejared-mcp"]
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Or install through the MCP Store if available.
|
|
183
|
+
|
|
184
|
+
</details>
|
|
185
|
+
|
|
186
|
+
<details>
|
|
187
|
+
<summary><strong>GitHub Copilot CLI</strong></summary>
|
|
188
|
+
|
|
189
|
+
**Option A** - Interactive:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
/mcp add
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Then fill in:
|
|
196
|
+
- **Server Name**: `dejared`
|
|
197
|
+
- **Server Type**: `STDIO`
|
|
198
|
+
- **Command**: `npx -y dejared-mcp`
|
|
199
|
+
|
|
200
|
+
**Option B** - Edit `~/.copilot/mcp-config.json`:
|
|
201
|
+
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"mcpServers": {
|
|
205
|
+
"dejared": {
|
|
206
|
+
"type": "local",
|
|
207
|
+
"command": "npx",
|
|
208
|
+
"args": ["-y", "dejared-mcp"],
|
|
209
|
+
"tools": ["*"]
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
</details>
|
|
216
|
+
|
|
217
|
+
<details>
|
|
218
|
+
<summary><strong>Pure Java (no Node.js required)</strong></summary>
|
|
219
|
+
|
|
220
|
+
If you prefer to run the server JAR directly without Node.js:
|
|
221
|
+
|
|
222
|
+
1. Download the latest JAR from [GitHub Releases](https://github.com/HuynhKhanh1402/dejared-mcp/releases).
|
|
223
|
+
|
|
224
|
+
Direct link pattern:
|
|
225
|
+
```
|
|
226
|
+
https://github.com/HuynhKhanh1402/dejared-mcp/releases/download/v{VERSION}/dejared-mcp-{VERSION}.jar
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
2. Run it:
|
|
230
|
+
```bash
|
|
231
|
+
java -jar dejared-mcp-0.1.1.jar
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
3. Configure your MCP client to use the JAR directly instead of `npx`. For example, in Claude Desktop:
|
|
235
|
+
|
|
236
|
+
```json
|
|
237
|
+
{
|
|
238
|
+
"mcpServers": {
|
|
239
|
+
"dejared": {
|
|
240
|
+
"command": "java",
|
|
241
|
+
"args": ["-jar", "/path/to/dejared-mcp-0.1.1.jar"]
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
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.
|
|
248
|
+
|
|
249
|
+
</details>
|
|
250
|
+
|
|
251
|
+
## Custom Java Path
|
|
252
|
+
|
|
253
|
+
If Java is not in your system PATH, set the `DEJARED_JAVA_PATH` environment variable in your MCP config. This applies to all `npx`-based configurations:
|
|
25
254
|
|
|
26
255
|
```json
|
|
27
256
|
{
|
|
@@ -37,11 +266,6 @@ If Java is not in your system PATH, set the `DEJARED_JAVA_PATH` environment vari
|
|
|
37
266
|
}
|
|
38
267
|
```
|
|
39
268
|
|
|
40
|
-
## Requirements
|
|
41
|
-
|
|
42
|
-
- Node.js 18+
|
|
43
|
-
- Java 21+ (JRE is sufficient)
|
|
44
|
-
|
|
45
269
|
## Features
|
|
46
270
|
|
|
47
271
|
**Discovery** - Browse JAR structure:
|
|
@@ -70,13 +294,16 @@ If Java is not in your system PATH, set the `DEJARED_JAVA_PATH` environment vari
|
|
|
70
294
|
## How It Works
|
|
71
295
|
|
|
72
296
|
The npm package is a thin Node.js wrapper. On first run it:
|
|
73
|
-
1. Checks
|
|
297
|
+
1. Checks the platform cache directory for a cached JAR matching the current version
|
|
298
|
+
- Linux: `$XDG_CACHE_HOME/dejared-mcp` (default `~/.cache/dejared-mcp`)
|
|
299
|
+
- macOS: `~/Library/Caches/dejared-mcp`
|
|
300
|
+
- Windows: `%LOCALAPPDATA%\dejared-mcp`
|
|
74
301
|
2. Downloads the JAR from GitHub Releases if not cached
|
|
75
302
|
3. Spawns `java -jar` with stdio inherited for MCP transport
|
|
76
303
|
|
|
77
304
|
The server communicates over stdio.
|
|
78
305
|
|
|
79
|
-
## Configuration
|
|
306
|
+
## Server Configuration
|
|
80
307
|
|
|
81
308
|
| Property | Default | Description |
|
|
82
309
|
|----------|---------|-------------|
|
package/lib/jar-runner.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JAR runner for dejared-mcp.
|
|
3
|
+
*
|
|
4
|
+
* Downloads the matching JAR from GitHub Releases into a platform-specific
|
|
5
|
+
* cache directory, then launches it with the locally available Java runtime.
|
|
6
|
+
*/
|
|
1
7
|
"use strict";
|
|
2
8
|
|
|
3
9
|
const { spawn, execFileSync } = require("node:child_process");
|
|
@@ -9,7 +15,32 @@ const os = require("node:os");
|
|
|
9
15
|
const PACKAGE = require(path.join(__dirname, "..", "package.json"));
|
|
10
16
|
const JAR_VERSION = PACKAGE.version;
|
|
11
17
|
const JAR_NAME = `dejared-mcp-${JAR_VERSION}.jar`;
|
|
12
|
-
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns the platform-specific cache directory for storing downloaded JARs.
|
|
21
|
+
* - Linux/BSD : $XDG_CACHE_HOME/dejared-mcp (default ~/.cache/dejared-mcp)
|
|
22
|
+
* - macOS : ~/Library/Caches/dejared-mcp
|
|
23
|
+
* - Windows : %LOCALAPPDATA%\dejared-mcp
|
|
24
|
+
*/
|
|
25
|
+
function getCacheDir() {
|
|
26
|
+
const env = process.env;
|
|
27
|
+
switch (os.platform()) {
|
|
28
|
+
case "win32":
|
|
29
|
+
return path.join(
|
|
30
|
+
env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local"),
|
|
31
|
+
"dejared-mcp",
|
|
32
|
+
);
|
|
33
|
+
case "darwin":
|
|
34
|
+
return path.join(os.homedir(), "Library", "Caches", "dejared-mcp");
|
|
35
|
+
default:
|
|
36
|
+
return path.join(
|
|
37
|
+
env.XDG_CACHE_HOME || path.join(os.homedir(), ".cache"),
|
|
38
|
+
"dejared-mcp",
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const CACHE_DIR = getCacheDir();
|
|
13
44
|
const JAR_PATH = path.join(CACHE_DIR, JAR_NAME);
|
|
14
45
|
const DOWNLOAD_URL = `https://github.com/HuynhKhanh1402/dejared-mcp/releases/download/v${JAR_VERSION}/${JAR_NAME}`;
|
|
15
46
|
|
|
@@ -17,6 +48,10 @@ function log(msg) {
|
|
|
17
48
|
process.stderr.write(`[dejared-mcp] ${msg}\n`);
|
|
18
49
|
}
|
|
19
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Resolves the Java binary path.
|
|
53
|
+
* Honours the DEJARED_JAVA_PATH env var; falls back to `java` on PATH.
|
|
54
|
+
*/
|
|
20
55
|
function resolveJava() {
|
|
21
56
|
const envJava = process.env.DEJARED_JAVA_PATH;
|
|
22
57
|
if (envJava) {
|
|
@@ -35,6 +70,11 @@ function resolveJava() {
|
|
|
35
70
|
}
|
|
36
71
|
}
|
|
37
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Downloads a file over HTTPS, following up to {@link redirects} redirects.
|
|
75
|
+
* Writes to a temporary file first, then atomically renames to {@link dest}
|
|
76
|
+
* to avoid leaving a partial/corrupt file on disk.
|
|
77
|
+
*/
|
|
38
78
|
function download(url, dest, redirects = 5) {
|
|
39
79
|
return new Promise((resolve, reject) => {
|
|
40
80
|
if (redirects <= 0) return reject(new Error("Too many redirects"));
|
|
@@ -72,6 +112,7 @@ function download(url, dest, redirects = 5) {
|
|
|
72
112
|
});
|
|
73
113
|
}
|
|
74
114
|
|
|
115
|
+
/** Ensures the JAR exists in cache, downloading it if missing or corrupted. */
|
|
75
116
|
async function ensureJar() {
|
|
76
117
|
if (fs.existsSync(JAR_PATH)) {
|
|
77
118
|
const stat = fs.statSync(JAR_PATH);
|
|
@@ -92,6 +133,7 @@ async function ensureJar() {
|
|
|
92
133
|
}
|
|
93
134
|
}
|
|
94
135
|
|
|
136
|
+
/** Entry point – resolves Java, ensures the JAR is cached, then spawns it. */
|
|
95
137
|
async function run() {
|
|
96
138
|
const javaPath = resolveJava();
|
|
97
139
|
await ensureJar();
|
package/package.json
CHANGED