@1mcp/agent 0.31.0-beta1 → 0.31.0-beta2
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/build/commands/mcp/add.d.ts.map +1 -1
- package/build/commands/mcp/add.js +21 -2
- package/build/commands/mcp/add.js.map +1 -1
- package/build/commands/mcp/index.d.ts.map +1 -1
- package/build/commands/mcp/index.js +5 -4
- package/build/commands/mcp/index.js.map +1 -1
- package/build/commands/mcp/list.d.ts.map +1 -1
- package/build/commands/mcp/list.js +52 -8
- package/build/commands/mcp/list.js.map +1 -1
- package/build/commands/mcp/status.d.ts.map +1 -1
- package/build/commands/mcp/status.js +59 -26
- package/build/commands/mcp/status.js.map +1 -1
- package/build/commands/serve/index.d.ts +0 -22
- package/build/commands/serve/index.d.ts.map +1 -1
- package/build/commands/serve/index.js +0 -23
- package/build/commands/serve/index.js.map +1 -1
- package/build/commands/serve/serve.d.ts +23 -23
- package/build/commands/serve/serve.d.ts.map +1 -1
- package/build/commands/serve/serve.js +67 -51
- package/build/commands/serve/serve.js.map +1 -1
- package/build/commands/shared/baseConfigUtils.d.ts +15 -1
- package/build/commands/shared/baseConfigUtils.d.ts.map +1 -1
- package/build/commands/shared/baseConfigUtils.js +146 -41
- package/build/commands/shared/baseConfigUtils.js.map +1 -1
- package/build/config/configLoader.d.ts +28 -2
- package/build/config/configLoader.d.ts.map +1 -1
- package/build/config/configLoader.js +155 -28
- package/build/config/configLoader.js.map +1 -1
- package/build/config/configManager.d.ts +2 -1
- package/build/config/configManager.d.ts.map +1 -1
- package/build/config/configManager.js +20 -4
- package/build/config/configManager.js.map +1 -1
- package/build/config/mcpConfigManager.d.ts +18 -5
- package/build/config/mcpConfigManager.d.ts.map +1 -1
- package/build/config/mcpConfigManager.js +51 -44
- package/build/config/mcpConfigManager.js.map +1 -1
- package/build/config/mcpConfigMerge.d.ts +15 -0
- package/build/config/mcpConfigMerge.d.ts.map +1 -0
- package/build/config/mcpConfigMerge.js +87 -0
- package/build/config/mcpConfigMerge.js.map +1 -0
- package/build/constants/mcp.d.ts +2 -1
- package/build/constants/mcp.d.ts.map +1 -1
- package/build/constants/mcp.js +2 -1
- package/build/constants/mcp.js.map +1 -1
- package/build/constants/paths.d.ts +5 -0
- package/build/constants/paths.d.ts.map +1 -1
- package/build/constants/paths.js +9 -1
- package/build/constants/paths.js.map +1 -1
- package/build/core/tools/handlers/serverManagementHandler.d.ts +5 -0
- package/build/core/tools/handlers/serverManagementHandler.d.ts.map +1 -1
- package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts +1 -0
- package/build/core/tools/internal/adapters/helpers/configTransformers.d.ts.map +1 -1
- package/build/core/types/transport.d.ts +146 -0
- package/build/core/types/transport.d.ts.map +1 -1
- package/build/core/types/transport.js +75 -0
- package/build/core/types/transport.js.map +1 -1
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -3
- package/build/index.js.map +1 -1
- package/build/utils/cli/normalizedArgv.d.ts +3 -0
- package/build/utils/cli/normalizedArgv.d.ts.map +1 -0
- package/build/utils/cli/normalizedArgv.js +9 -0
- package/build/utils/cli/normalizedArgv.js.map +1 -0
- package/build/utils/validation/urlDetection.d.ts.map +1 -1
- package/build/utils/validation/urlDetection.js +2 -1
- package/build/utils/validation/urlDetection.js.map +1 -1
- package/package.json +4 -3
|
@@ -10,19 +10,16 @@ export declare const serverOptions: {
|
|
|
10
10
|
describe: string;
|
|
11
11
|
type: "string";
|
|
12
12
|
choices: readonly ["stdio", "http", "sse"];
|
|
13
|
-
default: string;
|
|
14
13
|
};
|
|
15
14
|
port: {
|
|
16
15
|
alias: string;
|
|
17
16
|
describe: string;
|
|
18
17
|
type: "number";
|
|
19
|
-
default: number;
|
|
20
18
|
};
|
|
21
19
|
host: {
|
|
22
20
|
alias: string;
|
|
23
21
|
describe: string;
|
|
24
22
|
type: "string";
|
|
25
|
-
default: string;
|
|
26
23
|
};
|
|
27
24
|
'external-url': {
|
|
28
25
|
alias: string;
|
|
@@ -45,27 +42,22 @@ export declare const serverOptions: {
|
|
|
45
42
|
auth: {
|
|
46
43
|
describe: string;
|
|
47
44
|
type: "boolean";
|
|
48
|
-
default: boolean;
|
|
49
45
|
};
|
|
50
46
|
'enable-auth': {
|
|
51
47
|
describe: string;
|
|
52
48
|
type: "boolean";
|
|
53
|
-
default: boolean;
|
|
54
49
|
};
|
|
55
50
|
'enable-scope-validation': {
|
|
56
51
|
describe: string;
|
|
57
52
|
type: "boolean";
|
|
58
|
-
default: boolean;
|
|
59
53
|
};
|
|
60
54
|
'enable-enhanced-security': {
|
|
61
55
|
describe: string;
|
|
62
56
|
type: "boolean";
|
|
63
|
-
default: boolean;
|
|
64
57
|
};
|
|
65
58
|
'session-ttl': {
|
|
66
59
|
describe: string;
|
|
67
60
|
type: "number";
|
|
68
|
-
default: number;
|
|
69
61
|
};
|
|
70
62
|
'session-storage-path': {
|
|
71
63
|
describe: string;
|
|
@@ -75,17 +67,14 @@ export declare const serverOptions: {
|
|
|
75
67
|
'rate-limit-window': {
|
|
76
68
|
describe: string;
|
|
77
69
|
type: "number";
|
|
78
|
-
default: number;
|
|
79
70
|
};
|
|
80
71
|
'rate-limit-max': {
|
|
81
72
|
describe: string;
|
|
82
73
|
type: "number";
|
|
83
|
-
default: number;
|
|
84
74
|
};
|
|
85
75
|
'trust-proxy': {
|
|
86
76
|
describe: string;
|
|
87
77
|
type: "string";
|
|
88
|
-
default: string;
|
|
89
78
|
};
|
|
90
79
|
'health-info-level': {
|
|
91
80
|
describe: string;
|
|
@@ -96,27 +85,22 @@ export declare const serverOptions: {
|
|
|
96
85
|
'enable-async-loading': {
|
|
97
86
|
describe: string;
|
|
98
87
|
type: "boolean";
|
|
99
|
-
default: boolean;
|
|
100
88
|
};
|
|
101
89
|
'async-min-servers': {
|
|
102
90
|
describe: string;
|
|
103
91
|
type: "number";
|
|
104
|
-
default: number;
|
|
105
92
|
};
|
|
106
93
|
'async-timeout': {
|
|
107
94
|
describe: string;
|
|
108
95
|
type: "number";
|
|
109
|
-
default: number;
|
|
110
96
|
};
|
|
111
97
|
'async-batch-notifications': {
|
|
112
98
|
describe: string;
|
|
113
99
|
type: "boolean";
|
|
114
|
-
default: boolean;
|
|
115
100
|
};
|
|
116
101
|
'async-batch-delay': {
|
|
117
102
|
describe: string;
|
|
118
103
|
type: "number";
|
|
119
|
-
default: number;
|
|
120
104
|
};
|
|
121
105
|
'async-notify-on-ready': {
|
|
122
106
|
describe: string;
|
|
@@ -126,18 +110,15 @@ export declare const serverOptions: {
|
|
|
126
110
|
'enable-lazy-loading': {
|
|
127
111
|
describe: string;
|
|
128
112
|
type: "boolean";
|
|
129
|
-
default: boolean;
|
|
130
113
|
};
|
|
131
114
|
'lazy-mode': {
|
|
132
115
|
describe: string;
|
|
133
116
|
type: "string";
|
|
134
117
|
choices: readonly ["metatool", "hybrid", "full"];
|
|
135
|
-
default: string;
|
|
136
118
|
};
|
|
137
119
|
'lazy-cache-max-entries': {
|
|
138
120
|
describe: string;
|
|
139
121
|
type: "number";
|
|
140
|
-
default: number;
|
|
141
122
|
};
|
|
142
123
|
'lazy-preload': {
|
|
143
124
|
describe: string;
|
|
@@ -152,7 +133,6 @@ export declare const serverOptions: {
|
|
|
152
133
|
'lazy-inline-catalog': {
|
|
153
134
|
describe: string;
|
|
154
135
|
type: "boolean";
|
|
155
|
-
default: boolean;
|
|
156
136
|
};
|
|
157
137
|
'lazy-catalog-format': {
|
|
158
138
|
describe: string;
|
|
@@ -184,12 +164,10 @@ export declare const serverOptions: {
|
|
|
184
164
|
'enable-config-reload': {
|
|
185
165
|
describe: string;
|
|
186
166
|
type: "boolean";
|
|
187
|
-
default: boolean;
|
|
188
167
|
};
|
|
189
168
|
'config-reload-debounce': {
|
|
190
169
|
describe: string;
|
|
191
170
|
type: "number";
|
|
192
|
-
default: number;
|
|
193
171
|
};
|
|
194
172
|
'enable-env-substitution': {
|
|
195
173
|
describe: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAElC;;;;GAIG;AAGH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4NzB,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,GAAG,IAAI,CA4EnD"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { HOST, PORT } from '../../constants.js';
|
|
2
1
|
import { globalOptions } from '../../globalOptions.js';
|
|
3
2
|
/**
|
|
4
3
|
* Serve command group entry point.
|
|
@@ -12,19 +11,16 @@ export const serverOptions = {
|
|
|
12
11
|
describe: 'Transport type to use (stdio or http, sse is deprecated)',
|
|
13
12
|
type: 'string',
|
|
14
13
|
choices: ['stdio', 'http', 'sse'],
|
|
15
|
-
default: 'http',
|
|
16
14
|
},
|
|
17
15
|
port: {
|
|
18
16
|
alias: 'P',
|
|
19
17
|
describe: 'HTTP port to listen on, applicable when transport is http',
|
|
20
18
|
type: 'number',
|
|
21
|
-
default: PORT,
|
|
22
19
|
},
|
|
23
20
|
host: {
|
|
24
21
|
alias: 'H',
|
|
25
22
|
describe: 'HTTP host to listen on, applicable when transport is http',
|
|
26
23
|
type: 'string',
|
|
27
|
-
default: HOST,
|
|
28
24
|
},
|
|
29
25
|
'external-url': {
|
|
30
26
|
alias: 'u',
|
|
@@ -47,27 +43,22 @@ export const serverOptions = {
|
|
|
47
43
|
auth: {
|
|
48
44
|
describe: 'Enable authentication (OAuth 2.1) - deprecated, use --enable-auth',
|
|
49
45
|
type: 'boolean',
|
|
50
|
-
default: false,
|
|
51
46
|
},
|
|
52
47
|
'enable-auth': {
|
|
53
48
|
describe: 'Enable authentication (OAuth 2.1)',
|
|
54
49
|
type: 'boolean',
|
|
55
|
-
default: false,
|
|
56
50
|
},
|
|
57
51
|
'enable-scope-validation': {
|
|
58
52
|
describe: 'Enable tag-based scope validation',
|
|
59
53
|
type: 'boolean',
|
|
60
|
-
default: true,
|
|
61
54
|
},
|
|
62
55
|
'enable-enhanced-security': {
|
|
63
56
|
describe: 'Enable enhanced security middleware',
|
|
64
57
|
type: 'boolean',
|
|
65
|
-
default: false,
|
|
66
58
|
},
|
|
67
59
|
'session-ttl': {
|
|
68
60
|
describe: 'Session expiry time in minutes',
|
|
69
61
|
type: 'number',
|
|
70
|
-
default: 24 * 60, // 24 hours
|
|
71
62
|
},
|
|
72
63
|
'session-storage-path': {
|
|
73
64
|
describe: 'Custom session storage directory path',
|
|
@@ -77,17 +68,14 @@ export const serverOptions = {
|
|
|
77
68
|
'rate-limit-window': {
|
|
78
69
|
describe: 'OAuth rate limit window in minutes',
|
|
79
70
|
type: 'number',
|
|
80
|
-
default: 15,
|
|
81
71
|
},
|
|
82
72
|
'rate-limit-max': {
|
|
83
73
|
describe: 'Maximum requests per OAuth rate limit window',
|
|
84
74
|
type: 'number',
|
|
85
|
-
default: 100,
|
|
86
75
|
},
|
|
87
76
|
'trust-proxy': {
|
|
88
77
|
describe: 'Trust proxy configuration for Express.js (boolean, IP address, subnet, or preset: loopback, linklocal, uniquelocal)',
|
|
89
78
|
type: 'string',
|
|
90
|
-
default: 'loopback',
|
|
91
79
|
},
|
|
92
80
|
'health-info-level': {
|
|
93
81
|
describe: 'Health endpoint information detail level (full, basic, minimal)',
|
|
@@ -98,27 +86,22 @@ export const serverOptions = {
|
|
|
98
86
|
'enable-async-loading': {
|
|
99
87
|
describe: 'Enable asynchronous MCP server loading with listChanged notifications',
|
|
100
88
|
type: 'boolean',
|
|
101
|
-
default: false,
|
|
102
89
|
},
|
|
103
90
|
'async-min-servers': {
|
|
104
91
|
describe: 'Minimum number of servers to wait for before accepting requests (when async loading enabled)',
|
|
105
92
|
type: 'number',
|
|
106
|
-
default: 1,
|
|
107
93
|
},
|
|
108
94
|
'async-timeout': {
|
|
109
95
|
describe: 'Initial load timeout in milliseconds (when async loading enabled)',
|
|
110
96
|
type: 'number',
|
|
111
|
-
default: 30000,
|
|
112
97
|
},
|
|
113
98
|
'async-batch-notifications': {
|
|
114
99
|
describe: 'Batch capability change notifications (when async loading enabled)',
|
|
115
100
|
type: 'boolean',
|
|
116
|
-
default: true,
|
|
117
101
|
},
|
|
118
102
|
'async-batch-delay': {
|
|
119
103
|
describe: 'Batch delay in milliseconds for notifications (when async loading enabled)',
|
|
120
104
|
type: 'number',
|
|
121
|
-
default: 100,
|
|
122
105
|
},
|
|
123
106
|
'async-notify-on-ready': {
|
|
124
107
|
describe: 'Notify clients when servers become ready (when async loading enabled)',
|
|
@@ -128,18 +111,15 @@ export const serverOptions = {
|
|
|
128
111
|
'enable-lazy-loading': {
|
|
129
112
|
describe: 'Enable lazy loading for tools (tools loaded on-demand, reduces token usage by ~95%)',
|
|
130
113
|
type: 'boolean',
|
|
131
|
-
default: false,
|
|
132
114
|
},
|
|
133
115
|
'lazy-mode': {
|
|
134
116
|
describe: 'Lazy loading mode (metatool: 3 meta-tools only, hybrid: direct + meta-tools, full: disabled)',
|
|
135
117
|
type: 'string',
|
|
136
118
|
choices: ['metatool', 'hybrid', 'full'],
|
|
137
|
-
default: 'full',
|
|
138
119
|
},
|
|
139
120
|
'lazy-cache-max-entries': {
|
|
140
121
|
describe: 'Maximum number of tool schemas to cache in LRU cache (when lazy loading enabled)',
|
|
141
122
|
type: 'number',
|
|
142
|
-
default: 1000,
|
|
143
123
|
},
|
|
144
124
|
'lazy-preload': {
|
|
145
125
|
describe: 'Comma-separated list of tool patterns to preload at startup (when lazy loading enabled)',
|
|
@@ -154,7 +134,6 @@ export const serverOptions = {
|
|
|
154
134
|
'lazy-inline-catalog': {
|
|
155
135
|
describe: 'Include full tool catalog in initialize template (when lazy loading enabled)',
|
|
156
136
|
type: 'boolean',
|
|
157
|
-
default: false,
|
|
158
137
|
},
|
|
159
138
|
'lazy-catalog-format': {
|
|
160
139
|
describe: 'Format for inline tool catalog (flat, grouped, categorized)',
|
|
@@ -186,12 +165,10 @@ export const serverOptions = {
|
|
|
186
165
|
'enable-config-reload': {
|
|
187
166
|
describe: 'Enable automatic configuration hot-reload on file changes',
|
|
188
167
|
type: 'boolean',
|
|
189
|
-
default: true,
|
|
190
168
|
},
|
|
191
169
|
'config-reload-debounce': {
|
|
192
170
|
describe: 'Debounce delay in milliseconds for config reload',
|
|
193
171
|
type: 'number',
|
|
194
|
-
default: 500,
|
|
195
172
|
},
|
|
196
173
|
'enable-env-substitution': {
|
|
197
174
|
describe: 'Enable environment variable substitution in config (${VAR_NAME} pattern)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAItD;;;;GAIG;AAEH,wFAAwF;AACxF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,SAAS,EAAE;QACT,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,0DAA0D;QACpE,IAAI,EAAE,QAAiB;QACvB,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAU;KAC3C;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,2DAA2D;Q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AAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAuCX,CAAC,CAAC;IACP,CAAC,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,MAAM,CAAC,sCAAsC,CAAC,CAAC;QACvF,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;QAEpD,+DAA+D;QAC/D,MAAM,aAAa,GAAG;YACpB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC;YAChC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC;YAC9B,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC;SAC7B,CAAC;QACF,qBAAqB,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QAErD,wBAAwB;QACxB,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
export interface ServeOptions {
|
|
2
2
|
config?: string;
|
|
3
3
|
'config-dir'?: string;
|
|
4
|
-
'log-level'?:
|
|
4
|
+
'log-level'?: 'debug' | 'info' | 'warn' | 'error';
|
|
5
5
|
'log-file'?: string;
|
|
6
|
-
transport
|
|
7
|
-
port
|
|
8
|
-
host
|
|
6
|
+
transport?: string;
|
|
7
|
+
port?: number;
|
|
8
|
+
host?: string;
|
|
9
9
|
'external-url'?: string;
|
|
10
10
|
filter?: string;
|
|
11
11
|
pagination: boolean;
|
|
12
|
-
auth
|
|
13
|
-
'enable-auth'
|
|
14
|
-
'enable-scope-validation'
|
|
15
|
-
'enable-enhanced-security'
|
|
16
|
-
'session-ttl'
|
|
12
|
+
auth?: boolean;
|
|
13
|
+
'enable-auth'?: boolean;
|
|
14
|
+
'enable-scope-validation'?: boolean;
|
|
15
|
+
'enable-enhanced-security'?: boolean;
|
|
16
|
+
'session-ttl'?: number;
|
|
17
17
|
'session-storage-path'?: string;
|
|
18
|
-
'rate-limit-window'
|
|
19
|
-
'rate-limit-max'
|
|
20
|
-
'trust-proxy'
|
|
18
|
+
'rate-limit-window'?: number;
|
|
19
|
+
'rate-limit-max'?: number;
|
|
20
|
+
'trust-proxy'?: string;
|
|
21
21
|
'health-info-level': string;
|
|
22
|
-
'enable-async-loading'
|
|
23
|
-
'async-min-servers'
|
|
24
|
-
'async-timeout'
|
|
25
|
-
'async-batch-notifications'
|
|
26
|
-
'async-batch-delay'
|
|
22
|
+
'enable-async-loading'?: boolean;
|
|
23
|
+
'async-min-servers'?: number;
|
|
24
|
+
'async-timeout'?: number;
|
|
25
|
+
'async-batch-notifications'?: boolean;
|
|
26
|
+
'async-batch-delay'?: number;
|
|
27
27
|
'async-notify-on-ready': boolean;
|
|
28
|
-
'enable-lazy-loading'
|
|
29
|
-
'lazy-mode'
|
|
30
|
-
'lazy-inline-catalog'
|
|
28
|
+
'enable-lazy-loading'?: boolean;
|
|
29
|
+
'lazy-mode'?: string;
|
|
30
|
+
'lazy-inline-catalog'?: boolean;
|
|
31
31
|
'lazy-catalog-format': string;
|
|
32
32
|
'lazy-direct-expose'?: string;
|
|
33
|
-
'lazy-cache-max-entries'
|
|
33
|
+
'lazy-cache-max-entries'?: number;
|
|
34
34
|
'lazy-cache-ttl'?: number;
|
|
35
35
|
'lazy-preload'?: string;
|
|
36
36
|
'lazy-preload-keywords'?: string;
|
|
37
37
|
'lazy-fallback-on-error'?: string;
|
|
38
38
|
'lazy-fallback-timeout'?: number;
|
|
39
|
-
'enable-config-reload'
|
|
40
|
-
'config-reload-debounce'
|
|
39
|
+
'enable-config-reload'?: boolean;
|
|
40
|
+
'config-reload-debounce'?: number;
|
|
41
41
|
'enable-env-substitution': boolean;
|
|
42
42
|
'enable-session-persistence': boolean;
|
|
43
43
|
'session-persist-requests': number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/serve.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/serve.ts"],"names":[],"mappings":"AAwBA,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uBAAuB,EAAE,OAAO,CAAC;IACjC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,yBAAyB,EAAE,OAAO,CAAC;IACnC,4BAA4B,EAAE,OAAO,CAAC;IACtC,0BAA0B,EAAE,MAAM,CAAC;IACnC,0BAA0B,EAAE,MAAM,CAAC;IACnC,0BAA0B,EAAE,MAAM,CAAC;IACnC,6BAA6B,EAAE,OAAO,CAAC;IACvC,8BAA8B,EAAE,OAAO,CAAC;IAExC,uBAAuB,EAAE,OAAO,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAyLD;;GAEG;AACH,wBAAsB,YAAY,CAAC,UAAU,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAgV1E"}
|
|
@@ -3,17 +3,32 @@ import path from 'path';
|
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
4
|
import ConfigContext from '../../config/configContext.js';
|
|
5
5
|
import { ConfigManager } from '../../config/configManager.js';
|
|
6
|
-
import { getDefaultInstructionsTemplatePath } from '../../constants.js';
|
|
7
|
-
import { getConfigDir } from '../../constants.js';
|
|
6
|
+
import { getConfigDir, getDefaultInstructionsTemplatePath, HOST, PORT } from '../../constants.js';
|
|
8
7
|
import { FlagManager } from '../../core/flags/flagManager.js';
|
|
9
8
|
import { formatValidationError, validateTemplateContent } from '../../core/instructions/templateValidator.js';
|
|
10
9
|
import { AgentConfigManager } from '../../core/server/agentConfig.js';
|
|
11
10
|
import { cleanupPidFileOnExit, registerPidFileCleanup, writePidFile } from '../../core/server/pidFileManager.js';
|
|
12
11
|
import { TagQueryParser } from '../../domains/preset/parsers/tagQueryParser.js';
|
|
12
|
+
import { configureGlobalLogger } from '../../logger/configureGlobalLogger.js';
|
|
13
13
|
import logger, { debugIf } from '../../logger/logger.js';
|
|
14
14
|
import { setupServer } from '../../server.js';
|
|
15
15
|
import { ExpressServer } from '../../transport/http/server.js';
|
|
16
16
|
import { displayLogo } from '../../utils/ui/logo.js';
|
|
17
|
+
function parseCommaSeparatedList(value) {
|
|
18
|
+
return value ? value.split(',').map((entry) => entry.trim()) : [];
|
|
19
|
+
}
|
|
20
|
+
function parseInternalToolsList(value) {
|
|
21
|
+
if (!value) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
return FlagManager.getInstance().parseToolsList(value);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
logger.error(`Failed to parse internal-tools list: ${error instanceof Error ? error.message : String(error)}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
17
32
|
/**
|
|
18
33
|
* Load custom instructions template from file with validation
|
|
19
34
|
* @param templatePath Path to template file (CLI option or default)
|
|
@@ -181,29 +196,40 @@ export async function serveCommand(parsedArgv) {
|
|
|
181
196
|
// Initialize MCP config manager using resolved config path
|
|
182
197
|
const configFilePath = configContext.getResolvedConfigPath();
|
|
183
198
|
const mcpConfigManager = ConfigManager.getInstance(configFilePath);
|
|
199
|
+
// Load app-level config from config.toml (CLI args take precedence)
|
|
200
|
+
const appConfig = mcpConfigManager.getAppConfig();
|
|
184
201
|
// Get server count for logo display
|
|
185
202
|
const transportConfig = mcpConfigManager.getTransportConfig();
|
|
186
203
|
const serverCount = Object.keys(transportConfig).length;
|
|
187
204
|
// Handle backward compatibility for auth flag
|
|
188
|
-
const authEnabled = parsedArgv['enable-auth'] ?? parsedArgv['auth'] ?? false;
|
|
205
|
+
const authEnabled = parsedArgv['enable-auth'] ?? parsedArgv['auth'] ?? appConfig.auth?.enabled ?? false;
|
|
189
206
|
// Display logo with runtime information (skip for stdio or when logging to file)
|
|
190
|
-
|
|
207
|
+
const effectiveTransport = parsedArgv.transport ?? appConfig.transport ?? 'http';
|
|
208
|
+
const effectivePort = parsedArgv.port ?? appConfig.port ?? PORT;
|
|
209
|
+
const effectiveHost = parsedArgv.host ?? appConfig.host ?? HOST;
|
|
210
|
+
configureGlobalLogger({
|
|
211
|
+
...parsedArgv,
|
|
212
|
+
'log-level': parsedArgv['log-level'] ?? appConfig.logLevel,
|
|
213
|
+
'log-file': parsedArgv['log-file'] ?? appConfig.logFile,
|
|
214
|
+
}, effectiveTransport);
|
|
215
|
+
const effectiveLogFile = parsedArgv['log-file'] ?? appConfig.logFile;
|
|
216
|
+
if (effectiveTransport !== 'stdio' && !effectiveLogFile) {
|
|
191
217
|
displayLogo({
|
|
192
|
-
transport:
|
|
193
|
-
port:
|
|
194
|
-
host:
|
|
218
|
+
transport: effectiveTransport,
|
|
219
|
+
port: effectivePort,
|
|
220
|
+
host: effectiveHost,
|
|
195
221
|
serverCount,
|
|
196
222
|
authEnabled,
|
|
197
|
-
logLevel: parsedArgv['log-level'],
|
|
223
|
+
logLevel: parsedArgv['log-level'] ?? appConfig.logLevel,
|
|
198
224
|
configDir: getConfigDir(parsedArgv['config-dir']),
|
|
199
225
|
});
|
|
200
226
|
}
|
|
201
|
-
// Configure server settings from CLI arguments
|
|
227
|
+
// Configure server settings from CLI arguments (CLI args take precedence over appConfig)
|
|
202
228
|
const serverConfigManager = AgentConfigManager.getInstance();
|
|
203
|
-
const scopeValidationEnabled = parsedArgv['enable-scope-validation'] ??
|
|
204
|
-
const enhancedSecurityEnabled = parsedArgv['enable-enhanced-security'] ?? false;
|
|
229
|
+
const scopeValidationEnabled = parsedArgv['enable-scope-validation'] ?? appConfig.auth?.enableScopeValidation ?? true;
|
|
230
|
+
const enhancedSecurityEnabled = parsedArgv['enable-enhanced-security'] ?? appConfig.auth?.enableEnhancedSecurity ?? false;
|
|
205
231
|
// Handle trust proxy configuration (convert 'true'/'false' strings to boolean)
|
|
206
|
-
const trustProxyValue = parsedArgv['trust-proxy'];
|
|
232
|
+
const trustProxyValue = parsedArgv['trust-proxy'] ?? appConfig.auth?.trustProxy ?? 'loopback';
|
|
207
233
|
const trustProxy = trustProxyValue === 'true' ? true : trustProxyValue === 'false' ? false : trustProxyValue;
|
|
208
234
|
// Derive session storage path: explicit option > config-dir/sessions > global default
|
|
209
235
|
let sessionStoragePath = parsedArgv['session-storage-path'];
|
|
@@ -212,74 +238,64 @@ export async function serveCommand(parsedArgv) {
|
|
|
212
238
|
// store sessions within the config directory to maintain isolation
|
|
213
239
|
sessionStoragePath = path.join(parsedArgv['config-dir'], 'sessions');
|
|
214
240
|
}
|
|
241
|
+
const internalToolsList = parseInternalToolsList(parsedArgv['internal-tools']);
|
|
242
|
+
const directExpose = parseCommaSeparatedList(parsedArgv['lazy-direct-expose']);
|
|
243
|
+
const preloadPatterns = parseCommaSeparatedList(parsedArgv['lazy-preload']);
|
|
244
|
+
const preloadKeywords = parseCommaSeparatedList(parsedArgv['lazy-preload-keywords']);
|
|
245
|
+
const sessionTtlMinutes = parsedArgv['session-ttl'] ?? appConfig.auth?.sessionTtl ?? 1440;
|
|
215
246
|
serverConfigManager.updateConfig({
|
|
216
|
-
host:
|
|
217
|
-
port:
|
|
247
|
+
host: effectiveHost,
|
|
248
|
+
port: effectivePort,
|
|
218
249
|
externalUrl: parsedArgv['external-url'],
|
|
219
250
|
trustProxy,
|
|
220
251
|
auth: {
|
|
221
252
|
enabled: authEnabled,
|
|
222
|
-
sessionTtlMinutes
|
|
253
|
+
sessionTtlMinutes,
|
|
223
254
|
sessionStoragePath,
|
|
224
255
|
oauthCodeTtlMs: 60 * 1000, // 1 minute
|
|
225
|
-
oauthTokenTtlMs:
|
|
256
|
+
oauthTokenTtlMs: sessionTtlMinutes * 60 * 1000,
|
|
226
257
|
},
|
|
227
258
|
rateLimit: {
|
|
228
|
-
windowMs: parsedArgv['rate-limit-window'] * 60 * 1000,
|
|
229
|
-
max: parsedArgv['rate-limit-max'],
|
|
259
|
+
windowMs: (parsedArgv['rate-limit-window'] ?? appConfig.auth?.rateLimitWindow ?? 15) * 60 * 1000,
|
|
260
|
+
max: parsedArgv['rate-limit-max'] ?? appConfig.auth?.rateLimitMax ?? 100,
|
|
230
261
|
},
|
|
231
262
|
features: {
|
|
232
263
|
auth: authEnabled,
|
|
233
264
|
scopeValidation: scopeValidationEnabled,
|
|
234
265
|
enhancedSecurity: enhancedSecurityEnabled,
|
|
235
|
-
configReload: parsedArgv['enable-config-reload'],
|
|
266
|
+
configReload: parsedArgv['enable-config-reload'] ?? appConfig.configReload?.enabled ?? true,
|
|
236
267
|
envSubstitution: parsedArgv['enable-env-substitution'],
|
|
237
268
|
sessionPersistence: parsedArgv['enable-session-persistence'],
|
|
238
269
|
clientNotifications: parsedArgv['enable-client-notifications'],
|
|
239
270
|
jsonRpcErrorLogging: parsedArgv['enable-jsonrpc-error-logging'],
|
|
240
271
|
// Internal tool configuration from CLI flags
|
|
241
272
|
internalTools: parsedArgv['enable-internal-tools'],
|
|
242
|
-
internalToolsList
|
|
243
|
-
? (() => {
|
|
244
|
-
try {
|
|
245
|
-
const flagManager = FlagManager.getInstance();
|
|
246
|
-
return flagManager.parseToolsList(parsedArgv['internal-tools']);
|
|
247
|
-
}
|
|
248
|
-
catch (error) {
|
|
249
|
-
logger.error(`Failed to parse internal-tools list: ${error instanceof Error ? error.message : String(error)}`);
|
|
250
|
-
process.exit(1);
|
|
251
|
-
}
|
|
252
|
-
})()
|
|
253
|
-
: [],
|
|
273
|
+
internalToolsList,
|
|
254
274
|
},
|
|
255
275
|
health: {
|
|
256
276
|
detailLevel: parsedArgv['health-info-level'],
|
|
257
277
|
},
|
|
258
278
|
asyncLoading: {
|
|
259
|
-
enabled: parsedArgv['enable-async-loading'],
|
|
279
|
+
enabled: parsedArgv['enable-async-loading'] ?? appConfig.asyncLoading?.enabled ?? false,
|
|
260
280
|
notifyOnServerReady: parsedArgv['async-notify-on-ready'],
|
|
261
|
-
waitForMinimumServers: parsedArgv['async-min-servers'],
|
|
262
|
-
initialLoadTimeoutMs: parsedArgv['async-timeout'],
|
|
263
|
-
batchNotifications: parsedArgv['async-batch-notifications'],
|
|
264
|
-
batchDelayMs: parsedArgv['async-batch-delay'],
|
|
281
|
+
waitForMinimumServers: parsedArgv['async-min-servers'] ?? appConfig.asyncLoading?.minServers ?? 1,
|
|
282
|
+
initialLoadTimeoutMs: parsedArgv['async-timeout'] ?? appConfig.asyncLoading?.timeout ?? 30000,
|
|
283
|
+
batchNotifications: parsedArgv['async-batch-notifications'] ?? appConfig.asyncLoading?.batchNotifications ?? true,
|
|
284
|
+
batchDelayMs: parsedArgv['async-batch-delay'] ?? appConfig.asyncLoading?.batchDelay ?? 100,
|
|
265
285
|
},
|
|
266
286
|
lazyLoading: {
|
|
267
|
-
enabled: parsedArgv['enable-lazy-loading'],
|
|
268
|
-
inlineCatalog: parsedArgv['lazy-inline-catalog'],
|
|
287
|
+
enabled: parsedArgv['enable-lazy-loading'] ?? appConfig.lazyLoading?.enabled ?? false,
|
|
288
|
+
inlineCatalog: parsedArgv['lazy-inline-catalog'] ?? appConfig.lazyLoading?.inlineCatalog ?? false,
|
|
269
289
|
catalogFormat: (parsedArgv['lazy-catalog-format'] || 'grouped'),
|
|
270
|
-
directExpose
|
|
271
|
-
? parsedArgv['lazy-direct-expose'].split(',').map((s) => s.trim())
|
|
272
|
-
: [],
|
|
290
|
+
directExpose,
|
|
273
291
|
cache: {
|
|
274
|
-
maxEntries: parsedArgv['lazy-cache-max-entries'],
|
|
292
|
+
maxEntries: parsedArgv['lazy-cache-max-entries'] ?? appConfig.lazyLoading?.cacheMaxEntries ?? 1000,
|
|
275
293
|
strategy: 'lru',
|
|
276
294
|
ttlMs: parsedArgv['lazy-cache-ttl'],
|
|
277
295
|
},
|
|
278
296
|
preload: {
|
|
279
|
-
patterns:
|
|
280
|
-
keywords:
|
|
281
|
-
? parsedArgv['lazy-preload-keywords'].split(',').map((s) => s.trim())
|
|
282
|
-
: [],
|
|
297
|
+
patterns: preloadPatterns,
|
|
298
|
+
keywords: preloadKeywords,
|
|
283
299
|
},
|
|
284
300
|
fallback: {
|
|
285
301
|
onError: (parsedArgv['lazy-fallback-on-error'] || 'skip'),
|
|
@@ -287,7 +303,7 @@ export async function serveCommand(parsedArgv) {
|
|
|
287
303
|
},
|
|
288
304
|
},
|
|
289
305
|
configReload: {
|
|
290
|
-
debounceMs: parsedArgv['config-reload-debounce'],
|
|
306
|
+
debounceMs: parsedArgv['config-reload-debounce'] ?? appConfig.configReload?.debounce ?? 500,
|
|
291
307
|
},
|
|
292
308
|
sessionPersistence: {
|
|
293
309
|
persistRequests: parsedArgv['session-persist-requests'],
|
|
@@ -304,7 +320,7 @@ export async function serveCommand(parsedArgv) {
|
|
|
304
320
|
// Load custom instructions template if provided (applies to all transport types)
|
|
305
321
|
const customTemplate = loadInstructionsTemplate(parsedArgv['instructions-template'], parsedArgv['config-dir']);
|
|
306
322
|
let expressServer;
|
|
307
|
-
switch (
|
|
323
|
+
switch (effectiveTransport) {
|
|
308
324
|
case 'stdio': {
|
|
309
325
|
// DEPRECATION WARNING
|
|
310
326
|
logger.warn('⚠️ DEPRECATION WARNING: `serve --transport stdio` is deprecated');
|
|
@@ -434,8 +450,8 @@ export async function serveCommand(parsedArgv) {
|
|
|
434
450
|
writePidFile(configDir, {
|
|
435
451
|
pid: process.pid,
|
|
436
452
|
url: `${serverUrl}/mcp`,
|
|
437
|
-
port:
|
|
438
|
-
host:
|
|
453
|
+
port: effectivePort,
|
|
454
|
+
host: effectiveHost,
|
|
439
455
|
transport: 'http',
|
|
440
456
|
startedAt: new Date().toISOString(),
|
|
441
457
|
configDir,
|
|
@@ -445,7 +461,7 @@ export async function serveCommand(parsedArgv) {
|
|
|
445
461
|
break;
|
|
446
462
|
}
|
|
447
463
|
default:
|
|
448
|
-
logger.error(`Invalid transport: ${
|
|
464
|
+
logger.error(`Invalid transport: ${effectiveTransport}`);
|
|
449
465
|
process.exit(1);
|
|
450
466
|
}
|
|
451
467
|
// Set up graceful shutdown handling
|