@leanmcp/core 0.3.13 → 0.3.15
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 +1 -1
- package/dist/index.d.mts +131 -126
- package/dist/index.d.ts +131 -126
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,133 @@
|
|
|
1
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Simple configurable logger for LeanMCP SDK
|
|
5
|
+
*/
|
|
6
|
+
declare enum LogLevel {
|
|
7
|
+
DEBUG = 0,
|
|
8
|
+
INFO = 1,
|
|
9
|
+
WARN = 2,
|
|
10
|
+
ERROR = 3,
|
|
11
|
+
NONE = 4
|
|
12
|
+
}
|
|
13
|
+
interface LoggerOptions {
|
|
14
|
+
level?: LogLevel;
|
|
15
|
+
prefix?: string;
|
|
16
|
+
timestamps?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Enable or disable ANSI colors. Defaults to true.
|
|
19
|
+
*/
|
|
20
|
+
colorize?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Provide additional metadata context (e.g. module name)
|
|
23
|
+
*/
|
|
24
|
+
context?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional third-party handlers (PostHog, Sentry, etc.)
|
|
27
|
+
* They receive the structured payload for easy integration.
|
|
28
|
+
*/
|
|
29
|
+
handlers?: LoggerHandler[];
|
|
30
|
+
}
|
|
31
|
+
interface LogPayload {
|
|
32
|
+
level: LogLevel;
|
|
33
|
+
levelLabel: string;
|
|
34
|
+
message: string;
|
|
35
|
+
args: any[];
|
|
36
|
+
prefix?: string;
|
|
37
|
+
context?: string;
|
|
38
|
+
timestamp: string;
|
|
39
|
+
}
|
|
40
|
+
type LoggerHandler = (payload: LogPayload) => void;
|
|
41
|
+
declare class Logger {
|
|
42
|
+
private level;
|
|
43
|
+
private prefix;
|
|
44
|
+
private timestamps;
|
|
45
|
+
private colorize;
|
|
46
|
+
private context?;
|
|
47
|
+
private handlers;
|
|
48
|
+
constructor(options?: LoggerOptions);
|
|
49
|
+
private format;
|
|
50
|
+
private shouldLog;
|
|
51
|
+
private emit;
|
|
52
|
+
debug(message: string, ...args: any[]): void;
|
|
53
|
+
info(message: string, ...args: any[]): void;
|
|
54
|
+
warn(message: string, ...args: any[]): void;
|
|
55
|
+
error(message: string, ...args: any[]): void;
|
|
56
|
+
setLevel(level: LogLevel): void;
|
|
57
|
+
getLevel(): LogLevel;
|
|
58
|
+
}
|
|
59
|
+
declare const defaultLogger: Logger;
|
|
60
|
+
|
|
61
|
+
interface HTTPServerOptions {
|
|
62
|
+
port?: number;
|
|
63
|
+
cors?: boolean | {
|
|
64
|
+
origin?: string | string[];
|
|
65
|
+
credentials?: boolean;
|
|
66
|
+
};
|
|
67
|
+
logging?: boolean;
|
|
68
|
+
logger?: Logger;
|
|
69
|
+
sessionTimeout?: number;
|
|
70
|
+
stateless?: boolean;
|
|
71
|
+
dashboard?: boolean;
|
|
72
|
+
/** OAuth/Auth configuration (MCP authorization spec) */
|
|
73
|
+
auth?: HTTPServerAuthOptions;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* OAuth/Auth configuration for MCP server
|
|
77
|
+
*
|
|
78
|
+
* Enables MCP authorization spec compliance by exposing
|
|
79
|
+
* `/.well-known/oauth-protected-resource` (RFC 9728)
|
|
80
|
+
*/
|
|
81
|
+
interface HTTPServerAuthOptions {
|
|
82
|
+
/** Resource identifier (defaults to server URL) */
|
|
83
|
+
resource?: string;
|
|
84
|
+
/** Authorization servers (defaults to self) */
|
|
85
|
+
authorizationServers?: string[];
|
|
86
|
+
/** Supported OAuth scopes */
|
|
87
|
+
scopesSupported?: string[];
|
|
88
|
+
/** Documentation URL */
|
|
89
|
+
documentationUrl?: string;
|
|
90
|
+
/** Enable built-in OAuth authorization server */
|
|
91
|
+
enableOAuthServer?: boolean;
|
|
92
|
+
/** OAuth server options (when enableOAuthServer is true) */
|
|
93
|
+
oauthServerOptions?: {
|
|
94
|
+
/** Session secret for signing tokens/state */
|
|
95
|
+
sessionSecret: string;
|
|
96
|
+
/** JWT signing secret (defaults to sessionSecret if not provided) */
|
|
97
|
+
jwtSigningSecret?: string;
|
|
98
|
+
/** JWT encryption secret for encrypting upstream tokens */
|
|
99
|
+
jwtEncryptionSecret?: Buffer;
|
|
100
|
+
/** Issuer URL for JWTs */
|
|
101
|
+
issuer?: string;
|
|
102
|
+
/** Access token TTL in seconds (default: 3600) */
|
|
103
|
+
tokenTTL?: number;
|
|
104
|
+
/** Enable Dynamic Client Registration (for ChatGPT etc.) */
|
|
105
|
+
enableDCR?: boolean;
|
|
106
|
+
/** Upstream OAuth provider configuration */
|
|
107
|
+
upstreamProvider?: {
|
|
108
|
+
id: string;
|
|
109
|
+
authorizationEndpoint: string;
|
|
110
|
+
tokenEndpoint: string;
|
|
111
|
+
clientId: string;
|
|
112
|
+
clientSecret: string;
|
|
113
|
+
scopes?: string[];
|
|
114
|
+
userInfoEndpoint?: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
interface MCPServerFactory {
|
|
119
|
+
(): Server | Promise<Server>;
|
|
120
|
+
}
|
|
121
|
+
type HTTPServerInput = MCPServerFactory | MCPServerConstructorOptions;
|
|
122
|
+
/**
|
|
123
|
+
* Create an HTTP server for MCP with Streamable HTTP transport
|
|
124
|
+
* Returns the HTTP server instance to keep the process alive
|
|
125
|
+
*
|
|
126
|
+
* @param serverInput - Either MCPServerConstructorOptions or a factory function that returns a Server
|
|
127
|
+
* @param options - HTTP server options (only used when serverInput is a factory function)
|
|
128
|
+
*/
|
|
129
|
+
declare function createHTTPServer(serverInput: HTTPServerInput, options?: HTTPServerOptions): Promise<any>;
|
|
130
|
+
|
|
3
131
|
/**
|
|
4
132
|
* Security scheme for MCP tools (per MCP authorization spec)
|
|
5
133
|
*
|
|
@@ -220,132 +348,6 @@ declare function SchemaConstraint(constraints: {
|
|
|
220
348
|
*/
|
|
221
349
|
declare function classToJsonSchemaWithConstraints(classConstructor: new () => any): any;
|
|
222
350
|
|
|
223
|
-
/**
|
|
224
|
-
* Simple configurable logger for LeanMCP SDK
|
|
225
|
-
*/
|
|
226
|
-
declare enum LogLevel {
|
|
227
|
-
DEBUG = 0,
|
|
228
|
-
INFO = 1,
|
|
229
|
-
WARN = 2,
|
|
230
|
-
ERROR = 3,
|
|
231
|
-
NONE = 4
|
|
232
|
-
}
|
|
233
|
-
interface LoggerOptions {
|
|
234
|
-
level?: LogLevel;
|
|
235
|
-
prefix?: string;
|
|
236
|
-
timestamps?: boolean;
|
|
237
|
-
/**
|
|
238
|
-
* Enable or disable ANSI colors. Defaults to true.
|
|
239
|
-
*/
|
|
240
|
-
colorize?: boolean;
|
|
241
|
-
/**
|
|
242
|
-
* Provide additional metadata context (e.g. module name)
|
|
243
|
-
*/
|
|
244
|
-
context?: string;
|
|
245
|
-
/**
|
|
246
|
-
* Optional third-party handlers (PostHog, Sentry, etc.)
|
|
247
|
-
* They receive the structured payload for easy integration.
|
|
248
|
-
*/
|
|
249
|
-
handlers?: LoggerHandler[];
|
|
250
|
-
}
|
|
251
|
-
interface LogPayload {
|
|
252
|
-
level: LogLevel;
|
|
253
|
-
levelLabel: string;
|
|
254
|
-
message: string;
|
|
255
|
-
args: any[];
|
|
256
|
-
prefix?: string;
|
|
257
|
-
context?: string;
|
|
258
|
-
timestamp: string;
|
|
259
|
-
}
|
|
260
|
-
type LoggerHandler = (payload: LogPayload) => void;
|
|
261
|
-
declare class Logger {
|
|
262
|
-
private level;
|
|
263
|
-
private prefix;
|
|
264
|
-
private timestamps;
|
|
265
|
-
private colorize;
|
|
266
|
-
private context?;
|
|
267
|
-
private handlers;
|
|
268
|
-
constructor(options?: LoggerOptions);
|
|
269
|
-
private format;
|
|
270
|
-
private shouldLog;
|
|
271
|
-
private emit;
|
|
272
|
-
debug(message: string, ...args: any[]): void;
|
|
273
|
-
info(message: string, ...args: any[]): void;
|
|
274
|
-
warn(message: string, ...args: any[]): void;
|
|
275
|
-
error(message: string, ...args: any[]): void;
|
|
276
|
-
setLevel(level: LogLevel): void;
|
|
277
|
-
getLevel(): LogLevel;
|
|
278
|
-
}
|
|
279
|
-
declare const defaultLogger: Logger;
|
|
280
|
-
|
|
281
|
-
interface HTTPServerOptions {
|
|
282
|
-
port?: number;
|
|
283
|
-
cors?: boolean | {
|
|
284
|
-
origin?: string | string[];
|
|
285
|
-
credentials?: boolean;
|
|
286
|
-
};
|
|
287
|
-
logging?: boolean;
|
|
288
|
-
logger?: Logger;
|
|
289
|
-
sessionTimeout?: number;
|
|
290
|
-
stateless?: boolean;
|
|
291
|
-
dashboard?: boolean;
|
|
292
|
-
/** OAuth/Auth configuration (MCP authorization spec) */
|
|
293
|
-
auth?: HTTPServerAuthOptions;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* OAuth/Auth configuration for MCP server
|
|
297
|
-
*
|
|
298
|
-
* Enables MCP authorization spec compliance by exposing
|
|
299
|
-
* `/.well-known/oauth-protected-resource` (RFC 9728)
|
|
300
|
-
*/
|
|
301
|
-
interface HTTPServerAuthOptions {
|
|
302
|
-
/** Resource identifier (defaults to server URL) */
|
|
303
|
-
resource?: string;
|
|
304
|
-
/** Authorization servers (defaults to self) */
|
|
305
|
-
authorizationServers?: string[];
|
|
306
|
-
/** Supported OAuth scopes */
|
|
307
|
-
scopesSupported?: string[];
|
|
308
|
-
/** Documentation URL */
|
|
309
|
-
documentationUrl?: string;
|
|
310
|
-
/** Enable built-in OAuth authorization server */
|
|
311
|
-
enableOAuthServer?: boolean;
|
|
312
|
-
/** OAuth server options (when enableOAuthServer is true) */
|
|
313
|
-
oauthServerOptions?: {
|
|
314
|
-
/** Session secret for signing tokens/state */
|
|
315
|
-
sessionSecret: string;
|
|
316
|
-
/** JWT signing secret (defaults to sessionSecret if not provided) */
|
|
317
|
-
jwtSigningSecret?: string;
|
|
318
|
-
/** JWT encryption secret for encrypting upstream tokens */
|
|
319
|
-
jwtEncryptionSecret?: Buffer;
|
|
320
|
-
/** Issuer URL for JWTs */
|
|
321
|
-
issuer?: string;
|
|
322
|
-
/** Access token TTL in seconds (default: 3600) */
|
|
323
|
-
tokenTTL?: number;
|
|
324
|
-
/** Upstream OAuth provider configuration */
|
|
325
|
-
upstreamProvider?: {
|
|
326
|
-
id: string;
|
|
327
|
-
authorizationEndpoint: string;
|
|
328
|
-
tokenEndpoint: string;
|
|
329
|
-
clientId: string;
|
|
330
|
-
clientSecret: string;
|
|
331
|
-
scopes?: string[];
|
|
332
|
-
userInfoEndpoint?: string;
|
|
333
|
-
};
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
interface MCPServerFactory {
|
|
337
|
-
(): Server | Promise<Server>;
|
|
338
|
-
}
|
|
339
|
-
type HTTPServerInput = MCPServerFactory | MCPServerConstructorOptions;
|
|
340
|
-
/**
|
|
341
|
-
* Create an HTTP server for MCP with Streamable HTTP transport
|
|
342
|
-
* Returns the HTTP server instance to keep the process alive
|
|
343
|
-
*
|
|
344
|
-
* @param serverInput - Either MCPServerConstructorOptions or a factory function that returns a Server
|
|
345
|
-
* @param options - HTTP server options (only used when serverInput is a factory function)
|
|
346
|
-
*/
|
|
347
|
-
declare function createHTTPServer(serverInput: HTTPServerInput, options?: HTTPServerOptions): Promise<any>;
|
|
348
|
-
|
|
349
351
|
/**
|
|
350
352
|
* Input validation utilities for LeanMCP
|
|
351
353
|
* Provides secure validation for common input types
|
|
@@ -549,6 +551,9 @@ interface MCPServerConstructorOptions {
|
|
|
549
551
|
};
|
|
550
552
|
sessionTimeout?: number;
|
|
551
553
|
stateless?: boolean;
|
|
554
|
+
dashboard?: boolean;
|
|
555
|
+
/** OAuth/Auth configuration (MCP authorization spec) - passed to HTTPServerOptions */
|
|
556
|
+
auth?: HTTPServerAuthOptions;
|
|
552
557
|
}
|
|
553
558
|
interface RegisteredTool {
|
|
554
559
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,133 @@
|
|
|
1
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Simple configurable logger for LeanMCP SDK
|
|
5
|
+
*/
|
|
6
|
+
declare enum LogLevel {
|
|
7
|
+
DEBUG = 0,
|
|
8
|
+
INFO = 1,
|
|
9
|
+
WARN = 2,
|
|
10
|
+
ERROR = 3,
|
|
11
|
+
NONE = 4
|
|
12
|
+
}
|
|
13
|
+
interface LoggerOptions {
|
|
14
|
+
level?: LogLevel;
|
|
15
|
+
prefix?: string;
|
|
16
|
+
timestamps?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Enable or disable ANSI colors. Defaults to true.
|
|
19
|
+
*/
|
|
20
|
+
colorize?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Provide additional metadata context (e.g. module name)
|
|
23
|
+
*/
|
|
24
|
+
context?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional third-party handlers (PostHog, Sentry, etc.)
|
|
27
|
+
* They receive the structured payload for easy integration.
|
|
28
|
+
*/
|
|
29
|
+
handlers?: LoggerHandler[];
|
|
30
|
+
}
|
|
31
|
+
interface LogPayload {
|
|
32
|
+
level: LogLevel;
|
|
33
|
+
levelLabel: string;
|
|
34
|
+
message: string;
|
|
35
|
+
args: any[];
|
|
36
|
+
prefix?: string;
|
|
37
|
+
context?: string;
|
|
38
|
+
timestamp: string;
|
|
39
|
+
}
|
|
40
|
+
type LoggerHandler = (payload: LogPayload) => void;
|
|
41
|
+
declare class Logger {
|
|
42
|
+
private level;
|
|
43
|
+
private prefix;
|
|
44
|
+
private timestamps;
|
|
45
|
+
private colorize;
|
|
46
|
+
private context?;
|
|
47
|
+
private handlers;
|
|
48
|
+
constructor(options?: LoggerOptions);
|
|
49
|
+
private format;
|
|
50
|
+
private shouldLog;
|
|
51
|
+
private emit;
|
|
52
|
+
debug(message: string, ...args: any[]): void;
|
|
53
|
+
info(message: string, ...args: any[]): void;
|
|
54
|
+
warn(message: string, ...args: any[]): void;
|
|
55
|
+
error(message: string, ...args: any[]): void;
|
|
56
|
+
setLevel(level: LogLevel): void;
|
|
57
|
+
getLevel(): LogLevel;
|
|
58
|
+
}
|
|
59
|
+
declare const defaultLogger: Logger;
|
|
60
|
+
|
|
61
|
+
interface HTTPServerOptions {
|
|
62
|
+
port?: number;
|
|
63
|
+
cors?: boolean | {
|
|
64
|
+
origin?: string | string[];
|
|
65
|
+
credentials?: boolean;
|
|
66
|
+
};
|
|
67
|
+
logging?: boolean;
|
|
68
|
+
logger?: Logger;
|
|
69
|
+
sessionTimeout?: number;
|
|
70
|
+
stateless?: boolean;
|
|
71
|
+
dashboard?: boolean;
|
|
72
|
+
/** OAuth/Auth configuration (MCP authorization spec) */
|
|
73
|
+
auth?: HTTPServerAuthOptions;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* OAuth/Auth configuration for MCP server
|
|
77
|
+
*
|
|
78
|
+
* Enables MCP authorization spec compliance by exposing
|
|
79
|
+
* `/.well-known/oauth-protected-resource` (RFC 9728)
|
|
80
|
+
*/
|
|
81
|
+
interface HTTPServerAuthOptions {
|
|
82
|
+
/** Resource identifier (defaults to server URL) */
|
|
83
|
+
resource?: string;
|
|
84
|
+
/** Authorization servers (defaults to self) */
|
|
85
|
+
authorizationServers?: string[];
|
|
86
|
+
/** Supported OAuth scopes */
|
|
87
|
+
scopesSupported?: string[];
|
|
88
|
+
/** Documentation URL */
|
|
89
|
+
documentationUrl?: string;
|
|
90
|
+
/** Enable built-in OAuth authorization server */
|
|
91
|
+
enableOAuthServer?: boolean;
|
|
92
|
+
/** OAuth server options (when enableOAuthServer is true) */
|
|
93
|
+
oauthServerOptions?: {
|
|
94
|
+
/** Session secret for signing tokens/state */
|
|
95
|
+
sessionSecret: string;
|
|
96
|
+
/** JWT signing secret (defaults to sessionSecret if not provided) */
|
|
97
|
+
jwtSigningSecret?: string;
|
|
98
|
+
/** JWT encryption secret for encrypting upstream tokens */
|
|
99
|
+
jwtEncryptionSecret?: Buffer;
|
|
100
|
+
/** Issuer URL for JWTs */
|
|
101
|
+
issuer?: string;
|
|
102
|
+
/** Access token TTL in seconds (default: 3600) */
|
|
103
|
+
tokenTTL?: number;
|
|
104
|
+
/** Enable Dynamic Client Registration (for ChatGPT etc.) */
|
|
105
|
+
enableDCR?: boolean;
|
|
106
|
+
/** Upstream OAuth provider configuration */
|
|
107
|
+
upstreamProvider?: {
|
|
108
|
+
id: string;
|
|
109
|
+
authorizationEndpoint: string;
|
|
110
|
+
tokenEndpoint: string;
|
|
111
|
+
clientId: string;
|
|
112
|
+
clientSecret: string;
|
|
113
|
+
scopes?: string[];
|
|
114
|
+
userInfoEndpoint?: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
interface MCPServerFactory {
|
|
119
|
+
(): Server | Promise<Server>;
|
|
120
|
+
}
|
|
121
|
+
type HTTPServerInput = MCPServerFactory | MCPServerConstructorOptions;
|
|
122
|
+
/**
|
|
123
|
+
* Create an HTTP server for MCP with Streamable HTTP transport
|
|
124
|
+
* Returns the HTTP server instance to keep the process alive
|
|
125
|
+
*
|
|
126
|
+
* @param serverInput - Either MCPServerConstructorOptions or a factory function that returns a Server
|
|
127
|
+
* @param options - HTTP server options (only used when serverInput is a factory function)
|
|
128
|
+
*/
|
|
129
|
+
declare function createHTTPServer(serverInput: HTTPServerInput, options?: HTTPServerOptions): Promise<any>;
|
|
130
|
+
|
|
3
131
|
/**
|
|
4
132
|
* Security scheme for MCP tools (per MCP authorization spec)
|
|
5
133
|
*
|
|
@@ -220,132 +348,6 @@ declare function SchemaConstraint(constraints: {
|
|
|
220
348
|
*/
|
|
221
349
|
declare function classToJsonSchemaWithConstraints(classConstructor: new () => any): any;
|
|
222
350
|
|
|
223
|
-
/**
|
|
224
|
-
* Simple configurable logger for LeanMCP SDK
|
|
225
|
-
*/
|
|
226
|
-
declare enum LogLevel {
|
|
227
|
-
DEBUG = 0,
|
|
228
|
-
INFO = 1,
|
|
229
|
-
WARN = 2,
|
|
230
|
-
ERROR = 3,
|
|
231
|
-
NONE = 4
|
|
232
|
-
}
|
|
233
|
-
interface LoggerOptions {
|
|
234
|
-
level?: LogLevel;
|
|
235
|
-
prefix?: string;
|
|
236
|
-
timestamps?: boolean;
|
|
237
|
-
/**
|
|
238
|
-
* Enable or disable ANSI colors. Defaults to true.
|
|
239
|
-
*/
|
|
240
|
-
colorize?: boolean;
|
|
241
|
-
/**
|
|
242
|
-
* Provide additional metadata context (e.g. module name)
|
|
243
|
-
*/
|
|
244
|
-
context?: string;
|
|
245
|
-
/**
|
|
246
|
-
* Optional third-party handlers (PostHog, Sentry, etc.)
|
|
247
|
-
* They receive the structured payload for easy integration.
|
|
248
|
-
*/
|
|
249
|
-
handlers?: LoggerHandler[];
|
|
250
|
-
}
|
|
251
|
-
interface LogPayload {
|
|
252
|
-
level: LogLevel;
|
|
253
|
-
levelLabel: string;
|
|
254
|
-
message: string;
|
|
255
|
-
args: any[];
|
|
256
|
-
prefix?: string;
|
|
257
|
-
context?: string;
|
|
258
|
-
timestamp: string;
|
|
259
|
-
}
|
|
260
|
-
type LoggerHandler = (payload: LogPayload) => void;
|
|
261
|
-
declare class Logger {
|
|
262
|
-
private level;
|
|
263
|
-
private prefix;
|
|
264
|
-
private timestamps;
|
|
265
|
-
private colorize;
|
|
266
|
-
private context?;
|
|
267
|
-
private handlers;
|
|
268
|
-
constructor(options?: LoggerOptions);
|
|
269
|
-
private format;
|
|
270
|
-
private shouldLog;
|
|
271
|
-
private emit;
|
|
272
|
-
debug(message: string, ...args: any[]): void;
|
|
273
|
-
info(message: string, ...args: any[]): void;
|
|
274
|
-
warn(message: string, ...args: any[]): void;
|
|
275
|
-
error(message: string, ...args: any[]): void;
|
|
276
|
-
setLevel(level: LogLevel): void;
|
|
277
|
-
getLevel(): LogLevel;
|
|
278
|
-
}
|
|
279
|
-
declare const defaultLogger: Logger;
|
|
280
|
-
|
|
281
|
-
interface HTTPServerOptions {
|
|
282
|
-
port?: number;
|
|
283
|
-
cors?: boolean | {
|
|
284
|
-
origin?: string | string[];
|
|
285
|
-
credentials?: boolean;
|
|
286
|
-
};
|
|
287
|
-
logging?: boolean;
|
|
288
|
-
logger?: Logger;
|
|
289
|
-
sessionTimeout?: number;
|
|
290
|
-
stateless?: boolean;
|
|
291
|
-
dashboard?: boolean;
|
|
292
|
-
/** OAuth/Auth configuration (MCP authorization spec) */
|
|
293
|
-
auth?: HTTPServerAuthOptions;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* OAuth/Auth configuration for MCP server
|
|
297
|
-
*
|
|
298
|
-
* Enables MCP authorization spec compliance by exposing
|
|
299
|
-
* `/.well-known/oauth-protected-resource` (RFC 9728)
|
|
300
|
-
*/
|
|
301
|
-
interface HTTPServerAuthOptions {
|
|
302
|
-
/** Resource identifier (defaults to server URL) */
|
|
303
|
-
resource?: string;
|
|
304
|
-
/** Authorization servers (defaults to self) */
|
|
305
|
-
authorizationServers?: string[];
|
|
306
|
-
/** Supported OAuth scopes */
|
|
307
|
-
scopesSupported?: string[];
|
|
308
|
-
/** Documentation URL */
|
|
309
|
-
documentationUrl?: string;
|
|
310
|
-
/** Enable built-in OAuth authorization server */
|
|
311
|
-
enableOAuthServer?: boolean;
|
|
312
|
-
/** OAuth server options (when enableOAuthServer is true) */
|
|
313
|
-
oauthServerOptions?: {
|
|
314
|
-
/** Session secret for signing tokens/state */
|
|
315
|
-
sessionSecret: string;
|
|
316
|
-
/** JWT signing secret (defaults to sessionSecret if not provided) */
|
|
317
|
-
jwtSigningSecret?: string;
|
|
318
|
-
/** JWT encryption secret for encrypting upstream tokens */
|
|
319
|
-
jwtEncryptionSecret?: Buffer;
|
|
320
|
-
/** Issuer URL for JWTs */
|
|
321
|
-
issuer?: string;
|
|
322
|
-
/** Access token TTL in seconds (default: 3600) */
|
|
323
|
-
tokenTTL?: number;
|
|
324
|
-
/** Upstream OAuth provider configuration */
|
|
325
|
-
upstreamProvider?: {
|
|
326
|
-
id: string;
|
|
327
|
-
authorizationEndpoint: string;
|
|
328
|
-
tokenEndpoint: string;
|
|
329
|
-
clientId: string;
|
|
330
|
-
clientSecret: string;
|
|
331
|
-
scopes?: string[];
|
|
332
|
-
userInfoEndpoint?: string;
|
|
333
|
-
};
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
interface MCPServerFactory {
|
|
337
|
-
(): Server | Promise<Server>;
|
|
338
|
-
}
|
|
339
|
-
type HTTPServerInput = MCPServerFactory | MCPServerConstructorOptions;
|
|
340
|
-
/**
|
|
341
|
-
* Create an HTTP server for MCP with Streamable HTTP transport
|
|
342
|
-
* Returns the HTTP server instance to keep the process alive
|
|
343
|
-
*
|
|
344
|
-
* @param serverInput - Either MCPServerConstructorOptions or a factory function that returns a Server
|
|
345
|
-
* @param options - HTTP server options (only used when serverInput is a factory function)
|
|
346
|
-
*/
|
|
347
|
-
declare function createHTTPServer(serverInput: HTTPServerInput, options?: HTTPServerOptions): Promise<any>;
|
|
348
|
-
|
|
349
351
|
/**
|
|
350
352
|
* Input validation utilities for LeanMCP
|
|
351
353
|
* Provides secure validation for common input types
|
|
@@ -549,6 +551,9 @@ interface MCPServerConstructorOptions {
|
|
|
549
551
|
};
|
|
550
552
|
sessionTimeout?: number;
|
|
551
553
|
stateless?: boolean;
|
|
554
|
+
dashboard?: boolean;
|
|
555
|
+
/** OAuth/Auth configuration (MCP authorization spec) - passed to HTTPServerOptions */
|
|
556
|
+
auth?: HTTPServerAuthOptions;
|
|
552
557
|
}
|
|
553
558
|
interface RegisteredTool {
|
|
554
559
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leanmcp/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.15",
|
|
4
4
|
"description": "Core library implementing decorators, reflection, and MCP runtime server",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -74,4 +74,4 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
}
|
|
77
|
-
}
|
|
77
|
+
}
|