mcp-mat 0.1.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/LICENSE +201 -0
- package/README.md +190 -0
- package/dist/src/config.d.ts +18 -0
- package/dist/src/config.js +173 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/logging.d.ts +23 -0
- package/dist/src/logging.js +76 -0
- package/dist/src/logging.js.map +1 -0
- package/dist/src/mat/artifacts.d.ts +20 -0
- package/dist/src/mat/artifacts.js +200 -0
- package/dist/src/mat/artifacts.js.map +1 -0
- package/dist/src/mat/commandBuilder.d.ts +25 -0
- package/dist/src/mat/commandBuilder.js +90 -0
- package/dist/src/mat/commandBuilder.js.map +1 -0
- package/dist/src/mat/errorClassifier.d.ts +3 -0
- package/dist/src/mat/errorClassifier.js +98 -0
- package/dist/src/mat/errorClassifier.js.map +1 -0
- package/dist/src/mat/launcher.d.ts +6 -0
- package/dist/src/mat/launcher.js +89 -0
- package/dist/src/mat/launcher.js.map +1 -0
- package/dist/src/mat/oqlSpec.d.ts +3 -0
- package/dist/src/mat/oqlSpec.js +78 -0
- package/dist/src/mat/oqlSpec.js.map +1 -0
- package/dist/src/mat/runner.d.ts +3 -0
- package/dist/src/mat/runner.js +80 -0
- package/dist/src/mat/runner.js.map +1 -0
- package/dist/src/mat/service.d.ts +57 -0
- package/dist/src/mat/service.js +415 -0
- package/dist/src/mat/service.js.map +1 -0
- package/dist/src/security/pathGuard.d.ts +2 -0
- package/dist/src/security/pathGuard.js +63 -0
- package/dist/src/security/pathGuard.js.map +1 -0
- package/dist/src/server.d.ts +1 -0
- package/dist/src/server.js +88 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/tools/dispatcher.d.ts +3 -0
- package/dist/src/tools/dispatcher.js +69 -0
- package/dist/src/tools/dispatcher.js.map +1 -0
- package/dist/src/tools/matHealthcheck.d.ts +3 -0
- package/dist/src/tools/matHealthcheck.js +19 -0
- package/dist/src/tools/matHealthcheck.js.map +1 -0
- package/dist/src/tools/matIndexStatus.d.ts +3 -0
- package/dist/src/tools/matIndexStatus.js +19 -0
- package/dist/src/tools/matIndexStatus.js.map +1 -0
- package/dist/src/tools/matOqlQuery.d.ts +3 -0
- package/dist/src/tools/matOqlQuery.js +19 -0
- package/dist/src/tools/matOqlQuery.js.map +1 -0
- package/dist/src/tools/matOqlSpec.d.ts +3 -0
- package/dist/src/tools/matOqlSpec.js +19 -0
- package/dist/src/tools/matOqlSpec.js.map +1 -0
- package/dist/src/tools/matParseReport.d.ts +3 -0
- package/dist/src/tools/matParseReport.js +19 -0
- package/dist/src/tools/matParseReport.js.map +1 -0
- package/dist/src/tools/matRunCommand.d.ts +3 -0
- package/dist/src/tools/matRunCommand.js +19 -0
- package/dist/src/tools/matRunCommand.js.map +1 -0
- package/dist/src/tools/schemas.d.ts +231 -0
- package/dist/src/tools/schemas.js +165 -0
- package/dist/src/tools/schemas.js.map +1 -0
- package/dist/src/types.d.ts +102 -0
- package/dist/src/types.js +41 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const matHealthcheckSchema: z.ZodObject<{
|
|
3
|
+
mat_home: z.ZodOptional<z.ZodString>;
|
|
4
|
+
java_path: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, "strict", z.ZodTypeAny, {
|
|
6
|
+
mat_home?: string | undefined;
|
|
7
|
+
java_path?: string | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
mat_home?: string | undefined;
|
|
10
|
+
java_path?: string | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const matParseReportSchema: z.ZodObject<{
|
|
13
|
+
heap_path: z.ZodString;
|
|
14
|
+
report_id: z.ZodString;
|
|
15
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
16
|
+
xmx_mb: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
timeout_sec: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
}, "strict", z.ZodTypeAny, {
|
|
19
|
+
heap_path: string;
|
|
20
|
+
report_id: string;
|
|
21
|
+
options?: Record<string, string | number | boolean> | undefined;
|
|
22
|
+
xmx_mb?: number | undefined;
|
|
23
|
+
timeout_sec?: number | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
heap_path: string;
|
|
26
|
+
report_id: string;
|
|
27
|
+
options?: Record<string, string | number | boolean> | undefined;
|
|
28
|
+
xmx_mb?: number | undefined;
|
|
29
|
+
timeout_sec?: number | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const matOqlQuerySchema: z.ZodObject<{
|
|
32
|
+
heap_path: z.ZodString;
|
|
33
|
+
oql: z.ZodString;
|
|
34
|
+
format: z.ZodOptional<z.ZodEnum<["txt", "html", "csv"]>>;
|
|
35
|
+
unzip: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
xmx_mb: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
timeout_sec: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
}, "strict", z.ZodTypeAny, {
|
|
40
|
+
heap_path: string;
|
|
41
|
+
oql: string;
|
|
42
|
+
xmx_mb?: number | undefined;
|
|
43
|
+
timeout_sec?: number | undefined;
|
|
44
|
+
limit?: number | undefined;
|
|
45
|
+
format?: "txt" | "html" | "csv" | undefined;
|
|
46
|
+
unzip?: boolean | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
heap_path: string;
|
|
49
|
+
oql: string;
|
|
50
|
+
xmx_mb?: number | undefined;
|
|
51
|
+
timeout_sec?: number | undefined;
|
|
52
|
+
limit?: number | undefined;
|
|
53
|
+
format?: "txt" | "html" | "csv" | undefined;
|
|
54
|
+
unzip?: boolean | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const matIndexStatusSchema: z.ZodObject<{
|
|
57
|
+
heap_path: z.ZodString;
|
|
58
|
+
}, "strict", z.ZodTypeAny, {
|
|
59
|
+
heap_path: string;
|
|
60
|
+
}, {
|
|
61
|
+
heap_path: string;
|
|
62
|
+
}>;
|
|
63
|
+
export declare const matRunCommandSchema: z.ZodObject<{
|
|
64
|
+
heap_path: z.ZodString;
|
|
65
|
+
command_name: z.ZodString;
|
|
66
|
+
command_args: z.ZodOptional<z.ZodString>;
|
|
67
|
+
format: z.ZodOptional<z.ZodEnum<["txt", "html", "csv"]>>;
|
|
68
|
+
unzip: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
70
|
+
xmx_mb: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
timeout_sec: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
}, "strict", z.ZodTypeAny, {
|
|
73
|
+
heap_path: string;
|
|
74
|
+
command_name: string;
|
|
75
|
+
xmx_mb?: number | undefined;
|
|
76
|
+
timeout_sec?: number | undefined;
|
|
77
|
+
limit?: number | undefined;
|
|
78
|
+
format?: "txt" | "html" | "csv" | undefined;
|
|
79
|
+
unzip?: boolean | undefined;
|
|
80
|
+
command_args?: string | undefined;
|
|
81
|
+
}, {
|
|
82
|
+
heap_path: string;
|
|
83
|
+
command_name: string;
|
|
84
|
+
xmx_mb?: number | undefined;
|
|
85
|
+
timeout_sec?: number | undefined;
|
|
86
|
+
limit?: number | undefined;
|
|
87
|
+
format?: "txt" | "html" | "csv" | undefined;
|
|
88
|
+
unzip?: boolean | undefined;
|
|
89
|
+
command_args?: string | undefined;
|
|
90
|
+
}>;
|
|
91
|
+
export declare const matOqlSpecSchema: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
92
|
+
export declare const toolDefinitions: readonly [{
|
|
93
|
+
readonly name: "mat_healthcheck";
|
|
94
|
+
readonly description: "Validate MAT launcher and Java runtime availability.";
|
|
95
|
+
readonly inputSchema: {
|
|
96
|
+
readonly type: "object";
|
|
97
|
+
readonly additionalProperties: false;
|
|
98
|
+
readonly properties: {
|
|
99
|
+
readonly mat_home: {
|
|
100
|
+
readonly type: "string";
|
|
101
|
+
};
|
|
102
|
+
readonly java_path: {
|
|
103
|
+
readonly type: "string";
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "mat_parse_report";
|
|
109
|
+
readonly description: "Run a predefined MAT report headlessly and return generated artifacts.";
|
|
110
|
+
readonly inputSchema: {
|
|
111
|
+
readonly type: "object";
|
|
112
|
+
readonly additionalProperties: false;
|
|
113
|
+
readonly required: readonly ["heap_path", "report_id"];
|
|
114
|
+
readonly properties: {
|
|
115
|
+
readonly heap_path: {
|
|
116
|
+
readonly type: "string";
|
|
117
|
+
};
|
|
118
|
+
readonly report_id: {
|
|
119
|
+
readonly type: "string";
|
|
120
|
+
};
|
|
121
|
+
readonly options: {
|
|
122
|
+
readonly type: "object";
|
|
123
|
+
readonly additionalProperties: {
|
|
124
|
+
readonly anyOf: readonly [{
|
|
125
|
+
readonly type: "string";
|
|
126
|
+
}, {
|
|
127
|
+
readonly type: "number";
|
|
128
|
+
}, {
|
|
129
|
+
readonly type: "boolean";
|
|
130
|
+
}];
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
readonly xmx_mb: {
|
|
134
|
+
readonly type: "integer";
|
|
135
|
+
};
|
|
136
|
+
readonly timeout_sec: {
|
|
137
|
+
readonly type: "integer";
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
}, {
|
|
142
|
+
readonly name: "mat_oql_query";
|
|
143
|
+
readonly description: "Execute a single MAT OQL query and return result artifacts.";
|
|
144
|
+
readonly inputSchema: {
|
|
145
|
+
readonly type: "object";
|
|
146
|
+
readonly additionalProperties: false;
|
|
147
|
+
readonly required: readonly ["heap_path", "oql"];
|
|
148
|
+
readonly properties: {
|
|
149
|
+
readonly heap_path: {
|
|
150
|
+
readonly type: "string";
|
|
151
|
+
};
|
|
152
|
+
readonly oql: {
|
|
153
|
+
readonly type: "string";
|
|
154
|
+
};
|
|
155
|
+
readonly format: {
|
|
156
|
+
readonly type: "string";
|
|
157
|
+
readonly enum: readonly ["txt", "html", "csv"];
|
|
158
|
+
};
|
|
159
|
+
readonly unzip: {
|
|
160
|
+
readonly type: "boolean";
|
|
161
|
+
};
|
|
162
|
+
readonly limit: {
|
|
163
|
+
readonly type: "integer";
|
|
164
|
+
};
|
|
165
|
+
readonly xmx_mb: {
|
|
166
|
+
readonly type: "integer";
|
|
167
|
+
};
|
|
168
|
+
readonly timeout_sec: {
|
|
169
|
+
readonly type: "integer";
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
}, {
|
|
174
|
+
readonly name: "mat_index_status";
|
|
175
|
+
readonly description: "Report whether MAT index artifacts already exist for a heap dump.";
|
|
176
|
+
readonly inputSchema: {
|
|
177
|
+
readonly type: "object";
|
|
178
|
+
readonly additionalProperties: false;
|
|
179
|
+
readonly required: readonly ["heap_path"];
|
|
180
|
+
readonly properties: {
|
|
181
|
+
readonly heap_path: {
|
|
182
|
+
readonly type: "string";
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
}, {
|
|
187
|
+
readonly name: "mat_run_command";
|
|
188
|
+
readonly description: string;
|
|
189
|
+
readonly inputSchema: {
|
|
190
|
+
readonly type: "object";
|
|
191
|
+
readonly additionalProperties: false;
|
|
192
|
+
readonly required: readonly ["heap_path", "command_name"];
|
|
193
|
+
readonly properties: {
|
|
194
|
+
readonly heap_path: {
|
|
195
|
+
readonly type: "string";
|
|
196
|
+
};
|
|
197
|
+
readonly command_name: {
|
|
198
|
+
readonly type: "string";
|
|
199
|
+
readonly description: string;
|
|
200
|
+
};
|
|
201
|
+
readonly command_args: {
|
|
202
|
+
readonly type: "string";
|
|
203
|
+
readonly description: string;
|
|
204
|
+
};
|
|
205
|
+
readonly format: {
|
|
206
|
+
readonly type: "string";
|
|
207
|
+
readonly enum: readonly ["txt", "html", "csv"];
|
|
208
|
+
};
|
|
209
|
+
readonly unzip: {
|
|
210
|
+
readonly type: "boolean";
|
|
211
|
+
};
|
|
212
|
+
readonly limit: {
|
|
213
|
+
readonly type: "integer";
|
|
214
|
+
};
|
|
215
|
+
readonly xmx_mb: {
|
|
216
|
+
readonly type: "integer";
|
|
217
|
+
};
|
|
218
|
+
readonly timeout_sec: {
|
|
219
|
+
readonly type: "integer";
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
}, {
|
|
224
|
+
readonly name: "mat_oql_spec";
|
|
225
|
+
readonly description: "Return MAT OQL parser-mode guidance, supported patterns, and known limitations.";
|
|
226
|
+
readonly inputSchema: {
|
|
227
|
+
readonly type: "object";
|
|
228
|
+
readonly additionalProperties: false;
|
|
229
|
+
readonly properties: {};
|
|
230
|
+
};
|
|
231
|
+
}];
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// Copyright 2025 Penghui Li
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
const optionValueSchema = z.union([z.string(), z.number(), z.boolean()]);
|
|
16
|
+
export const matHealthcheckSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
mat_home: z.string().optional(),
|
|
19
|
+
java_path: z.string().optional(),
|
|
20
|
+
})
|
|
21
|
+
.strict();
|
|
22
|
+
export const matParseReportSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
heap_path: z.string().min(1),
|
|
25
|
+
report_id: z.string().min(1),
|
|
26
|
+
options: z.record(optionValueSchema).optional(),
|
|
27
|
+
xmx_mb: z.number().int().optional(),
|
|
28
|
+
timeout_sec: z.number().int().optional(),
|
|
29
|
+
})
|
|
30
|
+
.strict();
|
|
31
|
+
export const matOqlQuerySchema = z
|
|
32
|
+
.object({
|
|
33
|
+
heap_path: z.string().min(1),
|
|
34
|
+
oql: z.string().min(1),
|
|
35
|
+
format: z.enum(["txt", "html", "csv"]).optional(),
|
|
36
|
+
unzip: z.boolean().optional(),
|
|
37
|
+
limit: z.number().int().optional(),
|
|
38
|
+
xmx_mb: z.number().int().optional(),
|
|
39
|
+
timeout_sec: z.number().int().optional(),
|
|
40
|
+
})
|
|
41
|
+
.strict();
|
|
42
|
+
export const matIndexStatusSchema = z
|
|
43
|
+
.object({
|
|
44
|
+
heap_path: z.string().min(1),
|
|
45
|
+
})
|
|
46
|
+
.strict();
|
|
47
|
+
export const matRunCommandSchema = z
|
|
48
|
+
.object({
|
|
49
|
+
heap_path: z.string().min(1),
|
|
50
|
+
command_name: z.string().min(1),
|
|
51
|
+
command_args: z.string().optional(),
|
|
52
|
+
format: z.enum(["txt", "html", "csv"]).optional(),
|
|
53
|
+
unzip: z.boolean().optional(),
|
|
54
|
+
limit: z.number().int().optional(),
|
|
55
|
+
xmx_mb: z.number().int().optional(),
|
|
56
|
+
timeout_sec: z.number().int().optional(),
|
|
57
|
+
})
|
|
58
|
+
.strict();
|
|
59
|
+
export const matOqlSpecSchema = z.object({}).strict();
|
|
60
|
+
export const toolDefinitions = [
|
|
61
|
+
{
|
|
62
|
+
name: "mat_healthcheck",
|
|
63
|
+
description: "Validate MAT launcher and Java runtime availability.",
|
|
64
|
+
inputSchema: {
|
|
65
|
+
type: "object",
|
|
66
|
+
additionalProperties: false,
|
|
67
|
+
properties: {
|
|
68
|
+
mat_home: { type: "string" },
|
|
69
|
+
java_path: { type: "string" },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "mat_parse_report",
|
|
75
|
+
description: "Run a predefined MAT report headlessly and return generated artifacts.",
|
|
76
|
+
inputSchema: {
|
|
77
|
+
type: "object",
|
|
78
|
+
additionalProperties: false,
|
|
79
|
+
required: ["heap_path", "report_id"],
|
|
80
|
+
properties: {
|
|
81
|
+
heap_path: { type: "string" },
|
|
82
|
+
report_id: { type: "string" },
|
|
83
|
+
options: {
|
|
84
|
+
type: "object",
|
|
85
|
+
additionalProperties: {
|
|
86
|
+
anyOf: [{ type: "string" }, { type: "number" }, { type: "boolean" }],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
xmx_mb: { type: "integer" },
|
|
90
|
+
timeout_sec: { type: "integer" },
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: "mat_oql_query",
|
|
96
|
+
description: "Execute a single MAT OQL query and return result artifacts.",
|
|
97
|
+
inputSchema: {
|
|
98
|
+
type: "object",
|
|
99
|
+
additionalProperties: false,
|
|
100
|
+
required: ["heap_path", "oql"],
|
|
101
|
+
properties: {
|
|
102
|
+
heap_path: { type: "string" },
|
|
103
|
+
oql: { type: "string" },
|
|
104
|
+
format: { type: "string", enum: ["txt", "html", "csv"] },
|
|
105
|
+
unzip: { type: "boolean" },
|
|
106
|
+
limit: { type: "integer" },
|
|
107
|
+
xmx_mb: { type: "integer" },
|
|
108
|
+
timeout_sec: { type: "integer" },
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "mat_index_status",
|
|
114
|
+
description: "Report whether MAT index artifacts already exist for a heap dump.",
|
|
115
|
+
inputSchema: {
|
|
116
|
+
type: "object",
|
|
117
|
+
additionalProperties: false,
|
|
118
|
+
required: ["heap_path"],
|
|
119
|
+
properties: {
|
|
120
|
+
heap_path: { type: "string" },
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "mat_run_command",
|
|
126
|
+
description: "Execute a named MAT analysis command headlessly and return result artifacts. " +
|
|
127
|
+
"Supports 56 built-in commands including: dominator_tree, path2gc, merge_shortest_paths, " +
|
|
128
|
+
"histogram, thread_overview, thread_details, collection_fill_ratio, gc_roots, " +
|
|
129
|
+
"find_strings, component_report, system_properties, and many more. " +
|
|
130
|
+
"Use mat_oql_query for OQL queries instead.",
|
|
131
|
+
inputSchema: {
|
|
132
|
+
type: "object",
|
|
133
|
+
additionalProperties: false,
|
|
134
|
+
required: ["heap_path", "command_name"],
|
|
135
|
+
properties: {
|
|
136
|
+
heap_path: { type: "string" },
|
|
137
|
+
command_name: {
|
|
138
|
+
type: "string",
|
|
139
|
+
description: "MAT command name, e.g. histogram, dominator_tree, path2gc, thread_overview, " +
|
|
140
|
+
"collection_fill_ratio, gc_roots, find_strings, etc.",
|
|
141
|
+
},
|
|
142
|
+
command_args: {
|
|
143
|
+
type: "string",
|
|
144
|
+
description: "Optional arguments for the command. Format depends on the command, e.g. " +
|
|
145
|
+
"an object address like '0x12345678' for path2gc, or a class pattern for histogram.",
|
|
146
|
+
},
|
|
147
|
+
format: { type: "string", enum: ["txt", "html", "csv"] },
|
|
148
|
+
unzip: { type: "boolean" },
|
|
149
|
+
limit: { type: "integer" },
|
|
150
|
+
xmx_mb: { type: "integer" },
|
|
151
|
+
timeout_sec: { type: "integer" },
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: "mat_oql_spec",
|
|
157
|
+
description: "Return MAT OQL parser-mode guidance, supported patterns, and known limitations.",
|
|
158
|
+
inputSchema: {
|
|
159
|
+
type: "object",
|
|
160
|
+
additionalProperties: false,
|
|
161
|
+
properties: {},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
];
|
|
165
|
+
//# sourceMappingURL=schemas.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,EAAE;gBAC7B,YAAY,EAAE;oBACZ,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,8EAA8E;wBAC9E,qDAAqD;iBACxD;gBACD,YAAY,EAAE;oBACZ,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,0EAA0E;wBAC1E,oFAAoF;iBACvF;gBACD,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE;gBACxD,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBAC1B,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBAC1B,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;gBAC3B,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;aACjC;SACF;KACF;IACD;QACE,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,iFAAiF;QAC9F,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,KAAK;YAC3B,UAAU,EAAE,EAAE;SACf;KACF;CACO,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export type MatErrorCategory = "MAT_NOT_FOUND" | "HEAP_NOT_FOUND" | "WRITE_PERMISSION_DENIED" | "MAT_PARSE_FAILED" | "MAT_TIMEOUT" | "INVALID_QUERY";
|
|
2
|
+
export interface MatErrorResponse {
|
|
3
|
+
status: "error";
|
|
4
|
+
category: MatErrorCategory;
|
|
5
|
+
message: string;
|
|
6
|
+
hint: string;
|
|
7
|
+
stdout_tail: string;
|
|
8
|
+
stderr_tail: string;
|
|
9
|
+
exit_code: number | null;
|
|
10
|
+
}
|
|
11
|
+
export interface RunCommand {
|
|
12
|
+
command: string;
|
|
13
|
+
args: string[];
|
|
14
|
+
timeoutSec: number;
|
|
15
|
+
maxBufferChars?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface RunResult {
|
|
18
|
+
command: string;
|
|
19
|
+
args: string[];
|
|
20
|
+
exitCode: number | null;
|
|
21
|
+
signal: NodeJS.Signals | null;
|
|
22
|
+
timedOut: boolean;
|
|
23
|
+
stdout: string;
|
|
24
|
+
stderr: string;
|
|
25
|
+
durationMs: number;
|
|
26
|
+
}
|
|
27
|
+
export interface MatParseReportSuccess {
|
|
28
|
+
status: "ok";
|
|
29
|
+
exit_code: number;
|
|
30
|
+
report_dir: string | null;
|
|
31
|
+
report_zip: string | null;
|
|
32
|
+
generated_files: string[];
|
|
33
|
+
stdout_tail: string;
|
|
34
|
+
stderr_tail: string;
|
|
35
|
+
}
|
|
36
|
+
export interface MatOqlQuerySuccess {
|
|
37
|
+
status: "ok";
|
|
38
|
+
exit_code: number;
|
|
39
|
+
query_dir: string | null;
|
|
40
|
+
query_zip: string | null;
|
|
41
|
+
result_txt: string | null;
|
|
42
|
+
result_preview: string[];
|
|
43
|
+
generated_files: string[];
|
|
44
|
+
stdout_tail: string;
|
|
45
|
+
stderr_tail: string;
|
|
46
|
+
}
|
|
47
|
+
export interface MatHealthcheckSuccess {
|
|
48
|
+
status: "ok";
|
|
49
|
+
ok: true;
|
|
50
|
+
mat_launcher: string;
|
|
51
|
+
java_version: string;
|
|
52
|
+
notes: string[];
|
|
53
|
+
}
|
|
54
|
+
export interface MatIndexStatusSuccess {
|
|
55
|
+
status: "ok";
|
|
56
|
+
index_present: boolean;
|
|
57
|
+
index_files: string[];
|
|
58
|
+
threads_file: string | null;
|
|
59
|
+
last_modified: string | null;
|
|
60
|
+
}
|
|
61
|
+
export interface MatOqlSpecSuccess {
|
|
62
|
+
status: "ok";
|
|
63
|
+
parser_mode: string;
|
|
64
|
+
command_format: string;
|
|
65
|
+
client_input_rules: string[];
|
|
66
|
+
supported_patterns: Array<{
|
|
67
|
+
name: string;
|
|
68
|
+
query: string;
|
|
69
|
+
description: string;
|
|
70
|
+
}>;
|
|
71
|
+
unsupported_patterns: string[];
|
|
72
|
+
notes: string[];
|
|
73
|
+
}
|
|
74
|
+
export interface MatRunCommandSuccess {
|
|
75
|
+
status: "ok";
|
|
76
|
+
exit_code: number;
|
|
77
|
+
command_name: string;
|
|
78
|
+
query_dir: string | null;
|
|
79
|
+
query_zip: string | null;
|
|
80
|
+
result_txt: string | null;
|
|
81
|
+
result_preview: string[];
|
|
82
|
+
generated_files: string[];
|
|
83
|
+
stdout_tail: string;
|
|
84
|
+
stderr_tail: string;
|
|
85
|
+
}
|
|
86
|
+
export type ToolResponse = MatHealthcheckSuccess | MatParseReportSuccess | MatOqlQuerySuccess | MatIndexStatusSuccess | MatOqlSpecSuccess | MatRunCommandSuccess | MatErrorResponse;
|
|
87
|
+
export declare class MatMcpError extends Error {
|
|
88
|
+
readonly category: MatErrorCategory;
|
|
89
|
+
readonly hint: string;
|
|
90
|
+
readonly stdoutTail: string;
|
|
91
|
+
readonly stderrTail: string;
|
|
92
|
+
readonly exitCode: number | null;
|
|
93
|
+
constructor(params: {
|
|
94
|
+
category: MatErrorCategory;
|
|
95
|
+
message: string;
|
|
96
|
+
hint: string;
|
|
97
|
+
stdoutTail?: string;
|
|
98
|
+
stderrTail?: string;
|
|
99
|
+
exitCode?: number | null;
|
|
100
|
+
});
|
|
101
|
+
toResponse(): MatErrorResponse;
|
|
102
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2025 Penghui Li
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
export class MatMcpError extends Error {
|
|
15
|
+
category;
|
|
16
|
+
hint;
|
|
17
|
+
stdoutTail;
|
|
18
|
+
stderrTail;
|
|
19
|
+
exitCode;
|
|
20
|
+
constructor(params) {
|
|
21
|
+
super(params.message);
|
|
22
|
+
this.name = "MatMcpError";
|
|
23
|
+
this.category = params.category;
|
|
24
|
+
this.hint = params.hint;
|
|
25
|
+
this.stdoutTail = params.stdoutTail ?? "";
|
|
26
|
+
this.stderrTail = params.stderrTail ?? "";
|
|
27
|
+
this.exitCode = params.exitCode ?? null;
|
|
28
|
+
}
|
|
29
|
+
toResponse() {
|
|
30
|
+
return {
|
|
31
|
+
status: "error",
|
|
32
|
+
category: this.category,
|
|
33
|
+
message: this.message,
|
|
34
|
+
hint: this.hint,
|
|
35
|
+
stdout_tail: this.stdoutTail,
|
|
36
|
+
stderr_tail: this.stderrTail,
|
|
37
|
+
exit_code: this.exitCode,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAgHjC,MAAM,OAAO,WAAY,SAAQ,KAAK;IACpB,QAAQ,CAAmB;IAC3B,IAAI,CAAS;IACb,UAAU,CAAS;IACnB,UAAU,CAAS;IACnB,QAAQ,CAAgB;IAExC,YAAY,MAOX;QACC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;QAC1C,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;QAC1C,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC;IAC1C,CAAC;IAED,UAAU;QACR,OAAO;YACL,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,UAAU;YAC5B,WAAW,EAAE,IAAI,CAAC,UAAU;YAC5B,SAAS,EAAE,IAAI,CAAC,QAAQ;SACzB,CAAC;IACJ,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mcp-mat",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Headless Eclipse MAT MCP server",
|
|
5
|
+
"mcpName": "io.github.codelipenghui/mcp-mat",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/src/server.js",
|
|
9
|
+
"bin": {
|
|
10
|
+
"mcp-mat": "dist/src/server.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist/src"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/codelipenghui/mcp-mat.git"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"mcp",
|
|
21
|
+
"eclipse-mat",
|
|
22
|
+
"heap-dump",
|
|
23
|
+
"memory-analysis",
|
|
24
|
+
"java"
|
|
25
|
+
],
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=20"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsc -p tsconfig.json",
|
|
31
|
+
"dev": "tsx src/server.ts",
|
|
32
|
+
"start": "node dist/src/server.js",
|
|
33
|
+
"test": "tsx --test test/**/*.test.ts",
|
|
34
|
+
"prepublishOnly": "npm run build && node scripts/prepublish.mjs"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
38
|
+
"zod": "^3.24.1"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^22.10.2",
|
|
42
|
+
"tsx": "^4.19.2",
|
|
43
|
+
"typescript": "^5.7.2"
|
|
44
|
+
}
|
|
45
|
+
}
|