@maskera/mcp 0.4.8 → 0.5.1

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/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { NerRecognizer, NerOptions, RedactionProfile, RedactResult, Detector } from 'maskera';
1
+ import { NerRecognizer, NerOptions, RedactionProfile, RedactResult, Detector, Redaction } from 'maskera';
2
+ import { FileFormat, RedactedFileResult } from '@maskera/files';
2
3
  import { ServerResponse, Server, IncomingMessage } from 'node:http';
3
4
 
4
5
  type ApprovalMode = "automatic" | "browser" | "native";
@@ -180,6 +181,17 @@ interface SearchMatch {
180
181
  line: number;
181
182
  lineText: string;
182
183
  }
184
+ interface ReadDocumentResult {
185
+ resolvedPath: string;
186
+ content: string;
187
+ bytes: number;
188
+ format: FileFormat;
189
+ mimeType: string;
190
+ metadataFields: string[];
191
+ warnings: string[];
192
+ scannedPages: number[];
193
+ totalPages?: number;
194
+ }
183
195
  interface FileGuard {
184
196
  readonly allowedRoots: readonly string[];
185
197
  readText(filePath: string): Promise<{
@@ -187,12 +199,26 @@ interface FileGuard {
187
199
  content: string;
188
200
  bytes: number;
189
201
  }>;
202
+ readDocument(filePath: string): Promise<ReadDocumentResult>;
203
+ readBytes(filePath: string, options?: {
204
+ maxBytes?: number;
205
+ }): Promise<{
206
+ resolvedPath: string;
207
+ bytes: Uint8Array;
208
+ }>;
190
209
  writeText(filePath: string, content: string, options?: {
191
210
  overwrite?: boolean;
192
211
  }): Promise<{
193
212
  resolvedPath: string;
194
213
  bytes: number;
195
214
  }>;
215
+ writeBytes(filePath: string, bytes: Uint8Array, options?: {
216
+ overwrite?: boolean;
217
+ maxBytes?: number;
218
+ }): Promise<{
219
+ resolvedPath: string;
220
+ bytes: number;
221
+ }>;
196
222
  listFiles(dirPath?: string, options?: {
197
223
  maxEntries?: number;
198
224
  maxDepth?: number;
@@ -394,6 +420,7 @@ declare class SessionVault {
394
420
  counts: Record<string, number>;
395
421
  totalRedactions: number;
396
422
  map: Record<string, string>;
423
+ redactions: Redaction[];
397
424
  };
398
425
  restore(text: string, options: {
399
426
  sessionId?: string;
@@ -523,6 +550,10 @@ declare function isLikelyEnglishSystemPrompt(text: string): boolean;
523
550
  * consistency within the same client thread.
524
551
  */
525
552
  declare function deriveProxySessionId(headers: IncomingMessage["headers"], body?: Record<string, unknown>): string;
553
+ type ProxyDocumentRedactor = (bytes: Uint8Array, info: {
554
+ fileName?: string;
555
+ mimeType?: string;
556
+ }) => Promise<RedactedFileResult>;
526
557
  /**
527
558
  * Redacts all user/tool/system text fields in an Anthropic Messages, OpenAI
528
559
  * Chat Completions, or OpenAI Responses request body before it leaves the
@@ -531,6 +562,7 @@ declare function deriveProxySessionId(headers: IncomingMessage["headers"], body?
531
562
  declare function redactLlmRequestBody(body: Record<string, unknown>, redactString: (text: string, kind: RedactFieldKind) => Promise<string>, options?: {
532
563
  mutate?: boolean;
533
564
  onBinaryAttachment?: (kind: string) => void;
565
+ redactDocument?: ProxyDocumentRedactor;
534
566
  }): Promise<Record<string, unknown>>;
535
567
  /**
536
568
  * Restores Maskera placeholders in a non-streaming Anthropic or OpenAI JSON