@slbdn/mcp-tester 1.1.0 → 1.2.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/CHANGELOG.md +16 -0
- package/README.md +140 -6
- package/dist/client/MCPClient.d.ts.map +1 -1
- package/dist/client/MCPClient.js +33 -22
- package/dist/client/MCPClient.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/errors.d.ts +43 -5
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +86 -7
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/logger.d.ts +51 -24
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +103 -9
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/masking.d.ts +66 -0
- package/dist/utils/masking.d.ts.map +1 -0
- package/dist/utils/masking.js +171 -0
- package/dist/utils/masking.js.map +1 -0
- package/package.json +3 -1
package/dist/utils/errors.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Error classes for MCPClient operations.
|
|
3
3
|
*
|
|
4
4
|
* All errors include a descriptive message, error code, and proper stack trace.
|
|
5
|
+
* Timeout and connection errors include actionable suggestions for debugging.
|
|
5
6
|
*
|
|
6
7
|
* @example
|
|
7
8
|
* ```typescript
|
|
@@ -10,8 +11,13 @@
|
|
|
10
11
|
* } catch (error) {
|
|
11
12
|
* if (error instanceof MCPServerError) {
|
|
12
13
|
* console.error(`Server error: ${error.message}`);
|
|
14
|
+
* console.error(`Operation: ${error.operation}`);
|
|
13
15
|
* } else if (error instanceof MCPTimeoutError) {
|
|
14
|
-
* console.error(`Timeout after ${error.timeout}ms`);
|
|
16
|
+
* console.error(`Timeout after ${error.timeout}ms on ${error.operation}`);
|
|
17
|
+
* console.error(`Suggestions: ${error.suggestions.join(', ')}`);
|
|
18
|
+
* } else if (error instanceof MCPConnectionError) {
|
|
19
|
+
* console.error(`Connection failed: ${error.message}`);
|
|
20
|
+
* console.error(`Command: ${error.command}`);
|
|
15
21
|
* }
|
|
16
22
|
* }
|
|
17
23
|
* ```
|
|
@@ -31,34 +37,99 @@ export class MCPClientError extends Error {
|
|
|
31
37
|
}
|
|
32
38
|
/**
|
|
33
39
|
* Error thrown when a request times out.
|
|
40
|
+
*
|
|
41
|
+
* Includes the operation that timed out, the timeout value, and
|
|
42
|
+
* actionable suggestions for resolving the timeout.
|
|
34
43
|
*/
|
|
35
44
|
export class MCPTimeoutError extends MCPClientError {
|
|
36
45
|
/** The timeout value in milliseconds. */
|
|
37
46
|
timeout;
|
|
38
|
-
|
|
47
|
+
/** The operation that timed out (e.g., "Call tool echo", "List tools"). */
|
|
48
|
+
operation;
|
|
49
|
+
/** Actionable suggestions for resolving the timeout. */
|
|
50
|
+
suggestions;
|
|
51
|
+
constructor(message, timeout, operation, suggestions) {
|
|
39
52
|
super(message, 'MCP_TIMEOUT_ERROR');
|
|
40
53
|
this.name = 'MCPTimeoutError';
|
|
41
54
|
this.timeout = timeout;
|
|
55
|
+
this.operation = operation || 'unknown operation';
|
|
56
|
+
this.suggestions = suggestions || MCPTimeoutError.defaultSuggestions(timeout);
|
|
42
57
|
Error.captureStackTrace(this, MCPTimeoutError);
|
|
43
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Generate default suggestions based on timeout value.
|
|
61
|
+
*/
|
|
62
|
+
static defaultSuggestions(timeout) {
|
|
63
|
+
const suggestions = [
|
|
64
|
+
`Increase timeout (current: ${timeout}ms) — pass a higher 'timeout' option`,
|
|
65
|
+
'Check that the MCP server is running and responsive',
|
|
66
|
+
];
|
|
67
|
+
if (timeout < 5000) {
|
|
68
|
+
suggestions.push('The timeout is very low — consider using at least 5000ms for CI environments');
|
|
69
|
+
}
|
|
70
|
+
if (timeout < 10000) {
|
|
71
|
+
suggestions.push('Network/server latency may require 10000ms+ in CI environments');
|
|
72
|
+
}
|
|
73
|
+
suggestions.push('Enable debug logging for more detail: new MCPClient({ logLevel: "debug" })');
|
|
74
|
+
return suggestions;
|
|
75
|
+
}
|
|
44
76
|
}
|
|
45
77
|
/**
|
|
46
78
|
* Error thrown when the client fails to connect to the MCP server.
|
|
79
|
+
*
|
|
80
|
+
* Includes the server command and actionable suggestions for resolving
|
|
81
|
+
* connection failures.
|
|
47
82
|
*/
|
|
48
83
|
export class MCPConnectionError extends MCPClientError {
|
|
49
|
-
|
|
84
|
+
/** The command that was used to start the server. */
|
|
85
|
+
command;
|
|
86
|
+
/** Actionable suggestions for resolving the connection failure. */
|
|
87
|
+
suggestions;
|
|
88
|
+
constructor(message, command, suggestions) {
|
|
50
89
|
super(message, 'MCP_CONNECTION_ERROR');
|
|
51
90
|
this.name = 'MCPConnectionError';
|
|
91
|
+
this.command = command || 'unknown';
|
|
92
|
+
this.suggestions = suggestions || MCPConnectionError.defaultSuggestions(command);
|
|
52
93
|
Error.captureStackTrace(this, MCPConnectionError);
|
|
53
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Generate default suggestions based on the server command.
|
|
97
|
+
*/
|
|
98
|
+
static defaultSuggestions(command) {
|
|
99
|
+
const suggestions = [
|
|
100
|
+
'Verify the server command is correct and the executable exists',
|
|
101
|
+
'Check that the server starts successfully when run manually',
|
|
102
|
+
'Ensure the server communicates via stdio (stdin/stdout)',
|
|
103
|
+
];
|
|
104
|
+
if (command === 'node' || command?.startsWith('node')) {
|
|
105
|
+
suggestions.push('Make sure the Node.js script path is correct and the file exists');
|
|
106
|
+
suggestions.push('Run the script directly to check for startup errors: node <path>');
|
|
107
|
+
}
|
|
108
|
+
if (command === 'python' || command === 'python3' || command?.startsWith('python')) {
|
|
109
|
+
suggestions.push('Ensure the Python environment has all required dependencies installed');
|
|
110
|
+
suggestions.push('Check that the Python script path is correct and the file exists');
|
|
111
|
+
}
|
|
112
|
+
if (command === 'npx') {
|
|
113
|
+
suggestions.push('Verify the npm package name is correct and published');
|
|
114
|
+
suggestions.push('Try installing the package globally first: npm install -g <package>');
|
|
115
|
+
}
|
|
116
|
+
suggestions.push('Enable debug logging for more detail: new MCPClient({ logLevel: "debug" })');
|
|
117
|
+
return suggestions;
|
|
118
|
+
}
|
|
54
119
|
}
|
|
55
120
|
/**
|
|
56
121
|
* Error thrown when a client method is called before start().
|
|
122
|
+
*
|
|
123
|
+
* Includes which method was called to help identify the issue.
|
|
57
124
|
*/
|
|
58
125
|
export class MCPNotStartedError extends MCPClientError {
|
|
59
|
-
|
|
60
|
-
|
|
126
|
+
/** The method that was called on the unstarted client. */
|
|
127
|
+
method;
|
|
128
|
+
constructor(method) {
|
|
129
|
+
const methodInfo = method ? ` (called ${method}())` : '';
|
|
130
|
+
super(`Client not started${methodInfo}. Call start() before using client methods.`, 'MCP_NOT_STARTED');
|
|
61
131
|
this.name = 'MCPNotStartedError';
|
|
132
|
+
this.method = method || 'unknown';
|
|
62
133
|
Error.captureStackTrace(this, MCPNotStartedError);
|
|
63
134
|
}
|
|
64
135
|
}
|
|
@@ -67,18 +138,26 @@ export class MCPNotStartedError extends MCPClientError {
|
|
|
67
138
|
*/
|
|
68
139
|
export class MCPAlreadyStartedError extends MCPClientError {
|
|
69
140
|
constructor() {
|
|
70
|
-
super('Client already started. Call stop() before starting again.', 'MCP_ALREADY_STARTED');
|
|
141
|
+
super('Client already started. Call stop() before starting again, or create a new MCPClient instance.', 'MCP_ALREADY_STARTED');
|
|
71
142
|
this.name = 'MCPAlreadyStartedError';
|
|
72
143
|
Error.captureStackTrace(this, MCPAlreadyStartedError);
|
|
73
144
|
}
|
|
74
145
|
}
|
|
75
146
|
/**
|
|
76
147
|
* Error thrown when the MCP server returns an error response.
|
|
148
|
+
*
|
|
149
|
+
* Includes the operation that failed and the server error code if available.
|
|
77
150
|
*/
|
|
78
151
|
export class MCPServerError extends MCPClientError {
|
|
79
|
-
|
|
152
|
+
/** The operation that failed (e.g., "Call tool echo", "Read resource config://settings"). */
|
|
153
|
+
operation;
|
|
154
|
+
/** The MCP error code from the server response, if available. */
|
|
155
|
+
serverCode;
|
|
156
|
+
constructor(message, operation, serverCode) {
|
|
80
157
|
super(message, 'MCP_SERVER_ERROR');
|
|
81
158
|
this.name = 'MCPServerError';
|
|
159
|
+
this.operation = operation || 'unknown operation';
|
|
160
|
+
this.serverCode = serverCode;
|
|
82
161
|
Error.captureStackTrace(this, MCPServerError);
|
|
83
162
|
}
|
|
84
163
|
}
|
package/dist/utils/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,kDAAkD;IAClC,IAAI,CAAS;IAE7B,YAAY,OAAe,EAAE,OAAe,kBAAkB;QAC5D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAChD,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,OAAO,eAAgB,SAAQ,cAAc;IACjD,yCAAyC;IACzB,OAAO,CAAS;IAEhC,2EAA2E;IAC3D,SAAS,CAAS;IAElC,wDAAwD;IACxC,WAAW,CAAW;IAEtC,YAAY,OAAe,EAAE,OAAe,EAAE,SAAkB,EAAE,WAAsB;QACtF,KAAK,CAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,mBAAmB,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AG,wBAAwB,CAAC;QACrC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;IACxD,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,cAAe,SAAQ,cAAc;IAChD,6FAA6F;IAC7E,SAAS,CAAS;IAElC,iEAAiE;IACjD,UAAU,CAAmB;IAE7C,YAAY,OAAe,EAAE,SAAkB,EAAE,UAA4B;QAC3E,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,IAAI,mBAAmB,CAAC;QAClD,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAChD,CAAC;CACF"}
|
package/dist/utils/logger.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Logging utilities for MCP client.
|
|
3
3
|
*
|
|
4
|
-
* Provides configurable logging with multiple output levels
|
|
4
|
+
* Provides configurable logging with multiple output levels, secret masking,
|
|
5
|
+
* request timing, and JSON pretty-printing for protocol debugging.
|
|
6
|
+
*
|
|
7
|
+
* All log output is automatically masked to prevent sensitive data leakage.
|
|
5
8
|
*/
|
|
6
9
|
/**
|
|
7
10
|
* Supported log levels in order of verbosity.
|
|
@@ -20,44 +23,68 @@ export interface LoggerOptions {
|
|
|
20
23
|
* Prefix added to all log messages.
|
|
21
24
|
*/
|
|
22
25
|
prefix?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to mask secrets in log output.
|
|
28
|
+
* @defaultValue true
|
|
29
|
+
*/
|
|
30
|
+
maskSecrets?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to include timestamps in log messages.
|
|
33
|
+
* @defaultValue false
|
|
34
|
+
*/
|
|
35
|
+
timestamps?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to use colored output for different log levels.
|
|
38
|
+
* Colors are only used when output is a TTY (terminal).
|
|
39
|
+
* @defaultValue true
|
|
40
|
+
*/
|
|
41
|
+
colors?: boolean;
|
|
23
42
|
}
|
|
24
43
|
/**
|
|
25
44
|
* Logger interface for logging messages.
|
|
26
45
|
*/
|
|
27
46
|
export interface Logger {
|
|
28
|
-
/**
|
|
29
|
-
* Log a debug message.
|
|
30
|
-
* @param args - Message arguments to log
|
|
31
|
-
*/
|
|
47
|
+
/** Log a debug message. */
|
|
32
48
|
debug(...args: unknown[]): void;
|
|
33
|
-
/**
|
|
34
|
-
* Log an info message.
|
|
35
|
-
* @param args - Message arguments to log
|
|
36
|
-
*/
|
|
49
|
+
/** Log an info message. */
|
|
37
50
|
info(...args: unknown[]): void;
|
|
38
|
-
/**
|
|
39
|
-
* Log a warning message.
|
|
40
|
-
* @param args - Message arguments to log
|
|
41
|
-
*/
|
|
51
|
+
/** Log a warning message. */
|
|
42
52
|
warn(...args: unknown[]): void;
|
|
43
|
-
/**
|
|
44
|
-
* Log an error message.
|
|
45
|
-
* @param args - Message arguments to log
|
|
46
|
-
*/
|
|
53
|
+
/** Log an error message. */
|
|
47
54
|
error(...args: unknown[]): void;
|
|
48
55
|
}
|
|
49
56
|
/**
|
|
50
|
-
*
|
|
57
|
+
* Pretty-print a JSON-serializable value with indentation and masking.
|
|
58
|
+
*/
|
|
59
|
+
export declare function prettyPrint(value: unknown, shouldMask?: boolean): string;
|
|
60
|
+
/**
|
|
61
|
+
* Start a timer and return a function that returns elapsed milliseconds.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const elapsed = startTimer();
|
|
66
|
+
* await someOperation();
|
|
67
|
+
* logger.debug(`Operation completed in ${elapsed()}ms`);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function startTimer(): () => number;
|
|
71
|
+
/**
|
|
72
|
+
* Logger implementation that outputs to stderr with automatic secret masking,
|
|
73
|
+
* timestamps, colors, and JSON pretty-printing.
|
|
51
74
|
*
|
|
52
75
|
* @example
|
|
53
76
|
* ```typescript
|
|
54
|
-
* const logger = new ConsoleLogger({ level: 'debug', prefix: '
|
|
55
|
-
* logger.info('Starting...'); // [
|
|
77
|
+
* const logger = new ConsoleLogger({ level: 'debug', prefix: 'MCPClient' });
|
|
78
|
+
* logger.info('Starting...'); // [MCPClient] INFO: Starting...
|
|
79
|
+
* logger.info('API key:', 'sk-abc123def456ghi789'); // [MCPClient] INFO: API key: sk-ab...789
|
|
56
80
|
* ```
|
|
57
81
|
*/
|
|
58
82
|
export declare class ConsoleLogger implements Logger {
|
|
59
83
|
private level;
|
|
60
84
|
private prefix;
|
|
85
|
+
private shouldMask;
|
|
86
|
+
private useTimestamps;
|
|
87
|
+
private useColors;
|
|
61
88
|
constructor(options?: LoggerOptions);
|
|
62
89
|
private shouldLog;
|
|
63
90
|
private format;
|
|
@@ -78,9 +105,9 @@ export declare class ConsoleLogger implements Logger {
|
|
|
78
105
|
* ```
|
|
79
106
|
*/
|
|
80
107
|
export declare class NoOpLogger implements Logger {
|
|
81
|
-
debug(): void;
|
|
82
|
-
info(): void;
|
|
83
|
-
warn(): void;
|
|
84
|
-
error(): void;
|
|
108
|
+
debug(..._args: unknown[]): void;
|
|
109
|
+
info(..._args: unknown[]): void;
|
|
110
|
+
warn(..._args: unknown[]): void;
|
|
111
|
+
error(..._args: unknown[]): void;
|
|
85
112
|
}
|
|
86
113
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,G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,EAAE,OAAO,EAAE,GAAG,IAAI;IAO9B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAO9B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAMhC;AAED;;;;;;;;;;GAUG;AACH,qBAAa,UAAW,YAAW,MAAM;IACvC,KAAK,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI;IAChC,IAAI,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI;IAC/B,IAAI,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI;IAC/B,KAAK,CAAC,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI;CACjC"}
|
package/dist/utils/logger.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Logging utilities for MCP client.
|
|
3
3
|
*
|
|
4
|
-
* Provides configurable logging with multiple output levels
|
|
4
|
+
* Provides configurable logging with multiple output levels, secret masking,
|
|
5
|
+
* request timing, and JSON pretty-printing for protocol debugging.
|
|
6
|
+
*
|
|
7
|
+
* All log output is automatically masked to prevent sensitive data leakage.
|
|
5
8
|
*/
|
|
9
|
+
import { maskSecrets } from './masking.js';
|
|
6
10
|
const LOG_LEVELS = {
|
|
7
11
|
debug: 0,
|
|
8
12
|
info: 1,
|
|
@@ -11,27 +15,117 @@ const LOG_LEVELS = {
|
|
|
11
15
|
none: 99,
|
|
12
16
|
};
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
18
|
+
* ANSI color codes for terminal output.
|
|
19
|
+
* Only used when output is a TTY.
|
|
20
|
+
*/
|
|
21
|
+
const COLORS = {
|
|
22
|
+
debug: '\x1b[36m', // cyan
|
|
23
|
+
info: '\x1b[32m', // green
|
|
24
|
+
warn: '\x1b[33m', // yellow
|
|
25
|
+
error: '\x1b[31m', // red
|
|
26
|
+
dim: '\x1b[2m', // dim
|
|
27
|
+
reset: '\x1b[0m', // reset
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Check if stderr is a TTY (terminal).
|
|
31
|
+
*/
|
|
32
|
+
function isTTY() {
|
|
33
|
+
return process.stderr?.isTTY ?? false;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Colorize a string for terminal output.
|
|
37
|
+
*/
|
|
38
|
+
function colorize(text, color, useColors) {
|
|
39
|
+
if (!useColors || !isTTY())
|
|
40
|
+
return text;
|
|
41
|
+
return `${color}${text}${COLORS.reset}`;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Format a timestamp for log messages.
|
|
45
|
+
*/
|
|
46
|
+
function formatTimestamp() {
|
|
47
|
+
const now = new Date();
|
|
48
|
+
const ms = String(now.getMilliseconds()).padStart(3, '0');
|
|
49
|
+
return `${now.toISOString().slice(11, 23)}.${ms}`;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Pretty-print a JSON-serializable value with indentation and masking.
|
|
53
|
+
*/
|
|
54
|
+
export function prettyPrint(value, shouldMask = true) {
|
|
55
|
+
if (value === null || value === undefined)
|
|
56
|
+
return String(value);
|
|
57
|
+
if (typeof value === 'string') {
|
|
58
|
+
return shouldMask ? maskSecrets(value) : value;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
const json = JSON.stringify(value, null, 2);
|
|
62
|
+
return shouldMask ? maskSecrets(json) : json;
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
const str = String(value);
|
|
66
|
+
return shouldMask ? maskSecrets(str) : str;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Start a timer and return a function that returns elapsed milliseconds.
|
|
15
71
|
*
|
|
16
72
|
* @example
|
|
17
73
|
* ```typescript
|
|
18
|
-
* const
|
|
19
|
-
*
|
|
74
|
+
* const elapsed = startTimer();
|
|
75
|
+
* await someOperation();
|
|
76
|
+
* logger.debug(`Operation completed in ${elapsed()}ms`);
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export function startTimer() {
|
|
80
|
+
const start = performance.now();
|
|
81
|
+
return () => Math.round(performance.now() - start);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Mask all arguments in an array by converting to strings and masking secrets.
|
|
85
|
+
*/
|
|
86
|
+
function maskArgs(args, shouldMask) {
|
|
87
|
+
if (!shouldMask)
|
|
88
|
+
return args;
|
|
89
|
+
return args.map((arg) => (typeof arg === 'string' ? maskSecrets(arg) : maskSecrets(String(arg))));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Logger implementation that outputs to stderr with automatic secret masking,
|
|
93
|
+
* timestamps, colors, and JSON pretty-printing.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```typescript
|
|
97
|
+
* const logger = new ConsoleLogger({ level: 'debug', prefix: 'MCPClient' });
|
|
98
|
+
* logger.info('Starting...'); // [MCPClient] INFO: Starting...
|
|
99
|
+
* logger.info('API key:', 'sk-abc123def456ghi789'); // [MCPClient] INFO: API key: sk-ab...789
|
|
20
100
|
* ```
|
|
21
101
|
*/
|
|
22
102
|
export class ConsoleLogger {
|
|
23
103
|
level;
|
|
24
104
|
prefix;
|
|
105
|
+
shouldMask;
|
|
106
|
+
useTimestamps;
|
|
107
|
+
useColors;
|
|
25
108
|
constructor(options = {}) {
|
|
26
109
|
this.level = LOG_LEVELS[options.level || 'info'];
|
|
27
110
|
this.prefix = options.prefix || '';
|
|
111
|
+
this.shouldMask = options.maskSecrets !== false; // default true
|
|
112
|
+
this.useTimestamps = options.timestamps ?? false;
|
|
113
|
+
this.useColors = options.colors ?? true;
|
|
28
114
|
}
|
|
29
115
|
shouldLog(messageLevel) {
|
|
30
116
|
return LOG_LEVELS[messageLevel] >= this.level;
|
|
31
117
|
}
|
|
32
118
|
format(level, args) {
|
|
33
119
|
const prefix = this.prefix ? `[${this.prefix}] ` : '';
|
|
34
|
-
|
|
120
|
+
const levelStr = level.toUpperCase();
|
|
121
|
+
const masked = maskArgs(args, this.shouldMask);
|
|
122
|
+
const parts = [];
|
|
123
|
+
if (this.useTimestamps) {
|
|
124
|
+
parts.push(colorize(`[${formatTimestamp()}]`, COLORS.dim, this.useColors));
|
|
125
|
+
}
|
|
126
|
+
parts.push(colorize(`${prefix}${levelStr}:`, COLORS[level] || COLORS.reset, this.useColors));
|
|
127
|
+
parts.push(...masked);
|
|
128
|
+
return parts.length > 1 ? parts : [`${prefix}${levelStr}:`, ...masked];
|
|
35
129
|
}
|
|
36
130
|
debug(...args) {
|
|
37
131
|
if (this.shouldLog('debug')) {
|
|
@@ -70,9 +164,9 @@ export class ConsoleLogger {
|
|
|
70
164
|
* ```
|
|
71
165
|
*/
|
|
72
166
|
export class NoOpLogger {
|
|
73
|
-
debug() { }
|
|
74
|
-
info() { }
|
|
75
|
-
warn() { }
|
|
76
|
-
error() { }
|
|
167
|
+
debug(..._args) { }
|
|
168
|
+
info(..._args) { }
|
|
169
|
+
warn(..._args) { }
|
|
170
|
+
error(..._args) { }
|
|
77
171
|
}
|
|
78
172
|
//# sourceMappingURL=logger.js.map
|
package/dist/utils/logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAoD3C,MAAM,UAAU,GAA6B;IAC3C,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,EAAE;CACT,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,GAA2B;IACrC,KAAK,EAAE,UAAU,EAAE,OAAO;IAC1B,IAAI,EAAE,UAAU,EA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AAE,CAAC;YAC5B,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED,IAAI,CAAC,GAAG,IAAe;QACrB,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3B,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,IAAI,CAAC,GAAG,IAAe;QACrB,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3B,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;IAED,KAAK,CAAC,GAAG,IAAe;QACtB,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,sCAAsC;YACtC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,UAAU;IACrB,KAAK,CAAC,GAAG,KAAgB,IAAS,CAAC;IACnC,IAAI,CAAC,GAAG,KAAgB,IAAS,CAAC;IAClC,IAAI,CAAC,GAAG,KAAgB,IAAS,CAAC;IAClC,KAAK,CAAC,GAAG,KAAgB,IAAS,CAAC;CACpC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Secret masking utility for preventing sensitive data from appearing in logs.
|
|
3
|
+
*
|
|
4
|
+
* Automatically detects and masks common secret patterns like API keys,
|
|
5
|
+
* tokens, passwords, and connection strings. Also masks values of known
|
|
6
|
+
* sensitive environment variable keys.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { maskSecrets, addSecretPattern } from '@slbdn/mcp-tester';
|
|
11
|
+
*
|
|
12
|
+
* // Built-in patterns are applied automatically
|
|
13
|
+
* maskSecrets('API key: sk-abc123def456ghi789');
|
|
14
|
+
* // → 'API key: sk-ab...789'
|
|
15
|
+
*
|
|
16
|
+
* // Add custom patterns
|
|
17
|
+
* addSecretPattern(/my-secret-key-[a-zA-Z0-9]+/g, 'MyOrg API key');
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* A secret masking pattern with a regex and human-readable name.
|
|
22
|
+
*/
|
|
23
|
+
export interface SecretPattern {
|
|
24
|
+
/** Regex pattern to match secrets. */
|
|
25
|
+
pattern: RegExp;
|
|
26
|
+
/** Human-readable name for the pattern (used in diagnostics). */
|
|
27
|
+
name: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Mask a string value, keeping the first few and last few characters visible
|
|
31
|
+
* and replacing the rest with `...`.
|
|
32
|
+
*
|
|
33
|
+
* @param value - The secret value to mask
|
|
34
|
+
* @param visibleChars - How many characters to keep visible at start and end
|
|
35
|
+
* @returns Masked string like "sk-ab...789"
|
|
36
|
+
*/
|
|
37
|
+
export declare function maskValue(value: string, visibleChars?: number): string;
|
|
38
|
+
/**
|
|
39
|
+
* Mask secrets in a string by applying all active secret patterns
|
|
40
|
+
* and masking values of known sensitive environment variable keys.
|
|
41
|
+
*
|
|
42
|
+
* @param input - The value to mask (any type — converted to string)
|
|
43
|
+
* @returns String with secrets replaced by masked versions
|
|
44
|
+
*/
|
|
45
|
+
export declare function maskSecrets(input: unknown): string;
|
|
46
|
+
/**
|
|
47
|
+
* Add a custom secret pattern to the masking rules.
|
|
48
|
+
*
|
|
49
|
+
* @param pattern - Regex pattern to match secrets
|
|
50
|
+
* @param name - Human-readable name for the pattern
|
|
51
|
+
*/
|
|
52
|
+
export declare function addSecretPattern(pattern: RegExp, name?: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Reset all secret patterns to the built-in defaults.
|
|
55
|
+
* Removes any patterns added via `addSecretPattern()`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function resetSecretPatterns(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Get the list of currently active secret patterns.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getSecretPatterns(): SecretPattern[];
|
|
62
|
+
/**
|
|
63
|
+
* Get the set of sensitive environment variable key names.
|
|
64
|
+
*/
|
|
65
|
+
export declare function getSensitiveEnvKeys(): ReadonlySet<string>;
|
|
66
|
+
//# sourceMappingURL=masking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"masking.d.ts","sourceRoot":"","sources":["../../src/utils/masking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;CACd;AAuFD;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,GAAE,MAAsB,GAAG,MAAM,CAOrF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA2BlD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAiB,GAAG,IAAI,CAE/E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,EAAE,CAEnD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,WAAW,CAAC,MAAM,CAAC,CAEzD"}
|