@1mcp/agent 0.21.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -148
- package/build/commands/app/backups.d.ts +13 -1
- package/build/commands/app/backups.d.ts.map +1 -1
- package/build/commands/app/backups.js +25 -0
- package/build/commands/app/backups.js.map +1 -1
- package/build/commands/app/consolidate.d.ts +21 -1
- package/build/commands/app/consolidate.d.ts.map +1 -1
- package/build/commands/app/consolidate.js +63 -0
- package/build/commands/app/consolidate.js.map +1 -1
- package/build/commands/app/discover.d.ts +11 -1
- package/build/commands/app/discover.d.ts.map +1 -1
- package/build/commands/app/discover.js +21 -0
- package/build/commands/app/discover.js.map +1 -1
- package/build/commands/app/index.d.ts.map +1 -1
- package/build/commands/app/index.js +15 -193
- package/build/commands/app/index.js.map +1 -1
- package/build/commands/app/list.d.ts +11 -1
- package/build/commands/app/list.d.ts.map +1 -1
- package/build/commands/app/list.js +21 -0
- package/build/commands/app/list.js.map +1 -1
- package/build/commands/app/restore.d.ts +21 -1
- package/build/commands/app/restore.d.ts.map +1 -1
- package/build/commands/app/restore.js +59 -0
- package/build/commands/app/restore.js.map +1 -1
- package/build/commands/app/status.d.ts +11 -1
- package/build/commands/app/status.d.ts.map +1 -1
- package/build/commands/app/status.js +21 -0
- package/build/commands/app/status.js.map +1 -1
- package/build/commands/mcp/add.d.ts +35 -2
- package/build/commands/mcp/add.d.ts.map +1 -1
- package/build/commands/mcp/add.js +86 -0
- package/build/commands/mcp/add.js.map +1 -1
- package/build/commands/mcp/enable.d.ts +15 -2
- package/build/commands/mcp/enable.d.ts.map +1 -1
- package/build/commands/mcp/enable.js +24 -0
- package/build/commands/mcp/enable.js.map +1 -1
- package/build/commands/mcp/index.d.ts.map +1 -1
- package/build/commands/mcp/index.js +18 -302
- package/build/commands/mcp/index.js.map +1 -1
- package/build/commands/mcp/list.d.ts +15 -2
- package/build/commands/mcp/list.d.ts.map +1 -1
- package/build/commands/mcp/list.js +35 -1
- package/build/commands/mcp/list.js.map +1 -1
- package/build/commands/mcp/remove.d.ts +11 -2
- package/build/commands/mcp/remove.d.ts.map +1 -1
- package/build/commands/mcp/remove.js +21 -0
- package/build/commands/mcp/remove.js.map +1 -1
- package/build/commands/mcp/status.d.ts +11 -2
- package/build/commands/mcp/status.d.ts.map +1 -1
- package/build/commands/mcp/status.js +23 -1
- package/build/commands/mcp/status.js.map +1 -1
- package/build/commands/mcp/tokens.d.ts +13 -3
- package/build/commands/mcp/tokens.d.ts.map +1 -1
- package/build/commands/mcp/tokens.js +31 -0
- package/build/commands/mcp/tokens.js.map +1 -1
- package/build/commands/mcp/update.d.ts +33 -2
- package/build/commands/mcp/update.d.ts.map +1 -1
- package/build/commands/mcp/update.js +72 -0
- package/build/commands/mcp/update.js.map +1 -1
- package/build/commands/preset/create.d.ts +26 -0
- package/build/commands/preset/create.d.ts.map +1 -0
- package/build/commands/preset/create.js +117 -0
- package/build/commands/preset/create.js.map +1 -0
- package/build/commands/preset/delete.d.ts +20 -0
- package/build/commands/preset/delete.d.ts.map +1 -0
- package/build/commands/preset/delete.js +46 -0
- package/build/commands/preset/delete.js.map +1 -0
- package/build/commands/preset/edit.d.ts +23 -0
- package/build/commands/preset/edit.d.ts.map +1 -0
- package/build/commands/preset/edit.js +68 -0
- package/build/commands/preset/edit.js.map +1 -0
- package/build/commands/preset/index.d.ts +6 -0
- package/build/commands/preset/index.d.ts.map +1 -0
- package/build/commands/preset/index.js +141 -0
- package/build/commands/preset/index.js.map +1 -0
- package/build/commands/preset/interactive.d.ts +12 -0
- package/build/commands/preset/interactive.d.ts.map +1 -0
- package/build/commands/preset/interactive.js +131 -0
- package/build/commands/preset/interactive.js.map +1 -0
- package/build/commands/preset/list.d.ts +16 -0
- package/build/commands/preset/list.d.ts.map +1 -0
- package/build/commands/preset/list.js +128 -0
- package/build/commands/preset/list.js.map +1 -0
- package/build/commands/preset/show.d.ts +19 -0
- package/build/commands/preset/show.d.ts.map +1 -0
- package/build/commands/preset/show.js +114 -0
- package/build/commands/preset/show.js.map +1 -0
- package/build/commands/preset/test.d.ts +20 -0
- package/build/commands/preset/test.d.ts.map +1 -0
- package/build/commands/preset/test.js +46 -0
- package/build/commands/preset/test.js.map +1 -0
- package/build/commands/preset/url.d.ts +20 -0
- package/build/commands/preset/url.d.ts.map +1 -0
- package/build/commands/preset/url.js +47 -0
- package/build/commands/preset/url.js.map +1 -0
- package/build/commands/serve/index.d.ts +106 -0
- package/build/commands/serve/index.d.ts.map +1 -0
- package/build/commands/serve/index.js +143 -0
- package/build/commands/serve/index.js.map +1 -0
- package/build/commands/serve/serve.d.ts +28 -0
- package/build/commands/serve/serve.d.ts.map +1 -0
- package/build/commands/serve/serve.js +213 -0
- package/build/commands/serve/serve.js.map +1 -0
- package/build/constants.d.ts +6 -1
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +13 -5
- package/build/constants.js.map +1 -1
- package/build/core/server/agentConfig.d.ts +6 -0
- package/build/core/server/agentConfig.d.ts.map +1 -1
- package/build/core/server/agentConfig.js +9 -1
- package/build/core/server/agentConfig.js.map +1 -1
- package/build/core/server/serverManager.d.ts.map +1 -1
- package/build/core/server/serverManager.js +41 -0
- package/build/core/server/serverManager.js.map +1 -1
- package/build/core/types/server.d.ts +4 -1
- package/build/core/types/server.d.ts.map +1 -1
- package/build/core/types/server.js.map +1 -1
- package/build/core/types/transport.d.ts +16 -77
- package/build/core/types/transport.d.ts.map +1 -1
- package/build/core/types/transport.js +2 -2
- package/build/core/types/transport.js.map +1 -1
- package/build/globalOptions.d.ts +46 -0
- package/build/globalOptions.d.ts.map +1 -0
- package/build/globalOptions.js +37 -0
- package/build/globalOptions.js.map +1 -0
- package/build/handlers/requestHandlers.d.ts.map +1 -1
- package/build/handlers/requestHandlers.js +23 -1
- package/build/handlers/requestHandlers.js.map +1 -1
- package/build/index.js +58 -347
- package/build/index.js.map +1 -1
- package/build/logger/logger.d.ts.map +1 -1
- package/build/logger/logger.js +4 -2
- package/build/logger/logger.js.map +1 -1
- package/build/logger/mcpLoggingEnhancer.d.ts.map +1 -1
- package/build/logger/mcpLoggingEnhancer.js +10 -6
- package/build/logger/mcpLoggingEnhancer.js.map +1 -1
- package/build/server.d.ts.map +1 -1
- package/build/server.js +26 -0
- package/build/server.js.map +1 -1
- package/build/transport/http/middlewares/scopeAuthMiddleware.d.ts +10 -1
- package/build/transport/http/middlewares/scopeAuthMiddleware.d.ts.map +1 -1
- package/build/transport/http/middlewares/scopeAuthMiddleware.js +12 -0
- package/build/transport/http/middlewares/scopeAuthMiddleware.js.map +1 -1
- package/build/transport/http/middlewares/tagsExtractor.d.ts +7 -3
- package/build/transport/http/middlewares/tagsExtractor.d.ts.map +1 -1
- package/build/transport/http/middlewares/tagsExtractor.js +128 -6
- package/build/transport/http/middlewares/tagsExtractor.js.map +1 -1
- package/build/transport/http/routes/sseRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/sseRoutes.js +5 -1
- package/build/transport/http/routes/sseRoutes.js.map +1 -1
- package/build/transport/http/routes/streamableHttpRoutes.d.ts.map +1 -1
- package/build/transport/http/routes/streamableHttpRoutes.js +5 -1
- package/build/transport/http/routes/streamableHttpRoutes.js.map +1 -1
- package/build/transport/transportFactory.js +1 -1
- package/build/transport/transportFactory.js.map +1 -1
- package/build/utils/configureGlobalLogger.d.ts +12 -0
- package/build/utils/configureGlobalLogger.d.ts.map +1 -0
- package/build/utils/configureGlobalLogger.js +18 -0
- package/build/utils/configureGlobalLogger.js.map +1 -0
- package/build/utils/interactiveSelector.d.ts +88 -0
- package/build/utils/interactiveSelector.d.ts.map +1 -0
- package/build/utils/interactiveSelector.js +616 -0
- package/build/utils/interactiveSelector.js.map +1 -0
- package/build/utils/presetErrorHandler.d.ts +62 -0
- package/build/utils/presetErrorHandler.d.ts.map +1 -0
- package/build/utils/presetErrorHandler.js +159 -0
- package/build/utils/presetErrorHandler.js.map +1 -0
- package/build/utils/presetManager.d.ts +114 -0
- package/build/utils/presetManager.d.ts.map +1 -0
- package/build/utils/presetManager.js +565 -0
- package/build/utils/presetManager.js.map +1 -0
- package/build/utils/presetNotificationService.d.ts +62 -0
- package/build/utils/presetNotificationService.d.ts.map +1 -0
- package/build/utils/presetNotificationService.js +214 -0
- package/build/utils/presetNotificationService.js.map +1 -0
- package/build/utils/presetServerChangeDetector.d.ts +50 -0
- package/build/utils/presetServerChangeDetector.d.ts.map +1 -0
- package/build/utils/presetServerChangeDetector.js +100 -0
- package/build/utils/presetServerChangeDetector.js.map +1 -0
- package/build/utils/presetTypes.d.ts +52 -0
- package/build/utils/presetTypes.d.ts.map +1 -0
- package/build/utils/presetTypes.js +5 -0
- package/build/utils/presetTypes.js.map +1 -0
- package/build/utils/tagQueryEvaluator.d.ts +68 -0
- package/build/utils/tagQueryEvaluator.d.ts.map +1 -0
- package/build/utils/tagQueryEvaluator.js +292 -0
- package/build/utils/tagQueryEvaluator.js.map +1 -0
- package/build/utils/tagQueryParser.d.ts +11 -0
- package/build/utils/tagQueryParser.d.ts.map +1 -1
- package/build/utils/tagQueryParser.js +46 -0
- package/build/utils/tagQueryParser.js.map +1 -1
- package/build/utils/urlGenerator.d.ts +68 -0
- package/build/utils/urlGenerator.d.ts.map +1 -0
- package/build/utils/urlGenerator.js +208 -0
- package/build/utils/urlGenerator.js.map +1 -0
- package/package.json +21 -17
package/build/index.js
CHANGED
|
@@ -2,375 +2,86 @@
|
|
|
2
2
|
import 'source-map-support/register.js';
|
|
3
3
|
import yargs from 'yargs';
|
|
4
4
|
import { hideBin } from 'yargs/helpers';
|
|
5
|
-
import
|
|
6
|
-
import { setupServer } from './server.js';
|
|
7
|
-
import logger, { configureLogger } from './logger/logger.js';
|
|
8
|
-
import configReloadService from './services/configReloadService.js';
|
|
9
|
-
import { McpConfigManager } from './config/mcpConfigManager.js';
|
|
10
|
-
import { ExpressServer } from './transport/http/server.js';
|
|
11
|
-
import { AgentConfigManager } from './core/server/agentConfig.js';
|
|
12
|
-
import { PORT, HOST } from './constants.js';
|
|
13
|
-
import { displayLogo } from './utils/logo.js';
|
|
5
|
+
import logger from './logger/logger.js';
|
|
14
6
|
import { setupAppCommands } from './commands/app/index.js';
|
|
15
7
|
import { setupMcpCommands } from './commands/mcp/index.js';
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
alias: 't',
|
|
21
|
-
describe: 'Transport type to use (stdio or http, sse is deprecated)',
|
|
22
|
-
type: 'string',
|
|
23
|
-
choices: ['stdio', 'http', 'sse'],
|
|
24
|
-
default: 'http',
|
|
25
|
-
},
|
|
26
|
-
port: {
|
|
27
|
-
alias: 'P',
|
|
28
|
-
describe: 'HTTP port to listen on, applicable when transport is http',
|
|
29
|
-
type: 'number',
|
|
30
|
-
default: PORT,
|
|
31
|
-
},
|
|
32
|
-
host: {
|
|
33
|
-
alias: 'H',
|
|
34
|
-
describe: 'HTTP host to listen on, applicable when transport is http',
|
|
35
|
-
type: 'string',
|
|
36
|
-
default: HOST,
|
|
37
|
-
},
|
|
38
|
-
'external-url': {
|
|
39
|
-
alias: 'u',
|
|
40
|
-
describe: 'External URL for the server (used for OAuth callbacks and public URLs)',
|
|
41
|
-
type: 'string',
|
|
42
|
-
default: undefined,
|
|
43
|
-
},
|
|
44
|
-
config: {
|
|
45
|
-
alias: 'c',
|
|
46
|
-
describe: 'Path to the config file',
|
|
47
|
-
type: 'string',
|
|
48
|
-
default: undefined,
|
|
49
|
-
},
|
|
50
|
-
tags: {
|
|
51
|
-
alias: 'g',
|
|
52
|
-
describe: 'Tags to filter clients (comma-separated, OR logic)',
|
|
53
|
-
type: 'string',
|
|
54
|
-
default: undefined,
|
|
55
|
-
conflicts: 'tag-filter',
|
|
56
|
-
},
|
|
57
|
-
'tag-filter': {
|
|
58
|
-
alias: 'f',
|
|
59
|
-
describe: 'Advanced tag filter expression (and/or/not logic)',
|
|
60
|
-
type: 'string',
|
|
61
|
-
default: undefined,
|
|
62
|
-
conflicts: 'tags',
|
|
63
|
-
},
|
|
64
|
-
pagination: {
|
|
65
|
-
alias: 'p',
|
|
66
|
-
describe: 'Enable pagination',
|
|
67
|
-
type: 'boolean',
|
|
68
|
-
default: false,
|
|
69
|
-
},
|
|
70
|
-
auth: {
|
|
71
|
-
describe: 'Enable authentication (OAuth 2.1) - deprecated, use --enable-auth',
|
|
72
|
-
type: 'boolean',
|
|
73
|
-
default: false,
|
|
74
|
-
},
|
|
75
|
-
'enable-auth': {
|
|
76
|
-
describe: 'Enable authentication (OAuth 2.1)',
|
|
77
|
-
type: 'boolean',
|
|
78
|
-
default: false,
|
|
79
|
-
},
|
|
80
|
-
'enable-scope-validation': {
|
|
81
|
-
describe: 'Enable tag-based scope validation',
|
|
82
|
-
type: 'boolean',
|
|
83
|
-
default: true,
|
|
84
|
-
},
|
|
85
|
-
'enable-enhanced-security': {
|
|
86
|
-
describe: 'Enable enhanced security middleware',
|
|
87
|
-
type: 'boolean',
|
|
88
|
-
default: false,
|
|
89
|
-
},
|
|
90
|
-
'session-ttl': {
|
|
91
|
-
describe: 'Session expiry time in minutes',
|
|
92
|
-
type: 'number',
|
|
93
|
-
default: 24 * 60, // 24 hours
|
|
94
|
-
},
|
|
95
|
-
'session-storage-path': {
|
|
96
|
-
describe: 'Custom session storage directory path',
|
|
97
|
-
type: 'string',
|
|
98
|
-
default: undefined,
|
|
99
|
-
},
|
|
100
|
-
'rate-limit-window': {
|
|
101
|
-
describe: 'OAuth rate limit window in minutes',
|
|
102
|
-
type: 'number',
|
|
103
|
-
default: 15,
|
|
104
|
-
},
|
|
105
|
-
'rate-limit-max': {
|
|
106
|
-
describe: 'Maximum requests per OAuth rate limit window',
|
|
107
|
-
type: 'number',
|
|
108
|
-
default: 100,
|
|
109
|
-
},
|
|
110
|
-
'trust-proxy': {
|
|
111
|
-
describe: 'Trust proxy configuration for Express.js (boolean, IP address, subnet, or preset: loopback, linklocal, uniquelocal)',
|
|
112
|
-
type: 'string',
|
|
113
|
-
default: 'loopback',
|
|
114
|
-
},
|
|
115
|
-
'health-info-level': {
|
|
116
|
-
describe: 'Health endpoint information detail level (full, basic, minimal)',
|
|
117
|
-
type: 'string',
|
|
118
|
-
choices: ['full', 'basic', 'minimal'],
|
|
119
|
-
default: 'minimal',
|
|
120
|
-
},
|
|
121
|
-
'enable-async-loading': {
|
|
122
|
-
describe: 'Enable asynchronous MCP server loading with listChanged notifications',
|
|
123
|
-
type: 'boolean',
|
|
124
|
-
default: false,
|
|
125
|
-
},
|
|
126
|
-
'log-level': {
|
|
127
|
-
describe: 'Set the log level (debug, info, warn, error)',
|
|
128
|
-
type: 'string',
|
|
129
|
-
choices: ['debug', 'info', 'warn', 'error'],
|
|
130
|
-
default: undefined,
|
|
131
|
-
},
|
|
132
|
-
'log-file': {
|
|
133
|
-
describe: 'Write logs to a file in addition to console (disables console logging only for stdio transport)',
|
|
134
|
-
type: 'string',
|
|
135
|
-
default: undefined,
|
|
136
|
-
},
|
|
137
|
-
};
|
|
8
|
+
import { setupPresetCommands } from './commands/preset/index.js';
|
|
9
|
+
import { setupServeCommand, serverOptions } from './commands/serve/index.js';
|
|
10
|
+
import { globalOptions } from './globalOptions.js';
|
|
11
|
+
import { configureGlobalLogger } from './utils/configureGlobalLogger.js';
|
|
138
12
|
// Parse command line arguments and set up commands
|
|
139
13
|
let yargsInstance = yargs(hideBin(process.argv));
|
|
140
|
-
// Set up base yargs with
|
|
14
|
+
// Set up base yargs with global options
|
|
141
15
|
yargsInstance = yargsInstance
|
|
142
16
|
.usage('Usage: $0 [command] [options]')
|
|
143
|
-
.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
17
|
+
.options(globalOptions)
|
|
18
|
+
.command('$0', 'Start the 1mcp server (default)', serverOptions, async (argv) => {
|
|
19
|
+
// Default command - redirect to serve command
|
|
20
|
+
configureGlobalLogger(argv, argv.transport);
|
|
21
|
+
const { serveCommand } = await import('./commands/serve/serve.js');
|
|
22
|
+
await serveCommand(argv);
|
|
148
23
|
})
|
|
149
24
|
.env('ONE_MCP') // Enable environment variable parsing with ONE_MCP prefix
|
|
150
25
|
.help()
|
|
151
26
|
.alias('help', 'h');
|
|
152
|
-
// Register command groups
|
|
27
|
+
// Register command groups with global options
|
|
153
28
|
yargsInstance = setupAppCommands(yargsInstance);
|
|
154
29
|
yargsInstance = setupMcpCommands(yargsInstance);
|
|
30
|
+
yargsInstance = setupPresetCommands(yargsInstance);
|
|
31
|
+
yargsInstance = setupServeCommand(yargsInstance);
|
|
155
32
|
/**
|
|
156
|
-
*
|
|
157
|
-
*/
|
|
158
|
-
function setupGracefulShutdown(serverManager, loadingManager, expressServer) {
|
|
159
|
-
const shutdown = async () => {
|
|
160
|
-
logger.info('Shutting down server...');
|
|
161
|
-
// Stop the configuration reload service
|
|
162
|
-
configReloadService.stop();
|
|
163
|
-
// Shutdown loading manager if it exists
|
|
164
|
-
if (loadingManager && typeof loadingManager.shutdown === 'function') {
|
|
165
|
-
try {
|
|
166
|
-
loadingManager.shutdown();
|
|
167
|
-
logger.info('Loading manager shutdown complete');
|
|
168
|
-
}
|
|
169
|
-
catch (error) {
|
|
170
|
-
logger.error(`Error shutting down loading manager: ${error}`);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
// Shutdown ExpressServer if it exists
|
|
174
|
-
if (expressServer) {
|
|
175
|
-
try {
|
|
176
|
-
expressServer.shutdown();
|
|
177
|
-
logger.info('ExpressServer shutdown complete');
|
|
178
|
-
}
|
|
179
|
-
catch (error) {
|
|
180
|
-
logger.error(`Error shutting down ExpressServer: ${error}`);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
// Close all transports
|
|
184
|
-
for (const [sessionId, transport] of serverManager.getTransports().entries()) {
|
|
185
|
-
try {
|
|
186
|
-
transport?.close();
|
|
187
|
-
logger.info(`Closed transport: ${sessionId}`);
|
|
188
|
-
}
|
|
189
|
-
catch (error) {
|
|
190
|
-
logger.error(`Error closing transport ${sessionId}: ${error}`);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
logger.info('Server shutdown complete');
|
|
194
|
-
process.exit(0);
|
|
195
|
-
};
|
|
196
|
-
// Handle various signals for graceful shutdown
|
|
197
|
-
process.on('SIGINT', shutdown);
|
|
198
|
-
process.on('SIGTERM', shutdown);
|
|
199
|
-
process.on('SIGHUP', shutdown);
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Check if the command is a CLI command that should not start the server
|
|
203
|
-
*/
|
|
204
|
-
function isCliCommand(argv) {
|
|
205
|
-
return argv.length >= 3 && (argv[2] === 'app' || argv[2] === 'mcp');
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Check if the command is the serve command (or should default to serve)
|
|
209
|
-
*/
|
|
210
|
-
function isServeCommand(argv) {
|
|
211
|
-
// If no command specified (length < 3) or first arg is not a known command, default to serve
|
|
212
|
-
if (argv.length < 3)
|
|
213
|
-
return true;
|
|
214
|
-
// If explicitly called serve
|
|
215
|
-
if (argv[2] === 'serve')
|
|
216
|
-
return true;
|
|
217
|
-
// If the third argument starts with '-', it's likely a flag, so default to serve
|
|
218
|
-
if (argv[2].startsWith('-'))
|
|
219
|
-
return true;
|
|
220
|
-
// Otherwise it's some other command
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Start the server using the specified transport.
|
|
33
|
+
* Check for conflicting global options (options specified both before and after the command)
|
|
225
34
|
*/
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
35
|
+
function checkGlobalOptionConflicts(argv) {
|
|
36
|
+
const globalOptionNames = Object.keys(globalOptions).map((key) => (key.startsWith('--') ? key.slice(2) : key));
|
|
37
|
+
const globalOptionAliases = Object.values(globalOptions)
|
|
38
|
+
.map((opt) => ('alias' in opt ? opt.alias : null))
|
|
39
|
+
.filter(Boolean);
|
|
40
|
+
const allGlobalOptions = [...globalOptionNames, ...globalOptionAliases];
|
|
41
|
+
const commandIndex = argv.findIndex((arg) => arg === 'app' || arg === 'mcp' || arg === 'preset' || arg === 'serve');
|
|
42
|
+
if (commandIndex === -1)
|
|
230
43
|
return;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
// Configure logger with CLI options and transport awareness
|
|
242
|
-
configureLogger({
|
|
243
|
-
logLevel: parsedArgv['log-level'],
|
|
244
|
-
logFile: parsedArgv['log-file'],
|
|
245
|
-
transport: parsedArgv.transport,
|
|
246
|
-
});
|
|
247
|
-
if (parsedArgv.transport !== 'stdio' && !parsedArgv['log-file']) {
|
|
248
|
-
displayLogo();
|
|
44
|
+
const beforeCommandArgs = argv.slice(0, commandIndex);
|
|
45
|
+
const afterCommandArgs = argv.slice(commandIndex + 1);
|
|
46
|
+
const beforeGlobalOptions = new Set();
|
|
47
|
+
const afterGlobalOptions = new Set();
|
|
48
|
+
// Parse global options before command
|
|
49
|
+
for (let i = 0; i < beforeCommandArgs.length; i++) {
|
|
50
|
+
const arg = beforeCommandArgs[i];
|
|
51
|
+
const optionName = arg.replace(/^--?/, '');
|
|
52
|
+
if (allGlobalOptions.includes(optionName)) {
|
|
53
|
+
beforeGlobalOptions.add(optionName);
|
|
249
54
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
// Handle trust proxy configuration (convert 'true'/'false' strings to boolean)
|
|
258
|
-
const trustProxyValue = parsedArgv['trust-proxy'];
|
|
259
|
-
const trustProxy = trustProxyValue === 'true' ? true : trustProxyValue === 'false' ? false : trustProxyValue;
|
|
260
|
-
serverConfigManager.updateConfig({
|
|
261
|
-
host: parsedArgv.host,
|
|
262
|
-
port: parsedArgv.port,
|
|
263
|
-
externalUrl: parsedArgv['external-url'],
|
|
264
|
-
trustProxy,
|
|
265
|
-
auth: {
|
|
266
|
-
enabled: authEnabled,
|
|
267
|
-
sessionTtlMinutes: parsedArgv['session-ttl'],
|
|
268
|
-
sessionStoragePath: parsedArgv['session-storage-path'],
|
|
269
|
-
oauthCodeTtlMs: 60 * 1000, // 1 minute
|
|
270
|
-
oauthTokenTtlMs: parsedArgv['session-ttl'] * 60 * 1000, // Convert minutes to milliseconds
|
|
271
|
-
},
|
|
272
|
-
rateLimit: {
|
|
273
|
-
windowMs: parsedArgv['rate-limit-window'] * 60 * 1000, // Convert minutes to milliseconds
|
|
274
|
-
max: parsedArgv['rate-limit-max'],
|
|
275
|
-
},
|
|
276
|
-
features: {
|
|
277
|
-
auth: authEnabled,
|
|
278
|
-
scopeValidation: scopeValidationEnabled,
|
|
279
|
-
enhancedSecurity: enhancedSecurityEnabled,
|
|
280
|
-
},
|
|
281
|
-
health: {
|
|
282
|
-
detailLevel: parsedArgv['health-info-level'],
|
|
283
|
-
},
|
|
284
|
-
...(parsedArgv['enable-async-loading'] && {
|
|
285
|
-
asyncLoading: {
|
|
286
|
-
enabled: true,
|
|
287
|
-
},
|
|
288
|
-
}),
|
|
289
|
-
});
|
|
290
|
-
// Initialize server and get server manager with custom config path if provided
|
|
291
|
-
const { serverManager, loadingManager, asyncOrchestrator } = await setupServer();
|
|
292
|
-
let expressServer;
|
|
293
|
-
switch (parsedArgv.transport) {
|
|
294
|
-
case 'stdio': {
|
|
295
|
-
// Use stdio transport
|
|
296
|
-
const transport = new StdioServerTransport();
|
|
297
|
-
// Parse and validate tags/tag-filter from CLI if provided
|
|
298
|
-
let tags;
|
|
299
|
-
let tagExpression;
|
|
300
|
-
let tagFilterMode = 'none';
|
|
301
|
-
if (parsedArgv.tags) {
|
|
302
|
-
// Legacy simple OR filtering
|
|
303
|
-
tags = TagQueryParser.parseSimple(parsedArgv.tags);
|
|
304
|
-
tagFilterMode = 'simple-or';
|
|
305
|
-
if (!tags || tags.length === 0) {
|
|
306
|
-
logger.warn('No valid tags provided, ignoring tags parameter');
|
|
307
|
-
tags = undefined;
|
|
308
|
-
tagFilterMode = 'none';
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
else if (parsedArgv['tag-filter']) {
|
|
312
|
-
// New advanced expression filtering
|
|
313
|
-
try {
|
|
314
|
-
tagExpression = TagQueryParser.parseAdvanced(parsedArgv['tag-filter']);
|
|
315
|
-
tagFilterMode = 'advanced';
|
|
316
|
-
// Provide simple tags for backward compat where possible
|
|
317
|
-
if (tagExpression.type === 'tag') {
|
|
318
|
-
tags = [tagExpression.value];
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
catch (error) {
|
|
322
|
-
logger.error(`Invalid tag-filter expression: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
323
|
-
process.exit(1);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
await serverManager.connectTransport(transport, 'stdio', {
|
|
327
|
-
tags,
|
|
328
|
-
tagExpression,
|
|
329
|
-
tagFilterMode,
|
|
330
|
-
enablePagination: parsedArgv.pagination,
|
|
331
|
-
});
|
|
332
|
-
// Initialize notifications for async loading if enabled
|
|
333
|
-
if (asyncOrchestrator) {
|
|
334
|
-
const inboundConnection = serverManager.getServer('stdio');
|
|
335
|
-
if (inboundConnection) {
|
|
336
|
-
asyncOrchestrator.initializeNotifications(inboundConnection);
|
|
337
|
-
logger.info('Async loading notifications initialized for stdio transport');
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
logger.info('Server started with stdio transport');
|
|
341
|
-
break;
|
|
342
|
-
}
|
|
343
|
-
case 'sse': {
|
|
344
|
-
logger.warning('sse option is deprecated, use http instead');
|
|
345
|
-
}
|
|
346
|
-
// eslint-disable-next-line no-fallthrough
|
|
347
|
-
case 'http': {
|
|
348
|
-
// Use HTTP/SSE transport
|
|
349
|
-
expressServer = new ExpressServer(serverManager, loadingManager, asyncOrchestrator);
|
|
350
|
-
expressServer.start();
|
|
351
|
-
break;
|
|
352
|
-
}
|
|
353
|
-
default:
|
|
354
|
-
logger.error(`Invalid transport: ${parsedArgv.transport}`);
|
|
355
|
-
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
// Parse global options after command
|
|
57
|
+
for (let i = 0; i < afterCommandArgs.length; i++) {
|
|
58
|
+
const arg = afterCommandArgs[i];
|
|
59
|
+
const optionName = arg.replace(/^--?/, '');
|
|
60
|
+
if (allGlobalOptions.includes(optionName)) {
|
|
61
|
+
afterGlobalOptions.add(optionName);
|
|
356
62
|
}
|
|
357
|
-
// Set up graceful shutdown handling
|
|
358
|
-
setupGracefulShutdown(serverManager, loadingManager, expressServer);
|
|
359
|
-
// Log MCP loading progress (non-blocking)
|
|
360
|
-
loadingManager.on('loading-progress', (summary) => {
|
|
361
|
-
logger.info(`MCP loading progress: ${summary.ready}/${summary.totalServers} servers ready (${summary.loading} loading, ${summary.failed} failed)`);
|
|
362
|
-
});
|
|
363
|
-
loadingManager.on('loading-complete', (summary) => {
|
|
364
|
-
logger.info(`MCP loading complete: ${summary.ready}/${summary.totalServers} servers ready (${summary.successRate.toFixed(1)}% success rate)`);
|
|
365
|
-
});
|
|
366
63
|
}
|
|
367
|
-
|
|
368
|
-
|
|
64
|
+
// Check for conflicts
|
|
65
|
+
const conflicts = Array.from(beforeGlobalOptions).filter((opt) => afterGlobalOptions.has(opt));
|
|
66
|
+
if (conflicts.length > 0) {
|
|
67
|
+
console.error(`❌ Error: Cannot specify the following global options both before and after the command: ${conflicts.map((opt) => `--${opt}`).join(', ')}`);
|
|
68
|
+
console.error(' Please specify global options either before OR after the command, not both.');
|
|
69
|
+
console.error(' Example: 1mcp --config test.json mcp list');
|
|
70
|
+
console.error(' OR: 1mcp mcp list --config test.json');
|
|
369
71
|
process.exit(1);
|
|
370
72
|
}
|
|
371
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Main CLI entry point
|
|
76
|
+
*/
|
|
77
|
+
async function main() {
|
|
78
|
+
// Check for global option conflicts before parsing
|
|
79
|
+
checkGlobalOptionConflicts(process.argv);
|
|
80
|
+
// Let yargs handle all command processing
|
|
81
|
+
await yargsInstance.parse();
|
|
82
|
+
}
|
|
372
83
|
main().catch((error) => {
|
|
373
|
-
logger.error('
|
|
84
|
+
logger.error('CLI error:', error);
|
|
374
85
|
process.exit(1);
|
|
375
86
|
});
|
|
376
87
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAiB,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,mDAAmD;AACnD,IAAI,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAEjD,wCAAwC;AACxC,aAAa,GAAG,aAAa;KAC1B,KAAK,CAAC,+BAA+B,CAAC;KACtC,OAAO,CAAC,aAAa,CAAC;KACtB,OAAO,CAAC,IAAI,EAAE,iCAAiC,EAAE,aAAa,EAAE,KAAK,EAAE,IAA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BAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CASlD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAkC9B,QAAA,MAAM,MAAM,gBAYV,CAAC;AAEH;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAI7C;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CASlD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA4D1G;AAED,eAAe,MAAM,CAAC"}
|
package/build/logger/logger.js
CHANGED
|
@@ -87,7 +87,7 @@ export function configureLogger(options) {
|
|
|
87
87
|
format: customFormat,
|
|
88
88
|
level: winstonLevel,
|
|
89
89
|
}));
|
|
90
|
-
// Add console transport except for stdio transport
|
|
90
|
+
// Add console transport except for stdio transport (backward compatibility for serve)
|
|
91
91
|
if (options.transport !== 'stdio') {
|
|
92
92
|
logger.add(new winston.transports.Console({
|
|
93
93
|
format: consoleFormat,
|
|
@@ -97,10 +97,12 @@ export function configureLogger(options) {
|
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
99
|
// Add console transport (default behavior)
|
|
100
|
+
// For stdio transport in serve command, suppress console output to avoid interfering with MCP protocol
|
|
101
|
+
const shouldSilence = options.transport === 'stdio';
|
|
100
102
|
logger.add(new winston.transports.Console({
|
|
101
103
|
format: consoleFormat,
|
|
102
104
|
level: winstonLevel,
|
|
103
|
-
silent:
|
|
105
|
+
silent: shouldSilence,
|
|
104
106
|
}));
|
|
105
107
|
}
|
|
106
108
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,2CAA2C;AAC3C,MAAM,oBAAoB,GAA2B;IACnD,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM,EAAE,yDAAyD;IACvE,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,OAAO;IACjB,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,OAAO;CACnB,CAAC;AAEF,4CAA4C;AAC5C,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CACzC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE;IAC/D,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,OAAO,GAAG,SAAS,KAAK,KAAK,CAAC,WAAW,EAAE,KAAK,OAAO,GAAG,OAAO,EAAE,CAAC;AACtE,CAAC,CAAC,CACH,CAAC;AAEF,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAC1C,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,EAC1B,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,SAAS,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IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;YAC7B,MAAM,EAAE,aAAa;YACrB,KAAK,EAAE,YAAY;YACnB,MAAM,EAAE,aAAa;SACtB,CAAC,CACH,CAAC;IACJ,CAAC;AACH,CAAC;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpLoggingEnhancer.d.ts","sourceRoot":"","sources":["../../src/logger/mcpLoggingEnhancer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"mcpLoggingEnhancer.d.ts","sourceRoot":"","sources":["../../src/logger/mcpLoggingEnhancer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AA8InE;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAwE7D"}
|
|
@@ -108,13 +108,17 @@ export function enhanceServerWithLogging(server) {
|
|
|
108
108
|
const originalSetRequestHandler = server.setRequestHandler.bind(server);
|
|
109
109
|
const originalSetNotificationHandler = server.setNotificationHandler.bind(server);
|
|
110
110
|
const originalNotification = server.notification.bind(server);
|
|
111
|
-
// Override request handler registration
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
// Override request handler registration - cast server to bypass Zod version incompatibilities
|
|
112
|
+
const serverAny = server;
|
|
113
|
+
serverAny.setRequestHandler = (requestSchema, handler) => {
|
|
114
|
+
const wrappedHandler = wrapRequestHandler(handler, requestSchema?._def?.shape?.()
|
|
115
|
+
?.method?._def?.value || 'unknown');
|
|
116
|
+
return originalSetRequestHandler.call(server, requestSchema, wrappedHandler);
|
|
114
117
|
};
|
|
115
|
-
// Override notification handler registration
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
// Override notification handler registration - cast server to bypass Zod version incompatibilities
|
|
119
|
+
serverAny.setNotificationHandler = (notificationSchema, handler) => {
|
|
120
|
+
const wrappedHandler = wrapNotificationHandler(handler, notificationSchema?._def?.shape?.()?.method?._def?.value || 'unknown');
|
|
121
|
+
return originalSetNotificationHandler.call(server, notificationSchema, wrappedHandler);
|
|
118
122
|
};
|
|
119
123
|
// Override notification sending
|
|
120
124
|
server.notification = (notification) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpLoggingEnhancer.js","sourceRoot":"","sources":["../../src/logger/mcpLoggingEnhancer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,MAAM,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"mcpLoggingEnhancer.js","sourceRoot":"","sources":["../../src/logger/mcpLoggingEnhancer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,MAAM,MAAM,aAAa,CAAC;AAwBjC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAsB,CAAC;AAErD;;GAEG;AACH,SAAS,UAAU,CAAC,SAAiB,EAAE,MAAc,EAAE,MAAe;IACpE,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE;QACzB,SAAS;QACT,MAAM;QACN,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QAC9B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAC,SAAiB,EAAE,MAAe,EAAE,QAAgB;IACvE,MAAM,CAAC,IAAI,CAAC,cAAc,EAAE;QAC1B,SAAS;QACT,QAAQ;QACR,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACpC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAS,QAAQ,CAAC,SAAiB,EAAE,KAAc,EAAE,QAAgB;IACnE,MAAM,CAAC,K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ED,+DAA+D;QAC/D,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC;YAElD,mCAAmC;YACnC,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;gBACjD,uCAAuC;gBACvC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;oBACrC,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;wBACtE,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;wBACxE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;oBAC3B,CAAC;oBACD,MAAM,KAAK,CAAC;gBACd,CAAC,CAAC,CAAC;YACL,CAAC;YAED,cAAc;YACd,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;gBACtE,MAAM,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;gBACxE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;YAC3B,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/build/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAI/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAI/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAI3F;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,8CAA8C;IAC9C,aAAa,EAAE,aAAa,CAAC;IAC7B,0DAA0D;IAC1D,cAAc,EAAE,iBAAiB,CAAC;IAClC,gEAAgE;IAChE,cAAc,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,wBAAwB,CAAC;CAC9C;AAED;;;GAGG;AACH,iBAAe,WAAW,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAwBvD;AA6GD;;;GAGG;AACH,iBAAe,iBAAiB,IAAI,OAAO,CAAC,aAAa,CAAC,CAKzD;AAED,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"}
|
package/build/server.js
CHANGED
|
@@ -8,6 +8,8 @@ import { AgentConfigManager } from './core/server/agentConfig.js';
|
|
|
8
8
|
import configReloadService from './services/configReloadService.js';
|
|
9
9
|
import { McpLoadingManager } from './core/loading/mcpLoadingManager.js';
|
|
10
10
|
import { AsyncLoadingOrchestrator } from './core/capabilities/asyncLoadingOrchestrator.js';
|
|
11
|
+
import { PresetManager } from './utils/presetManager.js';
|
|
12
|
+
import { PresetNotificationService } from './utils/presetNotificationService.js';
|
|
11
13
|
/**
|
|
12
14
|
* Main function to set up the MCP server
|
|
13
15
|
* Conditionally uses async or legacy loading based on configuration
|
|
@@ -17,6 +19,8 @@ async function setupServer() {
|
|
|
17
19
|
const mcpConfig = McpConfigManager.getInstance().getTransportConfig();
|
|
18
20
|
const agentConfig = AgentConfigManager.getInstance();
|
|
19
21
|
const asyncLoadingEnabled = agentConfig.isAsyncLoadingEnabled();
|
|
22
|
+
// Initialize preset management system
|
|
23
|
+
await initializePresetSystem();
|
|
20
24
|
// Create transports from configuration
|
|
21
25
|
const transports = createTransports(mcpConfig);
|
|
22
26
|
logger.info(`Created ${Object.keys(transports).length} transports`);
|
|
@@ -92,6 +96,28 @@ async function setupServerSync(transports) {
|
|
|
92
96
|
loadingPromise,
|
|
93
97
|
};
|
|
94
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Initialize the preset management system
|
|
101
|
+
*/
|
|
102
|
+
async function initializePresetSystem() {
|
|
103
|
+
try {
|
|
104
|
+
// Initialize preset manager with file watching
|
|
105
|
+
const presetManager = PresetManager.getInstance();
|
|
106
|
+
await presetManager.initialize();
|
|
107
|
+
// Initialize notification service
|
|
108
|
+
const notificationService = PresetNotificationService.getInstance();
|
|
109
|
+
// Connect preset changes to client notifications
|
|
110
|
+
presetManager.onPresetChange(async (presetName) => {
|
|
111
|
+
logger.debug('Preset changed, sending notifications', { presetName });
|
|
112
|
+
await notificationService.notifyPresetChange(presetName);
|
|
113
|
+
});
|
|
114
|
+
logger.info('Preset management system initialized successfully');
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
logger.error('Failed to initialize preset system', { error });
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
95
121
|
/**
|
|
96
122
|
* Legacy function for backward compatibility
|
|
97
123
|
* @deprecated Use setupServer() which returns ServerSetupResult
|