@j0hanz/filesystem-mcp 1.2.2 → 1.2.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.
- package/README.md +11 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +15 -5
- package/dist/completions.js +15 -6
- package/dist/index.js +26 -8
- package/dist/lib/file-operations/glob-engine.js +3 -9
- package/dist/lib/file-operations/read-multiple-files.js +4 -23
- package/dist/lib/file-operations/search-content.js +11 -18
- package/dist/lib/observability.js +4 -4
- package/dist/lib/path-validation.js +22 -9
- package/dist/pkg-info.d.ts +6 -0
- package/dist/pkg-info.js +9 -0
- package/dist/schemas.d.ts +28 -28
- package/dist/schemas.js +26 -26
- package/dist/server/bootstrap.d.ts +6 -0
- package/dist/server/bootstrap.js +300 -0
- package/dist/server/capabilities.d.ts +10 -0
- package/dist/server/capabilities.js +40 -0
- package/dist/server/logging.d.ts +7 -0
- package/dist/server/logging.js +41 -0
- package/dist/server/roots-manager.d.ts +19 -0
- package/dist/server/roots-manager.js +173 -0
- package/dist/server/types.d.ts +4 -0
- package/dist/server/types.js +1 -0
- package/dist/server.d.ts +2 -8
- package/dist/server.js +1 -317
- package/dist/tools/apply-patch.js +3 -2
- package/dist/tools/calculate-hash.js +3 -2
- package/dist/tools/create-directory.js +3 -2
- package/dist/tools/delete-file.js +9 -2
- package/dist/tools/diff-files.js +3 -2
- package/dist/tools/edit-file.js +5 -4
- package/dist/tools/list-directory.js +13 -2
- package/dist/tools/move-file.js +11 -3
- package/dist/tools/read-multiple.js +6 -5
- package/dist/tools/read.js +3 -2
- package/dist/tools/replace-in-files.js +3 -2
- package/dist/tools/roots.js +12 -2
- package/dist/tools/search-content.js +10 -15
- package/dist/tools/search-files.js +13 -9
- package/dist/tools/shared.d.ts +3 -1
- package/dist/tools/shared.js +19 -1
- package/dist/tools/stat-many.js +6 -5
- package/dist/tools/stat.js +4 -3
- package/dist/tools/task-support.js +57 -10
- package/dist/tools/tree.js +15 -2
- package/dist/tools/write-file.js +3 -2
- package/package.json +1 -1
package/dist/schemas.d.ts
CHANGED
|
@@ -124,7 +124,7 @@ export declare const ListAllowedDirectoriesOutputSchema: z.ZodObject<{
|
|
|
124
124
|
path: z.ZodOptional<z.ZodString>;
|
|
125
125
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
126
126
|
}, z.core.$strict>>;
|
|
127
|
-
}, z.core.$
|
|
127
|
+
}, z.core.$strict>;
|
|
128
128
|
export declare const ListDirectoryOutputSchema: z.ZodObject<{
|
|
129
129
|
ok: z.ZodBoolean;
|
|
130
130
|
path: z.ZodOptional<z.ZodString>;
|
|
@@ -139,7 +139,7 @@ export declare const ListDirectoryOutputSchema: z.ZodObject<{
|
|
|
139
139
|
}>;
|
|
140
140
|
size: z.ZodOptional<z.ZodNumber>;
|
|
141
141
|
modified: z.ZodOptional<z.ZodString>;
|
|
142
|
-
}, z.core.$
|
|
142
|
+
}, z.core.$strict>>>;
|
|
143
143
|
totalEntries: z.ZodOptional<z.ZodNumber>;
|
|
144
144
|
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
145
145
|
entriesScanned: z.ZodOptional<z.ZodNumber>;
|
|
@@ -172,7 +172,7 @@ export declare const ListDirectoryOutputSchema: z.ZodObject<{
|
|
|
172
172
|
path: z.ZodOptional<z.ZodString>;
|
|
173
173
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
174
174
|
}, z.core.$strict>>;
|
|
175
|
-
}, z.core.$
|
|
175
|
+
}, z.core.$strict>;
|
|
176
176
|
export declare const SearchFilesOutputSchema: z.ZodObject<{
|
|
177
177
|
totalMatches: z.ZodOptional<z.ZodNumber>;
|
|
178
178
|
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -203,7 +203,7 @@ export declare const SearchFilesOutputSchema: z.ZodObject<{
|
|
|
203
203
|
path: z.ZodString;
|
|
204
204
|
size: z.ZodOptional<z.ZodNumber>;
|
|
205
205
|
modified: z.ZodOptional<z.ZodString>;
|
|
206
|
-
}, z.core.$
|
|
206
|
+
}, z.core.$strict>>>;
|
|
207
207
|
filesScanned: z.ZodOptional<z.ZodNumber>;
|
|
208
208
|
skippedInaccessible: z.ZodOptional<z.ZodNumber>;
|
|
209
209
|
stoppedReason: z.ZodOptional<z.ZodEnum<{
|
|
@@ -211,7 +211,7 @@ export declare const SearchFilesOutputSchema: z.ZodObject<{
|
|
|
211
211
|
maxFiles: "maxFiles";
|
|
212
212
|
timeout: "timeout";
|
|
213
213
|
}>>;
|
|
214
|
-
}, z.core.$
|
|
214
|
+
}, z.core.$strict>;
|
|
215
215
|
export declare const SearchContentOutputSchema: z.ZodObject<{
|
|
216
216
|
totalMatches: z.ZodOptional<z.ZodNumber>;
|
|
217
217
|
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -248,7 +248,7 @@ export declare const SearchContentOutputSchema: z.ZodObject<{
|
|
|
248
248
|
matchCount: z.ZodNumber;
|
|
249
249
|
contextBefore: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
250
250
|
contextAfter: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
251
|
-
}, z.core.$
|
|
251
|
+
}, z.core.$strict>>>;
|
|
252
252
|
filesScanned: z.ZodOptional<z.ZodNumber>;
|
|
253
253
|
filesMatched: z.ZodOptional<z.ZodNumber>;
|
|
254
254
|
skippedTooLarge: z.ZodOptional<z.ZodNumber>;
|
|
@@ -260,7 +260,7 @@ export declare const SearchContentOutputSchema: z.ZodObject<{
|
|
|
260
260
|
maxFiles: "maxFiles";
|
|
261
261
|
timeout: "timeout";
|
|
262
262
|
}>>;
|
|
263
|
-
}, z.core.$
|
|
263
|
+
}, z.core.$strict>;
|
|
264
264
|
export declare const TreeOutputSchema: z.ZodObject<{
|
|
265
265
|
ok: z.ZodBoolean;
|
|
266
266
|
root: z.ZodOptional<z.ZodString>;
|
|
@@ -287,7 +287,7 @@ export declare const TreeOutputSchema: z.ZodObject<{
|
|
|
287
287
|
path: z.ZodOptional<z.ZodString>;
|
|
288
288
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
289
289
|
}, z.core.$strict>>;
|
|
290
|
-
}, z.core.$
|
|
290
|
+
}, z.core.$strict>;
|
|
291
291
|
export declare const ReadFileOutputSchema: z.ZodObject<{
|
|
292
292
|
content: z.ZodOptional<z.ZodString>;
|
|
293
293
|
truncated: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -324,7 +324,7 @@ export declare const ReadFileOutputSchema: z.ZodObject<{
|
|
|
324
324
|
path: z.ZodOptional<z.ZodString>;
|
|
325
325
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
326
326
|
}, z.core.$strict>>;
|
|
327
|
-
}, z.core.$
|
|
327
|
+
}, z.core.$strict>;
|
|
328
328
|
export declare const ReadMultipleFilesOutputSchema: z.ZodObject<{
|
|
329
329
|
ok: z.ZodBoolean;
|
|
330
330
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -350,12 +350,12 @@ export declare const ReadMultipleFilesOutputSchema: z.ZodObject<{
|
|
|
350
350
|
}>>;
|
|
351
351
|
maxTotalSize: z.ZodOptional<z.ZodNumber>;
|
|
352
352
|
error: z.ZodOptional<z.ZodString>;
|
|
353
|
-
}, z.core.$
|
|
353
|
+
}, z.core.$strict>>>;
|
|
354
354
|
summary: z.ZodOptional<z.ZodObject<{
|
|
355
355
|
total: z.ZodNumber;
|
|
356
356
|
succeeded: z.ZodNumber;
|
|
357
357
|
failed: z.ZodNumber;
|
|
358
|
-
}, z.core.$
|
|
358
|
+
}, z.core.$strict>>;
|
|
359
359
|
error: z.ZodOptional<z.ZodObject<{
|
|
360
360
|
code: z.ZodEnum<{
|
|
361
361
|
readonly E_ACCESS_DENIED: "E_ACCESS_DENIED";
|
|
@@ -375,7 +375,7 @@ export declare const ReadMultipleFilesOutputSchema: z.ZodObject<{
|
|
|
375
375
|
path: z.ZodOptional<z.ZodString>;
|
|
376
376
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
377
377
|
}, z.core.$strict>>;
|
|
378
|
-
}, z.core.$
|
|
378
|
+
}, z.core.$strict>;
|
|
379
379
|
export declare const GetFileInfoOutputSchema: z.ZodObject<{
|
|
380
380
|
ok: z.ZodBoolean;
|
|
381
381
|
info: z.ZodOptional<z.ZodObject<{
|
|
@@ -416,7 +416,7 @@ export declare const GetFileInfoOutputSchema: z.ZodObject<{
|
|
|
416
416
|
path: z.ZodOptional<z.ZodString>;
|
|
417
417
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
418
418
|
}, z.core.$strict>>;
|
|
419
|
-
}, z.core.$
|
|
419
|
+
}, z.core.$strict>;
|
|
420
420
|
export declare const GetMultipleFileInfoOutputSchema: z.ZodObject<{
|
|
421
421
|
ok: z.ZodBoolean;
|
|
422
422
|
results: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -441,12 +441,12 @@ export declare const GetMultipleFileInfoOutputSchema: z.ZodObject<{
|
|
|
441
441
|
symlinkTarget: z.ZodOptional<z.ZodString>;
|
|
442
442
|
}, z.core.$strict>>;
|
|
443
443
|
error: z.ZodOptional<z.ZodString>;
|
|
444
|
-
}, z.core.$
|
|
444
|
+
}, z.core.$strict>>>;
|
|
445
445
|
summary: z.ZodOptional<z.ZodObject<{
|
|
446
446
|
total: z.ZodNumber;
|
|
447
447
|
succeeded: z.ZodNumber;
|
|
448
448
|
failed: z.ZodNumber;
|
|
449
|
-
}, z.core.$
|
|
449
|
+
}, z.core.$strict>>;
|
|
450
450
|
error: z.ZodOptional<z.ZodObject<{
|
|
451
451
|
code: z.ZodEnum<{
|
|
452
452
|
readonly E_ACCESS_DENIED: "E_ACCESS_DENIED";
|
|
@@ -466,7 +466,7 @@ export declare const GetMultipleFileInfoOutputSchema: z.ZodObject<{
|
|
|
466
466
|
path: z.ZodOptional<z.ZodString>;
|
|
467
467
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
468
468
|
}, z.core.$strict>>;
|
|
469
|
-
}, z.core.$
|
|
469
|
+
}, z.core.$strict>;
|
|
470
470
|
export declare const CreateDirectoryInputSchema: z.ZodObject<{
|
|
471
471
|
path: z.ZodString;
|
|
472
472
|
}, z.core.$strict>;
|
|
@@ -492,7 +492,7 @@ export declare const CreateDirectoryOutputSchema: z.ZodObject<{
|
|
|
492
492
|
path: z.ZodOptional<z.ZodString>;
|
|
493
493
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
494
494
|
}, z.core.$strict>>;
|
|
495
|
-
}, z.core.$
|
|
495
|
+
}, z.core.$strict>;
|
|
496
496
|
export declare const WriteFileInputSchema: z.ZodObject<{
|
|
497
497
|
path: z.ZodString;
|
|
498
498
|
content: z.ZodString;
|
|
@@ -520,13 +520,13 @@ export declare const WriteFileOutputSchema: z.ZodObject<{
|
|
|
520
520
|
path: z.ZodOptional<z.ZodString>;
|
|
521
521
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
522
522
|
}, z.core.$strict>>;
|
|
523
|
-
}, z.core.$
|
|
523
|
+
}, z.core.$strict>;
|
|
524
524
|
export declare const EditFileInputSchema: z.ZodObject<{
|
|
525
525
|
path: z.ZodString;
|
|
526
526
|
edits: z.ZodArray<z.ZodObject<{
|
|
527
527
|
oldText: z.ZodString;
|
|
528
528
|
newText: z.ZodString;
|
|
529
|
-
}, z.core.$
|
|
529
|
+
}, z.core.$strict>>;
|
|
530
530
|
dryRun: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
531
531
|
}, z.core.$strict>;
|
|
532
532
|
export declare const EditFileOutputSchema: z.ZodObject<{
|
|
@@ -554,7 +554,7 @@ export declare const EditFileOutputSchema: z.ZodObject<{
|
|
|
554
554
|
path: z.ZodOptional<z.ZodString>;
|
|
555
555
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
556
556
|
}, z.core.$strict>>;
|
|
557
|
-
}, z.core.$
|
|
557
|
+
}, z.core.$strict>;
|
|
558
558
|
export declare const MoveFileInputSchema: z.ZodObject<{
|
|
559
559
|
source: z.ZodString;
|
|
560
560
|
destination: z.ZodString;
|
|
@@ -582,7 +582,7 @@ export declare const MoveFileOutputSchema: z.ZodObject<{
|
|
|
582
582
|
path: z.ZodOptional<z.ZodString>;
|
|
583
583
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
584
584
|
}, z.core.$strict>>;
|
|
585
|
-
}, z.core.$
|
|
585
|
+
}, z.core.$strict>;
|
|
586
586
|
export declare const DeleteFileInputSchema: z.ZodObject<{
|
|
587
587
|
path: z.ZodString;
|
|
588
588
|
recursive: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -610,7 +610,7 @@ export declare const DeleteFileOutputSchema: z.ZodObject<{
|
|
|
610
610
|
path: z.ZodOptional<z.ZodString>;
|
|
611
611
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
612
612
|
}, z.core.$strict>>;
|
|
613
|
-
}, z.core.$
|
|
613
|
+
}, z.core.$strict>;
|
|
614
614
|
export declare const CalculateHashInputSchema: z.ZodObject<{
|
|
615
615
|
path: z.ZodString;
|
|
616
616
|
}, z.core.$strict>;
|
|
@@ -639,7 +639,7 @@ export declare const CalculateHashOutputSchema: z.ZodObject<{
|
|
|
639
639
|
path: z.ZodOptional<z.ZodString>;
|
|
640
640
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
641
641
|
}, z.core.$strict>>;
|
|
642
|
-
}, z.core.$
|
|
642
|
+
}, z.core.$strict>;
|
|
643
643
|
export declare const DiffFilesInputSchema: z.ZodObject<{
|
|
644
644
|
original: z.ZodString;
|
|
645
645
|
modified: z.ZodString;
|
|
@@ -672,7 +672,7 @@ export declare const DiffFilesOutputSchema: z.ZodObject<{
|
|
|
672
672
|
path: z.ZodOptional<z.ZodString>;
|
|
673
673
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
674
674
|
}, z.core.$strict>>;
|
|
675
|
-
}, z.core.$
|
|
675
|
+
}, z.core.$strict>;
|
|
676
676
|
export declare const ApplyPatchInputSchema: z.ZodObject<{
|
|
677
677
|
path: z.ZodString;
|
|
678
678
|
patch: z.ZodString;
|
|
@@ -703,7 +703,7 @@ export declare const ApplyPatchOutputSchema: z.ZodObject<{
|
|
|
703
703
|
path: z.ZodOptional<z.ZodString>;
|
|
704
704
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
705
705
|
}, z.core.$strict>>;
|
|
706
|
-
}, z.core.$
|
|
706
|
+
}, z.core.$strict>;
|
|
707
707
|
export declare const SearchAndReplaceInputSchema: z.ZodObject<{
|
|
708
708
|
path: z.ZodOptional<z.ZodString>;
|
|
709
709
|
filePattern: z.ZodString;
|
|
@@ -721,11 +721,11 @@ export declare const SearchAndReplaceOutputSchema: z.ZodObject<{
|
|
|
721
721
|
failures: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
722
722
|
path: z.ZodString;
|
|
723
723
|
error: z.ZodString;
|
|
724
|
-
}, z.core.$
|
|
724
|
+
}, z.core.$strict>>>;
|
|
725
725
|
changedFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
726
726
|
path: z.ZodString;
|
|
727
727
|
matches: z.ZodNumber;
|
|
728
|
-
}, z.core.$
|
|
728
|
+
}, z.core.$strict>>>;
|
|
729
729
|
changedFilesTruncated: z.ZodOptional<z.ZodBoolean>;
|
|
730
730
|
dryRun: z.ZodOptional<z.ZodBoolean>;
|
|
731
731
|
error: z.ZodOptional<z.ZodObject<{
|
|
@@ -747,5 +747,5 @@ export declare const SearchAndReplaceOutputSchema: z.ZodObject<{
|
|
|
747
747
|
path: z.ZodOptional<z.ZodString>;
|
|
748
748
|
suggestion: z.ZodOptional<z.ZodString>;
|
|
749
749
|
}, z.core.$strict>>;
|
|
750
|
-
}, z.core.$
|
|
750
|
+
}, z.core.$strict>;
|
|
751
751
|
export {};
|
package/dist/schemas.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { ErrorCode } from './
|
|
2
|
+
import { ErrorCode } from './lib/errors.js';
|
|
3
3
|
function isSafeGlobPattern(value) {
|
|
4
4
|
if (value.length === 0)
|
|
5
5
|
return false;
|
|
@@ -90,7 +90,7 @@ const FileInfoSchema = z.strictObject({
|
|
|
90
90
|
mimeType: z.string().optional().describe('MIME type'),
|
|
91
91
|
symlinkTarget: z.string().optional().describe('Target (symlink)'),
|
|
92
92
|
});
|
|
93
|
-
const OperationSummarySchema = z.
|
|
93
|
+
const OperationSummarySchema = z.strictObject({
|
|
94
94
|
total: z.number().describe('Total'),
|
|
95
95
|
succeeded: z.number().describe('Succeeded'),
|
|
96
96
|
failed: z.number().describe('Failed'),
|
|
@@ -293,7 +293,7 @@ export const GetMultipleFileInfoInputSchema = z.strictObject({
|
|
|
293
293
|
.max(100, 'Max 100 files')
|
|
294
294
|
.describe('File/directory paths. e.g. ["src", "lib"]'),
|
|
295
295
|
});
|
|
296
|
-
export const ListAllowedDirectoriesOutputSchema = z.
|
|
296
|
+
export const ListAllowedDirectoriesOutputSchema = z.strictObject({
|
|
297
297
|
ok: z.boolean(),
|
|
298
298
|
directories: z.array(z.string()).optional().describe('Allowed directories'),
|
|
299
299
|
rootsCount: z.number().optional().describe('Number of roots'),
|
|
@@ -303,11 +303,11 @@ export const ListAllowedDirectoriesOutputSchema = z.object({
|
|
|
303
303
|
.describe('Multiple roots configured'),
|
|
304
304
|
error: ErrorSchema.optional(),
|
|
305
305
|
});
|
|
306
|
-
export const ListDirectoryOutputSchema = z.
|
|
306
|
+
export const ListDirectoryOutputSchema = z.strictObject({
|
|
307
307
|
ok: z.boolean(),
|
|
308
308
|
path: z.string().optional(),
|
|
309
309
|
entries: z
|
|
310
|
-
.array(z.
|
|
310
|
+
.array(z.strictObject({
|
|
311
311
|
name: z.string().describe('Entry name'),
|
|
312
312
|
relativePath: z.string().optional(),
|
|
313
313
|
type: FileTypeSchema,
|
|
@@ -327,7 +327,7 @@ export const ListDirectoryOutputSchema = z.object({
|
|
|
327
327
|
symlinksNotFollowed: z.number().optional(),
|
|
328
328
|
error: ErrorSchema.optional(),
|
|
329
329
|
});
|
|
330
|
-
const SearchSummarySchema = z.
|
|
330
|
+
const SearchSummarySchema = z.strictObject({
|
|
331
331
|
totalMatches: z.number().optional().describe('Total matches found'),
|
|
332
332
|
truncated: z.boolean().optional().describe('Results truncated?'),
|
|
333
333
|
resourceUri: z.string().optional().describe('Full results URI'),
|
|
@@ -338,7 +338,7 @@ export const SearchFilesOutputSchema = SearchSummarySchema.extend({
|
|
|
338
338
|
root: z.string().optional().describe('Search root'),
|
|
339
339
|
pattern: z.string().optional().describe('Glob pattern used'),
|
|
340
340
|
results: z
|
|
341
|
-
.array(z.
|
|
341
|
+
.array(z.strictObject({
|
|
342
342
|
path: z.string().describe('Relative path'),
|
|
343
343
|
size: z.number().optional(),
|
|
344
344
|
modified: z.string().optional(),
|
|
@@ -356,7 +356,7 @@ export const SearchContentOutputSchema = SearchSummarySchema.extend({
|
|
|
356
356
|
.describe('Pattern interpretation'),
|
|
357
357
|
caseSensitive: z.boolean().optional().describe('Case-sensitive matching'),
|
|
358
358
|
matches: z
|
|
359
|
-
.array(z.
|
|
359
|
+
.array(z.strictObject({
|
|
360
360
|
file: z.string().describe('Relative path'),
|
|
361
361
|
line: z.number(),
|
|
362
362
|
content: z.string(),
|
|
@@ -379,7 +379,7 @@ export const SearchContentOutputSchema = SearchSummarySchema.extend({
|
|
|
379
379
|
.describe('Lines skipped due to regex timeout'),
|
|
380
380
|
stoppedReason: SearchStopReasonSchema.optional().describe('Why search stopped'),
|
|
381
381
|
});
|
|
382
|
-
export const TreeOutputSchema = z.
|
|
382
|
+
export const TreeOutputSchema = z.strictObject({
|
|
383
383
|
ok: z.boolean(),
|
|
384
384
|
root: z.string().optional(),
|
|
385
385
|
tree: TreeEntrySchema.optional(),
|
|
@@ -388,7 +388,7 @@ export const TreeOutputSchema = z.object({
|
|
|
388
388
|
totalEntries: z.number().optional(),
|
|
389
389
|
error: ErrorSchema.optional(),
|
|
390
390
|
});
|
|
391
|
-
const ReadResultSchema = z.
|
|
391
|
+
const ReadResultSchema = z.strictObject({
|
|
392
392
|
content: z.string().optional().describe('Content'),
|
|
393
393
|
truncated: z.boolean().optional().describe('Truncated?'),
|
|
394
394
|
resourceUri: z.string().optional().describe('Full content URI'),
|
|
@@ -414,21 +414,21 @@ const ReadMultipleFileResultSchema = ReadResultSchema.extend({
|
|
|
414
414
|
maxTotalSize: z.number().optional().describe('Max total size budget'),
|
|
415
415
|
error: z.string().optional().describe('Error message'),
|
|
416
416
|
});
|
|
417
|
-
export const ReadMultipleFilesOutputSchema = z.
|
|
417
|
+
export const ReadMultipleFilesOutputSchema = z.strictObject({
|
|
418
418
|
ok: z.boolean(),
|
|
419
419
|
results: z.array(ReadMultipleFileResultSchema).optional(),
|
|
420
420
|
summary: OperationSummarySchema.optional(),
|
|
421
421
|
error: ErrorSchema.optional(),
|
|
422
422
|
});
|
|
423
|
-
export const GetFileInfoOutputSchema = z.
|
|
423
|
+
export const GetFileInfoOutputSchema = z.strictObject({
|
|
424
424
|
ok: z.boolean(),
|
|
425
425
|
info: FileInfoSchema.optional(),
|
|
426
426
|
error: ErrorSchema.optional(),
|
|
427
427
|
});
|
|
428
|
-
export const GetMultipleFileInfoOutputSchema = z.
|
|
428
|
+
export const GetMultipleFileInfoOutputSchema = z.strictObject({
|
|
429
429
|
ok: z.boolean(),
|
|
430
430
|
results: z
|
|
431
|
-
.array(z.
|
|
431
|
+
.array(z.strictObject({
|
|
432
432
|
path: z.string(),
|
|
433
433
|
info: FileInfoSchema.optional(),
|
|
434
434
|
error: z.string().optional(),
|
|
@@ -440,7 +440,7 @@ export const GetMultipleFileInfoOutputSchema = z.object({
|
|
|
440
440
|
export const CreateDirectoryInputSchema = z.strictObject({
|
|
441
441
|
path: RequiredPathSchema.describe(DESC_PATH_REQUIRED),
|
|
442
442
|
});
|
|
443
|
-
export const CreateDirectoryOutputSchema = z.
|
|
443
|
+
export const CreateDirectoryOutputSchema = z.strictObject({
|
|
444
444
|
ok: z.boolean(),
|
|
445
445
|
path: z.string().optional(),
|
|
446
446
|
error: ErrorSchema.optional(),
|
|
@@ -449,7 +449,7 @@ export const WriteFileInputSchema = z.strictObject({
|
|
|
449
449
|
path: RequiredPathSchema.describe(DESC_PATH_REQUIRED),
|
|
450
450
|
content: z.string().describe('Content to write'),
|
|
451
451
|
});
|
|
452
|
-
export const WriteFileOutputSchema = z.
|
|
452
|
+
export const WriteFileOutputSchema = z.strictObject({
|
|
453
453
|
ok: z.boolean(),
|
|
454
454
|
path: z.string().optional(),
|
|
455
455
|
bytesWritten: z.number().optional(),
|
|
@@ -458,7 +458,7 @@ export const WriteFileOutputSchema = z.object({
|
|
|
458
458
|
export const EditFileInputSchema = z.strictObject({
|
|
459
459
|
path: RequiredPathSchema.describe(DESC_PATH_REQUIRED),
|
|
460
460
|
edits: z
|
|
461
|
-
.array(z.
|
|
461
|
+
.array(z.strictObject({
|
|
462
462
|
oldText: z
|
|
463
463
|
.string()
|
|
464
464
|
.describe('Exact literal string to replace — must match character-for-character including whitespace and indentation. Include 3–5 lines of surrounding context to uniquely identify the location.'),
|
|
@@ -474,7 +474,7 @@ export const EditFileInputSchema = z.strictObject({
|
|
|
474
474
|
.default(false)
|
|
475
475
|
.describe('Preview edits without writing. Check unmatchedEdits in the response to verify all oldText values were found.'),
|
|
476
476
|
});
|
|
477
|
-
export const EditFileOutputSchema = z.
|
|
477
|
+
export const EditFileOutputSchema = z.strictObject({
|
|
478
478
|
ok: z.boolean(),
|
|
479
479
|
path: z.string().optional(),
|
|
480
480
|
appliedEdits: z.number().optional(),
|
|
@@ -492,7 +492,7 @@ export const MoveFileInputSchema = z.strictObject({
|
|
|
492
492
|
source: RequiredPathSchema.describe('Path to move'),
|
|
493
493
|
destination: RequiredPathSchema.describe('New path'),
|
|
494
494
|
});
|
|
495
|
-
export const MoveFileOutputSchema = z.
|
|
495
|
+
export const MoveFileOutputSchema = z.strictObject({
|
|
496
496
|
ok: z.boolean(),
|
|
497
497
|
source: z.string().optional(),
|
|
498
498
|
destination: z.string().optional(),
|
|
@@ -511,7 +511,7 @@ export const DeleteFileInputSchema = z.strictObject({
|
|
|
511
511
|
.default(false)
|
|
512
512
|
.describe('No error if missing'),
|
|
513
513
|
});
|
|
514
|
-
export const DeleteFileOutputSchema = z.
|
|
514
|
+
export const DeleteFileOutputSchema = z.strictObject({
|
|
515
515
|
ok: z.boolean(),
|
|
516
516
|
path: z.string().optional(),
|
|
517
517
|
error: ErrorSchema.optional(),
|
|
@@ -519,7 +519,7 @@ export const DeleteFileOutputSchema = z.object({
|
|
|
519
519
|
export const CalculateHashInputSchema = z.strictObject({
|
|
520
520
|
path: RequiredPathSchema.describe(DESC_PATH_REQUIRED),
|
|
521
521
|
});
|
|
522
|
-
export const CalculateHashOutputSchema = z.
|
|
522
|
+
export const CalculateHashOutputSchema = z.strictObject({
|
|
523
523
|
ok: z.boolean(),
|
|
524
524
|
path: z.string().optional(),
|
|
525
525
|
hash: z.string().optional().describe('SHA-256 hash'),
|
|
@@ -551,7 +551,7 @@ export const DiffFilesInputSchema = z.strictObject({
|
|
|
551
551
|
.default(false)
|
|
552
552
|
.describe('Strip trailing carriage returns before diffing'),
|
|
553
553
|
});
|
|
554
|
-
export const DiffFilesOutputSchema = z.
|
|
554
|
+
export const DiffFilesOutputSchema = z.strictObject({
|
|
555
555
|
ok: z.boolean(),
|
|
556
556
|
diff: z.string().optional().describe('Unified diff content'),
|
|
557
557
|
isIdentical: z.boolean().optional().describe('True if files are identical'),
|
|
@@ -582,7 +582,7 @@ export const ApplyPatchInputSchema = z.strictObject({
|
|
|
582
582
|
.default(false)
|
|
583
583
|
.describe('Validate the patch can be applied without writing. Check `applied` in the response before committing.'),
|
|
584
584
|
});
|
|
585
|
-
export const ApplyPatchOutputSchema = z.
|
|
585
|
+
export const ApplyPatchOutputSchema = z.strictObject({
|
|
586
586
|
ok: z.boolean(),
|
|
587
587
|
path: z.string().optional(),
|
|
588
588
|
applied: z.boolean().optional(),
|
|
@@ -614,21 +614,21 @@ export const SearchAndReplaceInputSchema = z.strictObject({
|
|
|
614
614
|
.default(false)
|
|
615
615
|
.describe('Preview matches without writing. Check changedFiles and matches in the response before committing.'),
|
|
616
616
|
});
|
|
617
|
-
export const SearchAndReplaceOutputSchema = z.
|
|
617
|
+
export const SearchAndReplaceOutputSchema = z.strictObject({
|
|
618
618
|
ok: z.boolean(),
|
|
619
619
|
matches: z.number().optional().describe('Total matches found'),
|
|
620
620
|
filesChanged: z.number().optional().describe('Files modified'),
|
|
621
621
|
processedFiles: z.number().optional().describe('Files processed'),
|
|
622
622
|
failedFiles: z.number().optional().describe('Files skipped due to errors'),
|
|
623
623
|
failures: z
|
|
624
|
-
.array(z.
|
|
624
|
+
.array(z.strictObject({
|
|
625
625
|
path: z.string().describe('File path'),
|
|
626
626
|
error: z.string().describe('Error message'),
|
|
627
627
|
}))
|
|
628
628
|
.optional()
|
|
629
629
|
.describe('Sample of per-file errors'),
|
|
630
630
|
changedFiles: z
|
|
631
|
-
.array(z.
|
|
631
|
+
.array(z.strictObject({
|
|
632
632
|
path: z.string().describe('File path'),
|
|
633
633
|
matches: z.number().describe('Matches in file'),
|
|
634
634
|
}))
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as http from 'node:http';
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import type { ServerOptions } from './types.js';
|
|
4
|
+
export declare function createServer(options?: ServerOptions): Promise<McpServer>;
|
|
5
|
+
export declare function startServer(server: McpServer): Promise<void>;
|
|
6
|
+
export declare function startHttpServer(port: number, options: ServerOptions): Promise<http.Server>;
|