@mcp-z/cli 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/LICENSE +21 -0
- package/README.md +166 -0
- package/bin/cli.js +5 -0
- package/dist/cjs/cli.d.cts +1 -0
- package/dist/cjs/cli.d.ts +1 -0
- package/dist/cjs/cli.js +576 -0
- package/dist/cjs/cli.js.map +1 -0
- package/dist/cjs/commands/call-tool.d.cts +26 -0
- package/dist/cjs/commands/call-tool.d.ts +26 -0
- package/dist/cjs/commands/call-tool.js +362 -0
- package/dist/cjs/commands/call-tool.js.map +1 -0
- package/dist/cjs/commands/get-prompt.d.cts +26 -0
- package/dist/cjs/commands/get-prompt.d.ts +26 -0
- package/dist/cjs/commands/get-prompt.js +335 -0
- package/dist/cjs/commands/get-prompt.js.map +1 -0
- package/dist/cjs/commands/inspect.d.cts +35 -0
- package/dist/cjs/commands/inspect.d.ts +35 -0
- package/dist/cjs/commands/inspect.js +896 -0
- package/dist/cjs/commands/inspect.js.map +1 -0
- package/dist/cjs/commands/manifest/env-prompting.d.cts +21 -0
- package/dist/cjs/commands/manifest/env-prompting.d.ts +21 -0
- package/dist/cjs/commands/manifest/env-prompting.js +657 -0
- package/dist/cjs/commands/manifest/env-prompting.js.map +1 -0
- package/dist/cjs/commands/manifest/generate.d.cts +124 -0
- package/dist/cjs/commands/manifest/generate.d.ts +124 -0
- package/dist/cjs/commands/manifest/generate.js +2541 -0
- package/dist/cjs/commands/manifest/generate.js.map +1 -0
- package/dist/cjs/commands/manifest/index.d.cts +2 -0
- package/dist/cjs/commands/manifest/index.d.ts +2 -0
- package/dist/cjs/commands/manifest/index.js +229 -0
- package/dist/cjs/commands/manifest/index.js.map +1 -0
- package/dist/cjs/commands/manifest/metadata-reader.d.cts +71 -0
- package/dist/cjs/commands/manifest/metadata-reader.d.ts +71 -0
- package/dist/cjs/commands/manifest/metadata-reader.js +441 -0
- package/dist/cjs/commands/manifest/metadata-reader.js.map +1 -0
- package/dist/cjs/commands/manifest/validate.d.cts +1 -0
- package/dist/cjs/commands/manifest/validate.d.ts +1 -0
- package/dist/cjs/commands/manifest/validate.js +525 -0
- package/dist/cjs/commands/manifest/validate.js.map +1 -0
- package/dist/cjs/commands/read-resource.d.cts +24 -0
- package/dist/cjs/commands/read-resource.d.ts +24 -0
- package/dist/cjs/commands/read-resource.js +311 -0
- package/dist/cjs/commands/read-resource.js.map +1 -0
- package/dist/cjs/commands/search.d.cts +31 -0
- package/dist/cjs/commands/search.d.ts +31 -0
- package/dist/cjs/commands/search.js +464 -0
- package/dist/cjs/commands/search.js.map +1 -0
- package/dist/cjs/commands/up.d.cts +49 -0
- package/dist/cjs/commands/up.d.ts +49 -0
- package/dist/cjs/commands/up.js +235 -0
- package/dist/cjs/commands/up.js.map +1 -0
- package/dist/cjs/index.d.cts +7 -0
- package/dist/cjs/index.d.ts +7 -0
- package/dist/cjs/index.js +85 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/lib/find-config.d.cts +14 -0
- package/dist/cjs/lib/find-config.d.ts +14 -0
- package/dist/cjs/lib/find-config.js +93 -0
- package/dist/cjs/lib/find-config.js.map +1 -0
- package/dist/cjs/lib/json-schema.d.cts +18 -0
- package/dist/cjs/lib/json-schema.d.ts +18 -0
- package/dist/cjs/lib/json-schema.js +306 -0
- package/dist/cjs/lib/json-schema.js.map +1 -0
- package/dist/cjs/lib/resolve-server-config.d.cts +50 -0
- package/dist/cjs/lib/resolve-server-config.d.ts +50 -0
- package/dist/cjs/lib/resolve-server-config.js +214 -0
- package/dist/cjs/lib/resolve-server-config.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/types.d.cts +21 -0
- package/dist/cjs/types.d.ts +21 -0
- package/dist/cjs/types.js +32 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/cli.d.ts +1 -0
- package/dist/esm/cli.js +129 -0
- package/dist/esm/cli.js.map +1 -0
- package/dist/esm/commands/call-tool.d.ts +26 -0
- package/dist/esm/commands/call-tool.js +151 -0
- package/dist/esm/commands/call-tool.js.map +1 -0
- package/dist/esm/commands/get-prompt.d.ts +26 -0
- package/dist/esm/commands/get-prompt.js +118 -0
- package/dist/esm/commands/get-prompt.js.map +1 -0
- package/dist/esm/commands/inspect.d.ts +35 -0
- package/dist/esm/commands/inspect.js +438 -0
- package/dist/esm/commands/inspect.js.map +1 -0
- package/dist/esm/commands/manifest/env-prompting.d.ts +21 -0
- package/dist/esm/commands/manifest/env-prompting.js +213 -0
- package/dist/esm/commands/manifest/env-prompting.js.map +1 -0
- package/dist/esm/commands/manifest/generate.d.ts +124 -0
- package/dist/esm/commands/manifest/generate.js +1087 -0
- package/dist/esm/commands/manifest/generate.js.map +1 -0
- package/dist/esm/commands/manifest/index.d.ts +2 -0
- package/dist/esm/commands/manifest/index.js +23 -0
- package/dist/esm/commands/manifest/index.js.map +1 -0
- package/dist/esm/commands/manifest/metadata-reader.d.ts +71 -0
- package/dist/esm/commands/manifest/metadata-reader.js +143 -0
- package/dist/esm/commands/manifest/metadata-reader.js.map +1 -0
- package/dist/esm/commands/manifest/validate.d.ts +1 -0
- package/dist/esm/commands/manifest/validate.js +167 -0
- package/dist/esm/commands/manifest/validate.js.map +1 -0
- package/dist/esm/commands/read-resource.d.ts +24 -0
- package/dist/esm/commands/read-resource.js +95 -0
- package/dist/esm/commands/read-resource.js.map +1 -0
- package/dist/esm/commands/search.d.ts +31 -0
- package/dist/esm/commands/search.js +145 -0
- package/dist/esm/commands/search.js.map +1 -0
- package/dist/esm/commands/up.d.ts +49 -0
- package/dist/esm/commands/up.js +74 -0
- package/dist/esm/commands/up.js.map +1 -0
- package/dist/esm/index.d.ts +7 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/find-config.d.ts +14 -0
- package/dist/esm/lib/find-config.js +42 -0
- package/dist/esm/lib/find-config.js.map +1 -0
- package/dist/esm/lib/json-schema.d.ts +18 -0
- package/dist/esm/lib/json-schema.js +66 -0
- package/dist/esm/lib/json-schema.js.map +1 -0
- package/dist/esm/lib/resolve-server-config.d.ts +50 -0
- package/dist/esm/lib/resolve-server-config.js +154 -0
- package/dist/esm/lib/resolve-server-config.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/types.d.ts +21 -0
- package/dist/esm/types.js +11 -0
- package/dist/esm/types.js.map +1 -0
- package/package.json +99 -0
- package/schemas/server.schema.json +489 -0
|
@@ -0,0 +1,525 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "validateCommand", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return validateCommand;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _fs = /*#__PURE__*/ _interop_require_wildcard(require("fs"));
|
|
12
|
+
var _typests = require("../../types.js");
|
|
13
|
+
var _metadatareaderts = require("./metadata-reader.js");
|
|
14
|
+
function _array_like_to_array(arr, len) {
|
|
15
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
16
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
17
|
+
return arr2;
|
|
18
|
+
}
|
|
19
|
+
function _array_with_holes(arr) {
|
|
20
|
+
if (Array.isArray(arr)) return arr;
|
|
21
|
+
}
|
|
22
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
23
|
+
try {
|
|
24
|
+
var info = gen[key](arg);
|
|
25
|
+
var value = info.value;
|
|
26
|
+
} catch (error) {
|
|
27
|
+
reject(error);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (info.done) {
|
|
31
|
+
resolve(value);
|
|
32
|
+
} else {
|
|
33
|
+
Promise.resolve(value).then(_next, _throw);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function _async_to_generator(fn) {
|
|
37
|
+
return function() {
|
|
38
|
+
var self = this, args = arguments;
|
|
39
|
+
return new Promise(function(resolve, reject) {
|
|
40
|
+
var gen = fn.apply(self, args);
|
|
41
|
+
function _next(value) {
|
|
42
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
43
|
+
}
|
|
44
|
+
function _throw(err) {
|
|
45
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
46
|
+
}
|
|
47
|
+
_next(undefined);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function _instanceof(left, right) {
|
|
52
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
53
|
+
return !!right[Symbol.hasInstance](left);
|
|
54
|
+
} else {
|
|
55
|
+
return left instanceof right;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
59
|
+
if (typeof WeakMap !== "function") return null;
|
|
60
|
+
var cacheBabelInterop = new WeakMap();
|
|
61
|
+
var cacheNodeInterop = new WeakMap();
|
|
62
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
63
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
64
|
+
})(nodeInterop);
|
|
65
|
+
}
|
|
66
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
67
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
68
|
+
return obj;
|
|
69
|
+
}
|
|
70
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
71
|
+
return {
|
|
72
|
+
default: obj
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
76
|
+
if (cache && cache.has(obj)) {
|
|
77
|
+
return cache.get(obj);
|
|
78
|
+
}
|
|
79
|
+
var newObj = {
|
|
80
|
+
__proto__: null
|
|
81
|
+
};
|
|
82
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
83
|
+
for(var key in obj){
|
|
84
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
85
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
86
|
+
if (desc && (desc.get || desc.set)) {
|
|
87
|
+
Object.defineProperty(newObj, key, desc);
|
|
88
|
+
} else {
|
|
89
|
+
newObj[key] = obj[key];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
newObj.default = obj;
|
|
94
|
+
if (cache) {
|
|
95
|
+
cache.set(obj, newObj);
|
|
96
|
+
}
|
|
97
|
+
return newObj;
|
|
98
|
+
}
|
|
99
|
+
function _iterable_to_array_limit(arr, i) {
|
|
100
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
101
|
+
if (_i == null) return;
|
|
102
|
+
var _arr = [];
|
|
103
|
+
var _n = true;
|
|
104
|
+
var _d = false;
|
|
105
|
+
var _s, _e;
|
|
106
|
+
try {
|
|
107
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
108
|
+
_arr.push(_s.value);
|
|
109
|
+
if (i && _arr.length === i) break;
|
|
110
|
+
}
|
|
111
|
+
} catch (err) {
|
|
112
|
+
_d = true;
|
|
113
|
+
_e = err;
|
|
114
|
+
} finally{
|
|
115
|
+
try {
|
|
116
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
117
|
+
} finally{
|
|
118
|
+
if (_d) throw _e;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return _arr;
|
|
122
|
+
}
|
|
123
|
+
function _non_iterable_rest() {
|
|
124
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
125
|
+
}
|
|
126
|
+
function _sliced_to_array(arr, i) {
|
|
127
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
128
|
+
}
|
|
129
|
+
function _type_of(obj) {
|
|
130
|
+
"@swc/helpers - typeof";
|
|
131
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
132
|
+
}
|
|
133
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
134
|
+
if (!o) return;
|
|
135
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
136
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
137
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
138
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
139
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
140
|
+
}
|
|
141
|
+
function _ts_generator(thisArg, body) {
|
|
142
|
+
var f, y, t, _ = {
|
|
143
|
+
label: 0,
|
|
144
|
+
sent: function() {
|
|
145
|
+
if (t[0] & 1) throw t[1];
|
|
146
|
+
return t[1];
|
|
147
|
+
},
|
|
148
|
+
trys: [],
|
|
149
|
+
ops: []
|
|
150
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
151
|
+
return d(g, "next", {
|
|
152
|
+
value: verb(0)
|
|
153
|
+
}), d(g, "throw", {
|
|
154
|
+
value: verb(1)
|
|
155
|
+
}), d(g, "return", {
|
|
156
|
+
value: verb(2)
|
|
157
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
158
|
+
value: function() {
|
|
159
|
+
return this;
|
|
160
|
+
}
|
|
161
|
+
}), g;
|
|
162
|
+
function verb(n) {
|
|
163
|
+
return function(v) {
|
|
164
|
+
return step([
|
|
165
|
+
n,
|
|
166
|
+
v
|
|
167
|
+
]);
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function step(op) {
|
|
171
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
172
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
173
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
174
|
+
if (y = 0, t) op = [
|
|
175
|
+
op[0] & 2,
|
|
176
|
+
t.value
|
|
177
|
+
];
|
|
178
|
+
switch(op[0]){
|
|
179
|
+
case 0:
|
|
180
|
+
case 1:
|
|
181
|
+
t = op;
|
|
182
|
+
break;
|
|
183
|
+
case 4:
|
|
184
|
+
_.label++;
|
|
185
|
+
return {
|
|
186
|
+
value: op[1],
|
|
187
|
+
done: false
|
|
188
|
+
};
|
|
189
|
+
case 5:
|
|
190
|
+
_.label++;
|
|
191
|
+
y = op[1];
|
|
192
|
+
op = [
|
|
193
|
+
0
|
|
194
|
+
];
|
|
195
|
+
continue;
|
|
196
|
+
case 7:
|
|
197
|
+
op = _.ops.pop();
|
|
198
|
+
_.trys.pop();
|
|
199
|
+
continue;
|
|
200
|
+
default:
|
|
201
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
202
|
+
_ = 0;
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
206
|
+
_.label = op[1];
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
210
|
+
_.label = t[1];
|
|
211
|
+
t = op;
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
if (t && _.label < t[2]) {
|
|
215
|
+
_.label = t[2];
|
|
216
|
+
_.ops.push(op);
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
if (t[2]) _.ops.pop();
|
|
220
|
+
_.trys.pop();
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
op = body.call(thisArg, _);
|
|
224
|
+
} catch (e) {
|
|
225
|
+
op = [
|
|
226
|
+
6,
|
|
227
|
+
e
|
|
228
|
+
];
|
|
229
|
+
y = 0;
|
|
230
|
+
} finally{
|
|
231
|
+
f = t = 0;
|
|
232
|
+
}
|
|
233
|
+
if (op[0] & 5) throw op[1];
|
|
234
|
+
return {
|
|
235
|
+
value: op[0] ? op[1] : void 0,
|
|
236
|
+
done: true
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
var metadataReader = new _metadatareaderts.MetadataReader();
|
|
241
|
+
function validateCommand(filePath) {
|
|
242
|
+
return _async_to_generator(function() {
|
|
243
|
+
var config, hasErrors, hasWarnings, servers, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, serverName, serverConfig, validation, err;
|
|
244
|
+
return _ts_generator(this, function(_state) {
|
|
245
|
+
switch(_state.label){
|
|
246
|
+
case 0:
|
|
247
|
+
// 1. Check file exists
|
|
248
|
+
if (!_fs.existsSync(filePath)) {
|
|
249
|
+
throw Object.assign(new Error("File not found: ".concat(filePath)), {
|
|
250
|
+
code: 1
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
try {
|
|
254
|
+
config = JSON.parse(_fs.readFileSync(filePath, 'utf8'));
|
|
255
|
+
} catch (error) {
|
|
256
|
+
throw Object.assign(new Error("Invalid JSON: ".concat(_instanceof(error, Error) ? error.message : String(error))), {
|
|
257
|
+
code: 1
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
// 3. Schema validation - check basic structure
|
|
261
|
+
if (!config.mcpServers || _type_of(config.mcpServers) !== 'object') {
|
|
262
|
+
throw Object.assign(new Error('Config must have "mcpServers" object'), {
|
|
263
|
+
code: 1
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
console.log("✅ ".concat(filePath, " has valid JSON structure\n"));
|
|
267
|
+
console.log('Server Configuration Validation:\n');
|
|
268
|
+
// 4. Validate each server
|
|
269
|
+
hasErrors = false;
|
|
270
|
+
hasWarnings = false;
|
|
271
|
+
servers = Object.entries(config.mcpServers);
|
|
272
|
+
if (servers.length === 0) {
|
|
273
|
+
console.log(' ⚠️ No servers configured');
|
|
274
|
+
return [
|
|
275
|
+
2
|
|
276
|
+
];
|
|
277
|
+
}
|
|
278
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
279
|
+
_state.label = 1;
|
|
280
|
+
case 1:
|
|
281
|
+
_state.trys.push([
|
|
282
|
+
1,
|
|
283
|
+
6,
|
|
284
|
+
7,
|
|
285
|
+
8
|
|
286
|
+
]);
|
|
287
|
+
_iterator = servers[Symbol.iterator]();
|
|
288
|
+
_state.label = 2;
|
|
289
|
+
case 2:
|
|
290
|
+
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
291
|
+
3,
|
|
292
|
+
5
|
|
293
|
+
];
|
|
294
|
+
_step_value = _sliced_to_array(_step.value, 2), serverName = _step_value[0], serverConfig = _step_value[1];
|
|
295
|
+
return [
|
|
296
|
+
4,
|
|
297
|
+
validateServerConfig(serverName, serverConfig)
|
|
298
|
+
];
|
|
299
|
+
case 3:
|
|
300
|
+
validation = _state.sent();
|
|
301
|
+
if (validation.valid) {
|
|
302
|
+
console.log(" ✅ ".concat(serverName, ": Valid configuration"));
|
|
303
|
+
} else if (validation.severity === 'error') {
|
|
304
|
+
console.log(" ❌ ".concat(serverName, ": ").concat(validation.message));
|
|
305
|
+
hasErrors = true;
|
|
306
|
+
} else {
|
|
307
|
+
console.log(" ⚠️ ".concat(serverName, ": ").concat(validation.message));
|
|
308
|
+
hasWarnings = true;
|
|
309
|
+
}
|
|
310
|
+
_state.label = 4;
|
|
311
|
+
case 4:
|
|
312
|
+
_iteratorNormalCompletion = true;
|
|
313
|
+
return [
|
|
314
|
+
3,
|
|
315
|
+
2
|
|
316
|
+
];
|
|
317
|
+
case 5:
|
|
318
|
+
return [
|
|
319
|
+
3,
|
|
320
|
+
8
|
|
321
|
+
];
|
|
322
|
+
case 6:
|
|
323
|
+
err = _state.sent();
|
|
324
|
+
_didIteratorError = true;
|
|
325
|
+
_iteratorError = err;
|
|
326
|
+
return [
|
|
327
|
+
3,
|
|
328
|
+
8
|
|
329
|
+
];
|
|
330
|
+
case 7:
|
|
331
|
+
try {
|
|
332
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
333
|
+
_iterator.return();
|
|
334
|
+
}
|
|
335
|
+
} finally{
|
|
336
|
+
if (_didIteratorError) {
|
|
337
|
+
throw _iteratorError;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return [
|
|
341
|
+
7
|
|
342
|
+
];
|
|
343
|
+
case 8:
|
|
344
|
+
console.log('');
|
|
345
|
+
if (hasErrors) {
|
|
346
|
+
throw Object.assign(new Error('Validation failed with errors'), {
|
|
347
|
+
code: 1
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
if (hasWarnings) {
|
|
351
|
+
console.log('⚠️ Validation passed with warnings');
|
|
352
|
+
} else {
|
|
353
|
+
console.log('✅ All validations passed');
|
|
354
|
+
}
|
|
355
|
+
return [
|
|
356
|
+
2
|
|
357
|
+
];
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
})();
|
|
361
|
+
}
|
|
362
|
+
function validateServerConfig(serverName, serverConfig) {
|
|
363
|
+
return _async_to_generator(function() {
|
|
364
|
+
var _serverConfig_start, _serverConfig_start1, metadata, error, transport, pkg, envToCheck, missingEnvVars, varNames, argsToCheck, validArgNames, unknownArgs;
|
|
365
|
+
return _ts_generator(this, function(_state) {
|
|
366
|
+
switch(_state.label){
|
|
367
|
+
case 0:
|
|
368
|
+
// Check basic structure based on server type
|
|
369
|
+
if ((0, _typests.isHttpServer)(serverConfig)) {
|
|
370
|
+
// HTTP server validation
|
|
371
|
+
if (!serverConfig.url) {
|
|
372
|
+
return [
|
|
373
|
+
2,
|
|
374
|
+
{
|
|
375
|
+
valid: false,
|
|
376
|
+
severity: 'error',
|
|
377
|
+
message: 'HTTP server missing required "url" field'
|
|
378
|
+
}
|
|
379
|
+
];
|
|
380
|
+
}
|
|
381
|
+
// If has start block, validate it
|
|
382
|
+
if (serverConfig.start) {
|
|
383
|
+
if (!serverConfig.start.command) {
|
|
384
|
+
return [
|
|
385
|
+
2,
|
|
386
|
+
{
|
|
387
|
+
valid: false,
|
|
388
|
+
severity: 'error',
|
|
389
|
+
message: 'HTTP server "start" block missing required "command" field'
|
|
390
|
+
}
|
|
391
|
+
];
|
|
392
|
+
}
|
|
393
|
+
if (serverConfig.start.args !== undefined && !Array.isArray(serverConfig.start.args)) {
|
|
394
|
+
return [
|
|
395
|
+
2,
|
|
396
|
+
{
|
|
397
|
+
valid: false,
|
|
398
|
+
severity: 'error',
|
|
399
|
+
message: 'HTTP server "start.args" field must be an array'
|
|
400
|
+
}
|
|
401
|
+
];
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
} else {
|
|
405
|
+
// Stdio server validation
|
|
406
|
+
if (!serverConfig.command) {
|
|
407
|
+
return [
|
|
408
|
+
2,
|
|
409
|
+
{
|
|
410
|
+
valid: false,
|
|
411
|
+
severity: 'error',
|
|
412
|
+
message: 'Stdio server missing required "command" field'
|
|
413
|
+
}
|
|
414
|
+
];
|
|
415
|
+
}
|
|
416
|
+
if (serverConfig.args !== undefined && !Array.isArray(serverConfig.args)) {
|
|
417
|
+
return [
|
|
418
|
+
2,
|
|
419
|
+
{
|
|
420
|
+
valid: false,
|
|
421
|
+
severity: 'error',
|
|
422
|
+
message: 'Stdio server "args" field must be an array'
|
|
423
|
+
}
|
|
424
|
+
];
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
_state.label = 1;
|
|
428
|
+
case 1:
|
|
429
|
+
_state.trys.push([
|
|
430
|
+
1,
|
|
431
|
+
3,
|
|
432
|
+
,
|
|
433
|
+
4
|
|
434
|
+
]);
|
|
435
|
+
return [
|
|
436
|
+
4,
|
|
437
|
+
metadataReader.readServerMetadata(serverName)
|
|
438
|
+
];
|
|
439
|
+
case 2:
|
|
440
|
+
metadata = _state.sent();
|
|
441
|
+
return [
|
|
442
|
+
3,
|
|
443
|
+
4
|
|
444
|
+
];
|
|
445
|
+
case 3:
|
|
446
|
+
error = _state.sent();
|
|
447
|
+
return [
|
|
448
|
+
2,
|
|
449
|
+
{
|
|
450
|
+
valid: false,
|
|
451
|
+
severity: 'warning',
|
|
452
|
+
message: "Cannot verify: server package not found (".concat(_instanceof(error, Error) ? error.message : String(error), ")")
|
|
453
|
+
}
|
|
454
|
+
];
|
|
455
|
+
case 4:
|
|
456
|
+
// Detect transport using type guard
|
|
457
|
+
transport = (0, _typests.isHttpServer)(serverConfig) ? 'streamable-http' : 'stdio';
|
|
458
|
+
// Get package config from server.json
|
|
459
|
+
pkg = metadataReader.getPackageForTransport(metadata, transport);
|
|
460
|
+
if (!pkg) {
|
|
461
|
+
return [
|
|
462
|
+
2,
|
|
463
|
+
{
|
|
464
|
+
valid: false,
|
|
465
|
+
severity: 'error',
|
|
466
|
+
message: "No ".concat(transport, " transport configuration found in server.json")
|
|
467
|
+
}
|
|
468
|
+
];
|
|
469
|
+
}
|
|
470
|
+
// Determine which env to check based on server type
|
|
471
|
+
envToCheck = (0, _typests.isStdioServer)(serverConfig) ? serverConfig.env : (_serverConfig_start = serverConfig.start) === null || _serverConfig_start === void 0 ? void 0 : _serverConfig_start.env;
|
|
472
|
+
// Check for missing required env vars (based on server.json)
|
|
473
|
+
missingEnvVars = pkg.environmentVariables.filter(function(v) {
|
|
474
|
+
if (!v.isRequired) return false; // Skip optional vars
|
|
475
|
+
var envValue = envToCheck === null || envToCheck === void 0 ? void 0 : envToCheck[v.name];
|
|
476
|
+
// Consider it missing if it's not set or is a placeholder like ${VAR_NAME}
|
|
477
|
+
return !envValue || envValue.match(/^\$\{.*\}$/);
|
|
478
|
+
});
|
|
479
|
+
if (missingEnvVars.length > 0) {
|
|
480
|
+
varNames = missingEnvVars.map(function(v) {
|
|
481
|
+
return v.name;
|
|
482
|
+
}).join(', ');
|
|
483
|
+
return [
|
|
484
|
+
2,
|
|
485
|
+
{
|
|
486
|
+
valid: false,
|
|
487
|
+
severity: 'warning',
|
|
488
|
+
message: "Missing or placeholder required env vars: ".concat(varNames)
|
|
489
|
+
}
|
|
490
|
+
];
|
|
491
|
+
}
|
|
492
|
+
// Get args to validate based on server type
|
|
493
|
+
argsToCheck = (0, _typests.isStdioServer)(serverConfig) ? serverConfig.args || [] : ((_serverConfig_start1 = serverConfig.start) === null || _serverConfig_start1 === void 0 ? void 0 : _serverConfig_start1.args) || [];
|
|
494
|
+
// Get valid args from server.json
|
|
495
|
+
validArgNames = new Set(pkg.packageArguments.map(function(a) {
|
|
496
|
+
return a.name;
|
|
497
|
+
}));
|
|
498
|
+
// Check for unknown/outdated args
|
|
499
|
+
unknownArgs = argsToCheck.filter(function(arg) {
|
|
500
|
+
if (!arg.startsWith('--')) return false; // Not a flag
|
|
501
|
+
var argName = arg.split('=')[0]; // Get just the flag name
|
|
502
|
+
if (!argName) return false; // Skip if somehow empty
|
|
503
|
+
return !validArgNames.has(argName);
|
|
504
|
+
});
|
|
505
|
+
if (unknownArgs.length > 0) {
|
|
506
|
+
return [
|
|
507
|
+
2,
|
|
508
|
+
{
|
|
509
|
+
valid: false,
|
|
510
|
+
severity: 'warning',
|
|
511
|
+
message: "Unknown arguments: ".concat(unknownArgs.join(', '), ". May be outdated - consider regenerating config.")
|
|
512
|
+
}
|
|
513
|
+
];
|
|
514
|
+
}
|
|
515
|
+
return [
|
|
516
|
+
2,
|
|
517
|
+
{
|
|
518
|
+
valid: true
|
|
519
|
+
}
|
|
520
|
+
];
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
})();
|
|
524
|
+
}
|
|
525
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/Projects/ai/mcp-z/cli/src/commands/manifest/validate.ts"],"sourcesContent":["import * as fs from 'fs';\nimport type { MCPConfiguration, ServerConfig } from '../../types.ts';\nimport { isHttpServer, isStdioServer } from '../../types.ts';\nimport { MetadataReader, type ServerMetadata } from './metadata-reader.ts';\n\ninterface ValidationResult {\n valid: boolean;\n severity?: 'error' | 'warning';\n message?: string;\n}\n\nconst metadataReader = new MetadataReader();\n\nexport async function validateCommand(filePath: string): Promise<void> {\n // 1. Check file exists\n if (!fs.existsSync(filePath)) {\n throw Object.assign(new Error(`File not found: ${filePath}`), { code: 1 });\n }\n\n // 2. JSON syntax validation\n let config: MCPConfiguration;\n try {\n config = JSON.parse(fs.readFileSync(filePath, 'utf8')) as MCPConfiguration;\n } catch (error) {\n throw Object.assign(new Error(`Invalid JSON: ${error instanceof Error ? error.message : String(error)}`), {\n code: 1,\n });\n }\n\n // 3. Schema validation - check basic structure\n if (!config.mcpServers || typeof config.mcpServers !== 'object') {\n throw Object.assign(new Error('Config must have \"mcpServers\" object'), { code: 1 });\n }\n\n console.log(`✅ ${filePath} has valid JSON structure\\n`);\n console.log('Server Configuration Validation:\\n');\n\n // 4. Validate each server\n let hasErrors = false;\n let hasWarnings = false;\n\n const servers = Object.entries(config.mcpServers);\n\n if (servers.length === 0) {\n console.log(' ⚠️ No servers configured');\n return;\n }\n\n for (const [serverName, serverConfig] of servers) {\n const validation = await validateServerConfig(serverName, serverConfig);\n\n if (validation.valid) {\n console.log(` ✅ ${serverName}: Valid configuration`);\n } else if (validation.severity === 'error') {\n console.log(` ❌ ${serverName}: ${validation.message}`);\n hasErrors = true;\n } else {\n console.log(` ⚠️ ${serverName}: ${validation.message}`);\n hasWarnings = true;\n }\n }\n\n console.log('');\n\n if (hasErrors) {\n throw Object.assign(new Error('Validation failed with errors'), { code: 1 });\n }\n\n if (hasWarnings) {\n console.log('⚠️ Validation passed with warnings');\n } else {\n console.log('✅ All validations passed');\n }\n}\n\nasync function validateServerConfig(serverName: string, serverConfig: ServerConfig): Promise<ValidationResult> {\n // Check basic structure based on server type\n if (isHttpServer(serverConfig)) {\n // HTTP server validation\n if (!serverConfig.url) {\n return {\n valid: false,\n severity: 'error',\n message: 'HTTP server missing required \"url\" field',\n };\n }\n // If has start block, validate it\n if (serverConfig.start) {\n if (!serverConfig.start.command) {\n return {\n valid: false,\n severity: 'error',\n message: 'HTTP server \"start\" block missing required \"command\" field',\n };\n }\n if (serverConfig.start.args !== undefined && !Array.isArray(serverConfig.start.args)) {\n return {\n valid: false,\n severity: 'error',\n message: 'HTTP server \"start.args\" field must be an array',\n };\n }\n }\n } else {\n // Stdio server validation\n if (!serverConfig.command) {\n return {\n valid: false,\n severity: 'error',\n message: 'Stdio server missing required \"command\" field',\n };\n }\n if (serverConfig.args !== undefined && !Array.isArray(serverConfig.args)) {\n return {\n valid: false,\n severity: 'error',\n message: 'Stdio server \"args\" field must be an array',\n };\n }\n }\n\n // Try to load server metadata\n let metadata: ServerMetadata;\n try {\n metadata = await metadataReader.readServerMetadata(serverName);\n } catch (error) {\n return {\n valid: false,\n severity: 'warning',\n message: `Cannot verify: server package not found (${error instanceof Error ? error.message : String(error)})`,\n };\n }\n\n // Detect transport using type guard\n const transport = isHttpServer(serverConfig) ? 'streamable-http' : 'stdio';\n\n // Get package config from server.json\n const pkg = metadataReader.getPackageForTransport(metadata, transport as 'stdio' | 'streamable-http');\n if (!pkg) {\n return {\n valid: false,\n severity: 'error',\n message: `No ${transport} transport configuration found in server.json`,\n };\n }\n\n // Determine which env to check based on server type\n const envToCheck = isStdioServer(serverConfig) ? serverConfig.env : serverConfig.start?.env;\n\n // Check for missing required env vars (based on server.json)\n const missingEnvVars = pkg.environmentVariables.filter((v) => {\n if (!v.isRequired) return false; // Skip optional vars\n const envValue = envToCheck?.[v.name];\n // Consider it missing if it's not set or is a placeholder like ${VAR_NAME}\n return !envValue || envValue.match(/^\\$\\{.*\\}$/);\n });\n\n if (missingEnvVars.length > 0) {\n const varNames = missingEnvVars.map((v) => v.name).join(', ');\n return {\n valid: false,\n severity: 'warning',\n message: `Missing or placeholder required env vars: ${varNames}`,\n };\n }\n\n // Get args to validate based on server type\n const argsToCheck = isStdioServer(serverConfig) ? serverConfig.args || [] : serverConfig.start?.args || [];\n\n // Get valid args from server.json\n const validArgNames = new Set(pkg.packageArguments.map((a) => a.name));\n\n // Check for unknown/outdated args\n const unknownArgs = argsToCheck.filter((arg: string) => {\n if (!arg.startsWith('--')) return false; // Not a flag\n const argName = arg.split('=')[0]; // Get just the flag name\n if (!argName) return false; // Skip if somehow empty\n return !validArgNames.has(argName);\n });\n\n if (unknownArgs.length > 0) {\n return {\n valid: false,\n severity: 'warning',\n message: `Unknown arguments: ${unknownArgs.join(', ')}. May be outdated - consider regenerating config.`,\n };\n }\n\n return { valid: true };\n}\n"],"names":["validateCommand","metadataReader","MetadataReader","filePath","config","hasErrors","hasWarnings","servers","serverName","serverConfig","validation","fs","existsSync","Object","assign","Error","code","JSON","parse","readFileSync","error","message","String","mcpServers","console","log","entries","length","validateServerConfig","valid","severity","metadata","transport","pkg","envToCheck","missingEnvVars","varNames","argsToCheck","validArgNames","unknownArgs","isHttpServer","url","start","command","args","undefined","Array","isArray","readServerMetadata","getPackageForTransport","isStdioServer","env","environmentVariables","filter","v","isRequired","envValue","name","match","map","join","Set","packageArguments","a","arg","startsWith","argName","split","has"],"mappings":";;;;+BAasBA;;;eAAAA;;;0DAbF;uBAEwB;gCACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AI,CAAC;wBACrC,2EAA2E;wBAC3E,OAAO,CAACD,YAAYA,SAASE,KAAK,CAAC;oBACrC;oBAEA,IAAIvB,eAAeR,MAAM,GAAG,GAAG;wBACvBS,WAAWD,eAAewB,GAAG,CAAC,SAACL;mCAAMA,EAAEG,IAAI;2BAAEG,IAAI,CAAC;wBACxD;;4BAAO;gCACL/B,OAAO;gCACPC,UAAU;gCACVT,SAAS,AAAC,6CAAqD,OAATe;4BACxD;;oBACF;oBAEA,4CAA4C;oBACtCC,cAAca,IAAAA,sBAAa,EAACzC,gBAAgBA,aAAamC,IAAI,SAASnC,EAAAA,uBAAAA,aAAaiC,KAAK,cAAlBjC,2CAAAA,qBAAoBmC,IAAI;oBAEpG,kCAAkC;oBAC5BN,gBAAgB,IAAIuB,IAAI5B,IAAI6B,gBAAgB,CAACH,GAAG,CAAC,SAACI;+BAAMA,EAAEN,IAAI;;oBAEpE,kCAAkC;oBAC5BlB,cAAcF,YAAYgB,MAAM,CAAC,SAACW;wBACtC,IAAI,CAACA,IAAIC,UAAU,CAAC,OAAO,OAAO,OAAO,aAAa;wBACtD,IAAMC,UAAUF,IAAIG,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,yBAAyB;wBAC5D,IAAI,CAACD,SAAS,OAAO,OAAO,wBAAwB;wBACpD,OAAO,CAAC5B,cAAc8B,GAAG,CAACF;oBAC5B;oBAEA,IAAI3B,YAAYZ,MAAM,GAAG,GAAG;wBAC1B;;4BAAO;gCACLE,OAAO;gCACPC,UAAU;gCACVT,SAAS,AAAC,sBAA4C,OAAvBkB,YAAYqB,IAAI,CAAC,OAAM;4BACxD;;oBACF;oBAEA;;wBAAO;4BAAE/B,OAAO;wBAAK;;;;IACvB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* read-resource.ts
|
|
3
|
+
*
|
|
4
|
+
* Read MCP resources from the command line.
|
|
5
|
+
* Supports stdio (spawned) and http (remote) servers per MCP spec.
|
|
6
|
+
*/
|
|
7
|
+
import { type InlineConfigOptions } from '../lib/resolve-server-config.js';
|
|
8
|
+
export interface ReadResourceOptions extends InlineConfigOptions {
|
|
9
|
+
uri: string;
|
|
10
|
+
json?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Main read-resource command implementation.
|
|
14
|
+
*
|
|
15
|
+
* @param opts - Read resource options from CLI flags
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Read a resource by URI
|
|
19
|
+
* await readResourceCommand({
|
|
20
|
+
* server: 'gmail',
|
|
21
|
+
* uri: 'gmail://messages/abc123',
|
|
22
|
+
* });
|
|
23
|
+
*/
|
|
24
|
+
export declare function readResourceCommand(opts: ReadResourceOptions): Promise<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* read-resource.ts
|
|
3
|
+
*
|
|
4
|
+
* Read MCP resources from the command line.
|
|
5
|
+
* Supports stdio (spawned) and http (remote) servers per MCP spec.
|
|
6
|
+
*/
|
|
7
|
+
import { type InlineConfigOptions } from '../lib/resolve-server-config.js';
|
|
8
|
+
export interface ReadResourceOptions extends InlineConfigOptions {
|
|
9
|
+
uri: string;
|
|
10
|
+
json?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Main read-resource command implementation.
|
|
14
|
+
*
|
|
15
|
+
* @param opts - Read resource options from CLI flags
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Read a resource by URI
|
|
19
|
+
* await readResourceCommand({
|
|
20
|
+
* server: 'gmail',
|
|
21
|
+
* uri: 'gmail://messages/abc123',
|
|
22
|
+
* });
|
|
23
|
+
*/
|
|
24
|
+
export declare function readResourceCommand(opts: ReadResourceOptions): Promise<void>;
|