llm-mask 0.3.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/.github/workflows/llm-mask-check.yml +62 -0
- package/LICENSE +21 -0
- package/README.md +549 -0
- package/dist/audit.d.ts +56 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +90 -0
- package/dist/audit.js.map +1 -0
- package/dist/cli-old.d.ts +12 -0
- package/dist/cli-old.d.ts.map +1 -0
- package/dist/cli-old.js +257 -0
- package/dist/cli-old.js.map +1 -0
- package/dist/cli.d.ts +19 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +197 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands.d.ts +9 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +121 -0
- package/dist/commands.js.map +1 -0
- package/dist/config.d.ts +38 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +81 -0
- package/dist/config.js.map +1 -0
- package/dist/context-detection.d.ts +54 -0
- package/dist/context-detection.d.ts.map +1 -0
- package/dist/context-detection.js +219 -0
- package/dist/context-detection.js.map +1 -0
- package/dist/diff-masking.d.ts +51 -0
- package/dist/diff-masking.d.ts.map +1 -0
- package/dist/diff-masking.js +121 -0
- package/dist/diff-masking.js.map +1 -0
- package/dist/executor.d.ts +105 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +250 -0
- package/dist/executor.js.map +1 -0
- package/dist/executor.test.d.ts +5 -0
- package/dist/executor.test.d.ts.map +1 -0
- package/dist/executor.test.js +500 -0
- package/dist/executor.test.js.map +1 -0
- package/dist/features.test.d.ts +5 -0
- package/dist/features.test.d.ts.map +1 -0
- package/dist/features.test.js +118 -0
- package/dist/features.test.js.map +1 -0
- package/dist/formatter.d.ts +54 -0
- package/dist/formatter.d.ts.map +1 -0
- package/dist/formatter.js +139 -0
- package/dist/formatter.js.map +1 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/language-patterns.d.ts +39 -0
- package/dist/language-patterns.d.ts.map +1 -0
- package/dist/language-patterns.js +177 -0
- package/dist/language-patterns.js.map +1 -0
- package/dist/masker.d.ts +100 -0
- package/dist/masker.d.ts.map +1 -0
- package/dist/masker.js +255 -0
- package/dist/masker.js.map +1 -0
- package/dist/masker.test.d.ts +11 -0
- package/dist/masker.test.d.ts.map +1 -0
- package/dist/masker.test.js +162 -0
- package/dist/masker.test.js.map +1 -0
- package/dist/mcp-server.d.ts +9 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +494 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/patterns.d.ts +25 -0
- package/dist/patterns.d.ts.map +1 -0
- package/dist/patterns.js +184 -0
- package/dist/patterns.js.map +1 -0
- package/dist/scanner.d.ts +75 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +247 -0
- package/dist/scanner.js.map +1 -0
- package/dist/test-utils.d.ts +5 -0
- package/dist/test-utils.d.ts.map +1 -0
- package/dist/test-utils.js +6 -0
- package/dist/test-utils.js.map +1 -0
- package/dist/tokenizer.d.ts +62 -0
- package/dist/tokenizer.d.ts.map +1 -0
- package/dist/tokenizer.js +95 -0
- package/dist/tokenizer.js.map +1 -0
- package/dist/types.d.ts +63 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enhanced MCP Server for llm-mask
|
|
3
|
+
*
|
|
4
|
+
* Provides tools for Claude Code and other AI agents
|
|
5
|
+
*
|
|
6
|
+
* New in v0.3: Secure exec tools - run commands without exposing credentials to LLM
|
|
7
|
+
*/
|
|
8
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
9
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
10
|
+
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
11
|
+
import { DataMasker } from './masker.js';
|
|
12
|
+
import { Scanner } from './scanner.js';
|
|
13
|
+
import { DiffMasker } from './diff-masking.js';
|
|
14
|
+
import { ContextMasker } from './context-detection.js';
|
|
15
|
+
import { BUILTIN_PATTERNS } from './patterns.js';
|
|
16
|
+
import { SecureExecutor } from './executor.js';
|
|
17
|
+
const masker = new DataMasker();
|
|
18
|
+
const scanner = new Scanner();
|
|
19
|
+
const diffMasker = new DiffMasker();
|
|
20
|
+
const contextMasker = new ContextMasker();
|
|
21
|
+
const executor = new SecureExecutor();
|
|
22
|
+
const TOOLS = [
|
|
23
|
+
// === Original masking tools ===
|
|
24
|
+
{
|
|
25
|
+
name: 'mask_data',
|
|
26
|
+
description: `Mask sensitive data (API keys, emails, IPs, PII) before sending to LLM.`,
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
text: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'The text to mask'
|
|
33
|
+
},
|
|
34
|
+
level: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
enum: ['basic', 'standard', 'aggressive']
|
|
37
|
+
},
|
|
38
|
+
preserveFormat: {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
description: 'Preserve format (j***@a***.com instead of [EMAIL_1])'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
required: ['text']
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'check_masking',
|
|
48
|
+
description: 'Dry-run: Check what WOULD be masked.',
|
|
49
|
+
inputSchema: {
|
|
50
|
+
type: 'object',
|
|
51
|
+
properties: {
|
|
52
|
+
text: { type: 'string' },
|
|
53
|
+
level: { type: 'string', enum: ['basic', 'standard', 'aggressive'] }
|
|
54
|
+
},
|
|
55
|
+
required: ['text']
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'scan_directory',
|
|
60
|
+
description: 'Scan a directory for sensitive data (secrets, API keys, PII).',
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: 'object',
|
|
63
|
+
properties: {
|
|
64
|
+
directory: { type: 'string' },
|
|
65
|
+
level: { type: 'string', enum: ['basic', 'standard', 'aggressive'] },
|
|
66
|
+
extensions: { type: 'string' }
|
|
67
|
+
},
|
|
68
|
+
required: ['directory']
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'mask_diff',
|
|
73
|
+
description: 'Mask git diff output for safe LLM code review.',
|
|
74
|
+
inputSchema: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: {
|
|
77
|
+
base: { type: 'string' },
|
|
78
|
+
head: { type: 'string' },
|
|
79
|
+
path: { type: 'string' },
|
|
80
|
+
level: { type: 'string', enum: ['basic', 'standard', 'aggressive'] }
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'mask_context',
|
|
86
|
+
description: `Context-aware masking - detects SQL, JSON, YAML and masks only values while preserving structure.`,
|
|
87
|
+
inputSchema: {
|
|
88
|
+
type: 'object',
|
|
89
|
+
properties: {
|
|
90
|
+
text: { type: 'string' }
|
|
91
|
+
},
|
|
92
|
+
required: ['text']
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'list_patterns',
|
|
97
|
+
description: 'List all available masking patterns.',
|
|
98
|
+
inputSchema: {
|
|
99
|
+
type: 'object',
|
|
100
|
+
properties: {
|
|
101
|
+
filter: { type: 'string' }
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'clear_mappings',
|
|
107
|
+
description: 'Clear all in-memory mappings.',
|
|
108
|
+
inputSchema: {
|
|
109
|
+
type: 'object',
|
|
110
|
+
properties: {}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
// === NEW: Secure exec tools ===
|
|
114
|
+
{
|
|
115
|
+
name: 'exec_redacted',
|
|
116
|
+
description: `Execute a command and return redacted output (safe for LLM).
|
|
117
|
+
|
|
118
|
+
IMPORTANT: The command executes with REAL credentials, but the output
|
|
119
|
+
is redacted before the LLM sees it. Useful for:
|
|
120
|
+
- Running kubectl to inspect clusters
|
|
121
|
+
- Running commands that might output secrets
|
|
122
|
+
- Executing scripts with sensitive output
|
|
123
|
+
|
|
124
|
+
The LLM never sees: actual passwords, API keys, IPs, etc.
|
|
125
|
+
The command still works: credentials are functional`,
|
|
126
|
+
inputSchema: {
|
|
127
|
+
type: 'object',
|
|
128
|
+
properties: {
|
|
129
|
+
command: {
|
|
130
|
+
type: 'string',
|
|
131
|
+
description: 'Command to execute (e.g., "kubectl", "cat", "ls")'
|
|
132
|
+
},
|
|
133
|
+
args: {
|
|
134
|
+
type: 'array',
|
|
135
|
+
items: { type: 'string' },
|
|
136
|
+
description: 'Command arguments'
|
|
137
|
+
},
|
|
138
|
+
cwd: {
|
|
139
|
+
type: 'string',
|
|
140
|
+
description: 'Working directory'
|
|
141
|
+
},
|
|
142
|
+
timeout: {
|
|
143
|
+
type: 'number',
|
|
144
|
+
description: 'Timeout in milliseconds (default: 30000)'
|
|
145
|
+
},
|
|
146
|
+
level: {
|
|
147
|
+
type: 'string',
|
|
148
|
+
enum: ['basic', 'standard', 'aggressive'],
|
|
149
|
+
description: 'Redaction level'
|
|
150
|
+
},
|
|
151
|
+
preserveFormat: {
|
|
152
|
+
type: 'boolean',
|
|
153
|
+
description: 'Preserve format in redacted output'
|
|
154
|
+
},
|
|
155
|
+
includeStderr: {
|
|
156
|
+
type: 'boolean',
|
|
157
|
+
description: 'Include stderr in output'
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
required: ['command']
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'kube_exec',
|
|
165
|
+
description: `Execute kubectl commands with redacted output.
|
|
166
|
+
|
|
167
|
+
Supports:
|
|
168
|
+
- Regular kubectl commands (get, describe, apply, etc.)
|
|
169
|
+
- Pod exec (run commands in containers)
|
|
170
|
+
- All kubectl flags (--namespace, --context, etc.)
|
|
171
|
+
|
|
172
|
+
Example: { "command": "get", "args": ["pods", "-o", "wide"] }`,
|
|
173
|
+
inputSchema: {
|
|
174
|
+
type: 'object',
|
|
175
|
+
properties: {
|
|
176
|
+
args: {
|
|
177
|
+
type: 'array',
|
|
178
|
+
items: { type: 'string' },
|
|
179
|
+
description: 'kubectl arguments (e.g., ["get", "pods", "-o", "wide"])'
|
|
180
|
+
},
|
|
181
|
+
namespace: {
|
|
182
|
+
type: 'string',
|
|
183
|
+
description: 'Kubernetes namespace'
|
|
184
|
+
},
|
|
185
|
+
context: {
|
|
186
|
+
type: 'string',
|
|
187
|
+
description: 'kubectl context'
|
|
188
|
+
},
|
|
189
|
+
pod: {
|
|
190
|
+
type: 'string',
|
|
191
|
+
description: 'Pod name (for exec operations)'
|
|
192
|
+
},
|
|
193
|
+
container: {
|
|
194
|
+
type: 'string',
|
|
195
|
+
description: 'Container name (for pod exec)'
|
|
196
|
+
},
|
|
197
|
+
remoteCommand: {
|
|
198
|
+
type: 'string',
|
|
199
|
+
description: 'Command to execute in pod (for pod exec)'
|
|
200
|
+
},
|
|
201
|
+
level: {
|
|
202
|
+
type: 'string',
|
|
203
|
+
enum: ['basic', 'standard', 'aggressive']
|
|
204
|
+
},
|
|
205
|
+
preserveFormat: {
|
|
206
|
+
type: 'boolean'
|
|
207
|
+
},
|
|
208
|
+
timeout: {
|
|
209
|
+
type: 'number'
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
required: ['args']
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'ssh_exec',
|
|
217
|
+
description: `Execute SSH commands with redacted output.
|
|
218
|
+
|
|
219
|
+
Supports:
|
|
220
|
+
- Remote command execution
|
|
221
|
+
- Custom identity files
|
|
222
|
+
- Port and user specification
|
|
223
|
+
- All SSH options
|
|
224
|
+
|
|
225
|
+
Example: { "host": "server.example.com", "command": "ls -la /etc" }`,
|
|
226
|
+
inputSchema: {
|
|
227
|
+
type: 'object',
|
|
228
|
+
properties: {
|
|
229
|
+
host: {
|
|
230
|
+
type: 'string',
|
|
231
|
+
description: 'SSH host (required)'
|
|
232
|
+
},
|
|
233
|
+
user: {
|
|
234
|
+
type: 'string',
|
|
235
|
+
description: 'SSH user'
|
|
236
|
+
},
|
|
237
|
+
port: {
|
|
238
|
+
type: 'number',
|
|
239
|
+
description: 'SSH port'
|
|
240
|
+
},
|
|
241
|
+
identity: {
|
|
242
|
+
type: 'string',
|
|
243
|
+
description: 'Path to private key file'
|
|
244
|
+
},
|
|
245
|
+
command: {
|
|
246
|
+
type: 'string',
|
|
247
|
+
description: 'Command to execute on remote host'
|
|
248
|
+
},
|
|
249
|
+
level: {
|
|
250
|
+
type: 'string',
|
|
251
|
+
enum: ['basic', 'standard', 'aggressive']
|
|
252
|
+
},
|
|
253
|
+
preserveFormat: {
|
|
254
|
+
type: 'boolean'
|
|
255
|
+
},
|
|
256
|
+
timeout: {
|
|
257
|
+
type: 'number'
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
required: ['host']
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
];
|
|
264
|
+
const server = new Server({
|
|
265
|
+
name: 'llm-mask',
|
|
266
|
+
version: '0.3.0'
|
|
267
|
+
}, {
|
|
268
|
+
capabilities: {
|
|
269
|
+
tools: {}
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
273
|
+
return { tools: TOOLS };
|
|
274
|
+
});
|
|
275
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
276
|
+
const { name, arguments: args } = request.params;
|
|
277
|
+
try {
|
|
278
|
+
switch (name) {
|
|
279
|
+
// === Masking tools ===
|
|
280
|
+
case 'mask_data': {
|
|
281
|
+
const text = args?.text;
|
|
282
|
+
const result = masker.mask(text, {
|
|
283
|
+
level: args?.level || 'standard',
|
|
284
|
+
preserveFormat: args?.preserveFormat || false
|
|
285
|
+
});
|
|
286
|
+
return {
|
|
287
|
+
content: [{
|
|
288
|
+
type: 'text',
|
|
289
|
+
text: JSON.stringify({
|
|
290
|
+
masked: result.masked,
|
|
291
|
+
stats: result.stats
|
|
292
|
+
}, null, 2)
|
|
293
|
+
}]
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
case 'check_masking': {
|
|
297
|
+
const text = args?.text;
|
|
298
|
+
const result = masker.mask(text, { level: args?.level || 'standard' });
|
|
299
|
+
return {
|
|
300
|
+
content: [{
|
|
301
|
+
type: 'text',
|
|
302
|
+
text: JSON.stringify({
|
|
303
|
+
wouldMask: result.stats
|
|
304
|
+
}, null, 2)
|
|
305
|
+
}]
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
case 'scan_directory': {
|
|
309
|
+
const report = await scanner.scan(args?.directory || '.');
|
|
310
|
+
return {
|
|
311
|
+
content: [{
|
|
312
|
+
type: 'text',
|
|
313
|
+
text: JSON.stringify({
|
|
314
|
+
scans: report.scans,
|
|
315
|
+
summary: report.summary,
|
|
316
|
+
findings: report.findings.slice(0, 50)
|
|
317
|
+
}, null, 2)
|
|
318
|
+
}]
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
case 'mask_diff': {
|
|
322
|
+
const result = diffMasker.maskDiff({
|
|
323
|
+
base: args?.base,
|
|
324
|
+
head: args?.head,
|
|
325
|
+
level: args?.level || 'standard',
|
|
326
|
+
path: args?.path
|
|
327
|
+
});
|
|
328
|
+
return {
|
|
329
|
+
content: [{
|
|
330
|
+
type: 'text',
|
|
331
|
+
text: JSON.stringify({
|
|
332
|
+
maskedDiff: result.maskedDiff,
|
|
333
|
+
stats: result.stats
|
|
334
|
+
}, null, 2)
|
|
335
|
+
}]
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
case 'mask_context': {
|
|
339
|
+
const text = args?.text;
|
|
340
|
+
const result = contextMasker.mask(text);
|
|
341
|
+
return {
|
|
342
|
+
content: [{
|
|
343
|
+
type: 'text',
|
|
344
|
+
text: JSON.stringify({
|
|
345
|
+
masked: result.masked,
|
|
346
|
+
context: result.context,
|
|
347
|
+
stats: result.stats
|
|
348
|
+
}, null, 2)
|
|
349
|
+
}]
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
case 'list_patterns': {
|
|
353
|
+
const filter = args?.filter;
|
|
354
|
+
let patterns = BUILTIN_PATTERNS;
|
|
355
|
+
if (filter) {
|
|
356
|
+
patterns = patterns.filter(p => p.name.includes(filter));
|
|
357
|
+
}
|
|
358
|
+
return {
|
|
359
|
+
content: [{
|
|
360
|
+
type: 'text',
|
|
361
|
+
text: JSON.stringify({
|
|
362
|
+
patterns: patterns.map(p => ({
|
|
363
|
+
name: p.name,
|
|
364
|
+
priority: p.priority,
|
|
365
|
+
example: p.placeholder(1)
|
|
366
|
+
})),
|
|
367
|
+
total: patterns.length
|
|
368
|
+
}, null, 2)
|
|
369
|
+
}]
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
case 'clear_mappings': {
|
|
373
|
+
const count = masker.getMappingCount();
|
|
374
|
+
masker.clear();
|
|
375
|
+
return {
|
|
376
|
+
content: [{
|
|
377
|
+
type: 'text',
|
|
378
|
+
text: JSON.stringify({
|
|
379
|
+
cleared: true,
|
|
380
|
+
mappingsRemoved: count
|
|
381
|
+
}, null, 2)
|
|
382
|
+
}]
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
// === NEW: Secure exec tools ===
|
|
386
|
+
case 'exec_redacted': {
|
|
387
|
+
const result = await executor.exec({
|
|
388
|
+
command: args?.command,
|
|
389
|
+
args: args?.args,
|
|
390
|
+
cwd: args?.cwd,
|
|
391
|
+
timeout: args?.timeout,
|
|
392
|
+
level: args?.level || 'standard',
|
|
393
|
+
preserveFormat: args?.preserveFormat || false,
|
|
394
|
+
includeStderr: args?.includeStderr !== false
|
|
395
|
+
});
|
|
396
|
+
return {
|
|
397
|
+
content: [{
|
|
398
|
+
type: 'text',
|
|
399
|
+
text: JSON.stringify({
|
|
400
|
+
redacted: {
|
|
401
|
+
output: result.redacted.stdout,
|
|
402
|
+
stderr: result.redacted.stderr,
|
|
403
|
+
stats: result.redacted.stats
|
|
404
|
+
},
|
|
405
|
+
exitCode: result.exitCode,
|
|
406
|
+
signal: result.signal,
|
|
407
|
+
timedOut: result.timedOut,
|
|
408
|
+
warning: 'Original output contains sensitive data and was redacted'
|
|
409
|
+
}, null, 2)
|
|
410
|
+
}]
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
case 'kube_exec': {
|
|
414
|
+
const result = await executor.kubectl({
|
|
415
|
+
args: args?.args,
|
|
416
|
+
namespace: args?.namespace,
|
|
417
|
+
context: args?.context,
|
|
418
|
+
pod: args?.pod,
|
|
419
|
+
container: args?.container,
|
|
420
|
+
execCommand: args?.remoteCommand,
|
|
421
|
+
level: args?.level || 'standard',
|
|
422
|
+
preserveFormat: args?.preserveFormat || false,
|
|
423
|
+
timeout: args?.timeout
|
|
424
|
+
});
|
|
425
|
+
return {
|
|
426
|
+
content: [{
|
|
427
|
+
type: 'text',
|
|
428
|
+
text: JSON.stringify({
|
|
429
|
+
redacted: {
|
|
430
|
+
output: result.redacted.stdout,
|
|
431
|
+
stderr: result.redacted.stderr,
|
|
432
|
+
stats: result.redacted.stats
|
|
433
|
+
},
|
|
434
|
+
exitCode: result.exitCode,
|
|
435
|
+
signal: result.signal,
|
|
436
|
+
timedOut: result.timedOut
|
|
437
|
+
}, null, 2)
|
|
438
|
+
}]
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
case 'ssh_exec': {
|
|
442
|
+
const result = await executor.ssh({
|
|
443
|
+
host: args?.host,
|
|
444
|
+
user: args?.user,
|
|
445
|
+
port: args?.port,
|
|
446
|
+
identity: args?.identity,
|
|
447
|
+
remoteCommand: args?.command,
|
|
448
|
+
level: args?.level || 'standard',
|
|
449
|
+
preserveFormat: args?.preserveFormat || false,
|
|
450
|
+
timeout: args?.timeout
|
|
451
|
+
});
|
|
452
|
+
return {
|
|
453
|
+
content: [{
|
|
454
|
+
type: 'text',
|
|
455
|
+
text: JSON.stringify({
|
|
456
|
+
redacted: {
|
|
457
|
+
output: result.redacted.stdout,
|
|
458
|
+
stderr: result.redacted.stderr,
|
|
459
|
+
stats: result.redacted.stats
|
|
460
|
+
},
|
|
461
|
+
exitCode: result.exitCode,
|
|
462
|
+
signal: result.signal,
|
|
463
|
+
timedOut: result.timedOut
|
|
464
|
+
}, null, 2)
|
|
465
|
+
}]
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
default:
|
|
469
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
catch (error) {
|
|
473
|
+
return {
|
|
474
|
+
content: [{
|
|
475
|
+
type: 'text',
|
|
476
|
+
text: JSON.stringify({
|
|
477
|
+
error: error instanceof Error ? error.message : String(error),
|
|
478
|
+
tool: name
|
|
479
|
+
})
|
|
480
|
+
}],
|
|
481
|
+
isError: true
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
async function main() {
|
|
486
|
+
const transport = new StdioServerTransport();
|
|
487
|
+
await server.connect(transport);
|
|
488
|
+
console.error('llm-mask MCP server running (v0.3.0)');
|
|
489
|
+
}
|
|
490
|
+
main().catch((error) => {
|
|
491
|
+
console.error('Fatal error:', error);
|
|
492
|
+
process.exit(1);
|
|
493
|
+
});
|
|
494
|
+
//# sourceMappingURL=mcp-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CA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AS,CAAC;wBACnB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;wBAC7D,IAAI,EAAE,IAAI;qBACX,CAAC;iBACH,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAA;IACH,CAAC;AACH,CAAC,CAAC,CAAA;AAEF,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAE/B,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;AACvD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in masking patterns
|
|
3
|
+
* These are organized by priority (higher = applied first)
|
|
4
|
+
*/
|
|
5
|
+
import type { MaskPattern } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Built-in patterns for detecting sensitive data
|
|
8
|
+
*
|
|
9
|
+
* Priority order:
|
|
10
|
+
* 1. API keys and secrets (most specific, most sensitive)
|
|
11
|
+
* 2. Auth tokens and session IDs
|
|
12
|
+
* 3. PII (emails, phones, SSNs, credit cards)
|
|
13
|
+
* 4. Network identifiers (IPs, domains, URLs)
|
|
14
|
+
* 5. Internal identifiers (UUIDs, potentially-sensitive numbers)
|
|
15
|
+
*/
|
|
16
|
+
export declare const BUILTIN_PATTERNS: MaskPattern[];
|
|
17
|
+
/**
|
|
18
|
+
* Get patterns by mask level
|
|
19
|
+
*/
|
|
20
|
+
export declare function getPatternsByLevel(level: string): MaskPattern[];
|
|
21
|
+
/**
|
|
22
|
+
* Get pattern by name
|
|
23
|
+
*/
|
|
24
|
+
export declare function getPatternByName(name: string): MaskPattern | undefined;
|
|
25
|
+
//# sourceMappingURL=patterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../src/patterns.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAE7C;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,EAAE,WAAW,EAuJzC,CAAA;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,CAc/D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS,CAEtE"}
|