dexto 1.13.5 → 1.14.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/dist/api/mcp/http-gateway.d.ts +21 -0
- package/dist/api/mcp/http-gateway.d.ts.map +1 -0
- package/dist/api/mcp/http-gateway.js +110 -0
- package/dist/api/mcp/tool-aggregation-handler.d.ts +9 -6
- package/dist/api/mcp/tool-aggregation-handler.d.ts.map +1 -1
- package/dist/api/mcp/tool-aggregation-handler.js +203 -70
- package/dist/api/server-hono.d.ts +2 -0
- package/dist/api/server-hono.d.ts.map +1 -1
- package/dist/api/server-hono.js +377 -276
- package/dist/cli/approval/headless-approval-handler.d.ts +4 -0
- package/dist/cli/approval/headless-approval-handler.d.ts.map +1 -0
- package/dist/cli/approval/headless-approval-handler.js +19 -0
- package/dist/cli/auth/api-client.js +1 -1
- package/dist/cli/auth/constants.d.ts +1 -0
- package/dist/cli/auth/constants.d.ts.map +1 -1
- package/dist/cli/auth/constants.js +2 -1
- package/dist/cli/auth/dexto-api-key.d.ts.map +1 -1
- package/dist/cli/auth/dexto-api-key.js +3 -0
- package/dist/cli/auth/login-persistence.d.ts +1 -1
- package/dist/cli/auth/login-persistence.d.ts.map +1 -1
- package/dist/cli/auth/login-persistence.js +9 -1
- package/dist/cli/auth/service.d.ts +2 -0
- package/dist/cli/auth/service.d.ts.map +1 -1
- package/dist/cli/auth/service.js +1 -0
- package/dist/cli/commands/agents/register.d.ts.map +1 -1
- package/dist/cli/commands/agents/register.js +0 -1
- package/dist/cli/commands/auth/login.d.ts.map +1 -1
- package/dist/cli/commands/auth/login.js +9 -4
- package/dist/cli/commands/cloud/discovery.d.ts +17 -0
- package/dist/cli/commands/cloud/discovery.d.ts.map +1 -0
- package/dist/cli/commands/cloud/discovery.js +88 -0
- package/dist/cli/commands/cloud/register.d.ts +3 -0
- package/dist/cli/commands/cloud/register.d.ts.map +1 -0
- package/dist/cli/commands/cloud/register.js +27 -0
- package/dist/cli/commands/mcp/register.d.ts +1 -1
- package/dist/cli/commands/mcp/register.d.ts.map +1 -1
- package/dist/cli/commands/mcp/register.js +259 -26
- package/dist/cli/commands/mcp/standalone.d.ts +98 -0
- package/dist/cli/commands/mcp/standalone.d.ts.map +1 -0
- package/dist/cli/commands/mcp/standalone.js +489 -0
- package/dist/cli/commands/run/headless.d.ts +3 -1
- package/dist/cli/commands/run/headless.d.ts.map +1 -1
- package/dist/cli/commands/run/headless.js +13 -1
- package/dist/cli/commands/run/output.d.ts +21 -0
- package/dist/cli/commands/run/output.d.ts.map +1 -0
- package/dist/cli/commands/run/output.js +95 -0
- package/dist/cli/commands/run/register.d.ts.map +1 -1
- package/dist/cli/commands/run/register.js +27 -3
- package/dist/cli/commands/setup.d.ts +2 -2
- package/dist/cli/commands/trace/client.d.ts +2 -2
- package/dist/cli/utils/options.js +3 -1
- package/dist/config/cli-overrides.d.ts +3 -1
- package/dist/config/cli-overrides.d.ts.map +1 -1
- package/dist/config/cli-overrides.js +9 -3
- package/dist/index-main.js +14 -11
- package/dist/utils/env.d.ts +2 -0
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +6 -0
- package/dist/utils/graceful-shutdown.d.ts +1 -1
- package/dist/utils/graceful-shutdown.d.ts.map +1 -1
- package/dist/utils/graceful-shutdown.js +28 -9
- package/package.json +14 -14
|
@@ -1,13 +1,21 @@
|
|
|
1
|
+
import { Option } from 'commander';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { isIP } from 'node:net';
|
|
4
|
+
import { registerGracefulShutdown } from '../../../utils/graceful-shutdown.js';
|
|
1
5
|
import { withAnalytics, safeExit, ExitSignal } from '../../../analytics/wrapper.js';
|
|
2
6
|
export function registerMcpCommand({ program }) {
|
|
3
|
-
|
|
4
|
-
// dexto --mode mcp will be moved to this sub-command in the future
|
|
5
|
-
program
|
|
7
|
+
const mcp = program
|
|
6
8
|
.command('mcp')
|
|
7
|
-
.description('
|
|
8
|
-
|
|
9
|
+
.description('Configure and call MCP servers, or expose them through an aggregation gateway')
|
|
10
|
+
.option('--config <path>', 'MCP-only YAML configuration (otherwise use --agent)')
|
|
9
11
|
.option('-s, --strict', 'Require all MCP server connections to succeed')
|
|
10
12
|
.option('--group-servers', 'Aggregate and re-expose tools from configured MCP servers (required for now)')
|
|
13
|
+
.addOption(new Option('--transport <transport>', 'Gateway transport')
|
|
14
|
+
.choices(['stdio', 'http'])
|
|
15
|
+
.default('stdio'))
|
|
16
|
+
.option('--host <host>', 'HTTP gateway bind address', '127.0.0.1')
|
|
17
|
+
.option('--port <port>', 'HTTP gateway port', '3001')
|
|
18
|
+
.option('--no-auth', 'Allow HTTP access without a gateway key (external ingress must own authentication)')
|
|
11
19
|
.option('--name <n>', 'Name for the MCP server', 'dexto-tools')
|
|
12
20
|
.option('--version <version>', 'Version for the MCP server', '1.0.0')
|
|
13
21
|
.action(withAnalytics('mcp', async (options) => {
|
|
@@ -19,46 +27,271 @@ export function registerMcpCommand({ program }) {
|
|
|
19
27
|
safeExit('mcp', 1, 'missing-group-servers');
|
|
20
28
|
return;
|
|
21
29
|
}
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
const apiKey = process.env.DEXTO_SERVER_API_KEY;
|
|
31
|
+
const loopback = options.host === '127.0.0.1' || options.host === '::1';
|
|
32
|
+
const port = Number(options.port);
|
|
33
|
+
if (options.transport === 'http') {
|
|
34
|
+
if (!/^\d+$/.test(options.port) ||
|
|
35
|
+
!Number.isInteger(port) ||
|
|
36
|
+
port < 1 ||
|
|
37
|
+
port > 65535) {
|
|
38
|
+
process.stderr.write('MCP HTTP port must be an integer from 1 to 65535.\n');
|
|
39
|
+
safeExit('mcp', 1, 'mcp-http-invalid-port');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (options.auth && !loopback && !apiKey) {
|
|
43
|
+
process.stderr.write('Network-facing MCP HTTP requires DEXTO_SERVER_API_KEY or explicit --no-auth for an authenticated ingress.\n');
|
|
44
|
+
safeExit('mcp', 1, 'mcp-http-auth-required');
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const { logger, ServersConfigSchema } = await import('@dexto/core');
|
|
49
|
+
let servers;
|
|
50
|
+
if (options.config) {
|
|
51
|
+
const { loadStandaloneMcpConfiguration } = await import('./standalone.js');
|
|
52
|
+
servers = (await loadStandaloneMcpConfiguration(resolve(options.config), false)).servers;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const { resolveAgentPath, loadAgentConfig } = await import('@dexto/agent-management');
|
|
56
|
+
const globalOpts = program.opts();
|
|
57
|
+
const configPath = await resolveAgentPath(globalOpts.agent, globalOpts.autoInstall !== false);
|
|
58
|
+
servers = (await loadAgentConfig(configPath)).mcpServers;
|
|
59
|
+
}
|
|
60
|
+
if (!servers || Object.keys(servers).length === 0) {
|
|
61
|
+
process.stderr.write('No MCP servers configured. Add a server or choose --config.\n');
|
|
36
62
|
safeExit('mcp', 1, 'no-mcp-servers');
|
|
37
63
|
return;
|
|
38
64
|
}
|
|
39
|
-
const validatedServers = ServersConfigSchema.parse(
|
|
65
|
+
const validatedServers = ServersConfigSchema.parse(servers);
|
|
40
66
|
logger.info(`Validated MCP servers. Configured servers: ${Object.keys(validatedServers).join(', ')}`);
|
|
41
|
-
const [{ createMcpTransport }, { initializeMcpToolAggregationServer }] = await Promise.all([
|
|
42
|
-
import('@dexto/server'),
|
|
43
|
-
import('../../../api/mcp/tool-aggregation-handler.js'),
|
|
44
|
-
]);
|
|
45
67
|
// Logs are already redirected to file by default to prevent interference with stdio transport
|
|
46
68
|
const currentLogPath = logger.getLogFilePath();
|
|
47
69
|
logger.info(`MCP mode using log file: ${currentLogPath || 'default .dexto location'}`);
|
|
48
70
|
logger.info(`Starting MCP tool aggregation server: ${options.name} v${options.version}`);
|
|
71
|
+
if (options.transport === 'http') {
|
|
72
|
+
const [{ startMcpHttpAggregationGateway }, { createRequiredBearerAuthorization },] = await Promise.all([
|
|
73
|
+
import('../../../api/mcp/http-gateway.js'),
|
|
74
|
+
import('@dexto/server/hono/auth'),
|
|
75
|
+
]);
|
|
76
|
+
const startup = startMcpHttpAggregationGateway(validatedServers, {
|
|
77
|
+
name: options.name,
|
|
78
|
+
version: options.version,
|
|
79
|
+
strict: options.strict ?? false,
|
|
80
|
+
host: options.host,
|
|
81
|
+
port,
|
|
82
|
+
authorize: options.auth && apiKey
|
|
83
|
+
? createRequiredBearerAuthorization(apiKey)
|
|
84
|
+
: () => ({ allowed: true }),
|
|
85
|
+
});
|
|
86
|
+
const dispose = registerGracefulShutdown(() => ({
|
|
87
|
+
stop: async () => {
|
|
88
|
+
try {
|
|
89
|
+
await (await startup).close();
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
throw new Error('MCP shutdown failed');
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
dispose();
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
}));
|
|
99
|
+
try {
|
|
100
|
+
const owner = await startup;
|
|
101
|
+
const host = isIP(options.host) === 6 ? `[${options.host}]` : options.host;
|
|
102
|
+
process.stderr.write(`MCP HTTP gateway listening on http://${host}:${owner.port}/mcp\n`);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
dispose();
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const [{ createMcpTransport }, { initializeMcpToolAggregationServer }] = await Promise.all([
|
|
111
|
+
import('@dexto/server'),
|
|
112
|
+
import('../../../api/mcp/tool-aggregation-handler.js'),
|
|
113
|
+
]);
|
|
49
114
|
// Create stdio transport for MCP tool aggregation
|
|
50
115
|
const mcpTransport = await createMcpTransport('stdio');
|
|
51
116
|
const strictMode = options.strict ?? false;
|
|
52
117
|
// Initialize tool aggregation server
|
|
53
|
-
await initializeMcpToolAggregationServer(validatedServers, mcpTransport, options.name, options.version, strictMode);
|
|
118
|
+
const owner = await initializeMcpToolAggregationServer(validatedServers, mcpTransport, options.name, options.version, strictMode);
|
|
119
|
+
const dispose = registerGracefulShutdown(() => ({
|
|
120
|
+
stop: async () => {
|
|
121
|
+
try {
|
|
122
|
+
await owner.close();
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
throw new Error('MCP shutdown failed');
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
}));
|
|
129
|
+
const closeOnEnd = () => {
|
|
130
|
+
void owner.close().catch(() => {
|
|
131
|
+
process.stderr.write('MCP shutdown failed.\n');
|
|
132
|
+
process.exitCode = 1;
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
process.stdin.once('end', closeOnEnd);
|
|
136
|
+
const previousClose = owner.server.onclose;
|
|
137
|
+
owner.server.onclose = () => {
|
|
138
|
+
try {
|
|
139
|
+
previousClose?.();
|
|
140
|
+
}
|
|
141
|
+
finally {
|
|
142
|
+
dispose();
|
|
143
|
+
process.stdin.off('end', closeOnEnd);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
54
146
|
logger.info('MCP tool aggregation server started successfully');
|
|
55
147
|
}
|
|
56
148
|
catch (err) {
|
|
57
149
|
if (err instanceof ExitSignal)
|
|
58
150
|
throw err;
|
|
59
151
|
// Write to stderr to avoid interfering with MCP protocol
|
|
60
|
-
process.stderr.write(
|
|
152
|
+
process.stderr.write('MCP tool aggregation server startup failed. Check configuration, credentials and server availability.\n');
|
|
61
153
|
safeExit('mcp', 1, 'mcp-agg-failed');
|
|
62
154
|
}
|
|
63
155
|
}, { timeoutMs: 0 }));
|
|
156
|
+
mcp.hook('preAction', (_, actionCommand) => {
|
|
157
|
+
if (actionCommand === mcp || actionCommand.getOptionValueSource('config') !== 'default')
|
|
158
|
+
return;
|
|
159
|
+
const parentConfig = mcp.opts().config;
|
|
160
|
+
if (parentConfig !== undefined)
|
|
161
|
+
actionCommand.setOptionValueWithSource('config', parentConfig, 'implied');
|
|
162
|
+
});
|
|
163
|
+
const list = mcp.command('list').description('List configured MCP servers without connecting');
|
|
164
|
+
list.option('--config <path>', 'MCP-only YAML configuration', '.dexto/mcp.yml').option('--json', 'Emit machine-readable JSON');
|
|
165
|
+
list.action(async (options) => {
|
|
166
|
+
const { runStandaloneMcp } = await import('./standalone.js');
|
|
167
|
+
const result = await runStandaloneMcp({ command: 'list' }, options);
|
|
168
|
+
printStandaloneResult(result, options.json);
|
|
169
|
+
});
|
|
170
|
+
const connect = mcp
|
|
171
|
+
.command('connect <server>')
|
|
172
|
+
.description('Probe a server connection, then close it');
|
|
173
|
+
connect
|
|
174
|
+
.option('--config <path>', 'MCP-only YAML configuration', '.dexto/mcp.yml')
|
|
175
|
+
.option('--json', 'Emit machine-readable JSON');
|
|
176
|
+
connect.action(async (server, options) => {
|
|
177
|
+
const { runStandaloneMcp } = await import('./standalone.js');
|
|
178
|
+
const result = await runStandaloneMcp({ command: 'connect', server }, options);
|
|
179
|
+
printStandaloneResult(result, options.json);
|
|
180
|
+
});
|
|
181
|
+
const call = mcp
|
|
182
|
+
.command('call <server> <tool>')
|
|
183
|
+
.description('Call an explicitly selected upstream MCP tool, then close the connection');
|
|
184
|
+
call.option('--config <path>', 'MCP-only YAML configuration', '.dexto/mcp.yml')
|
|
185
|
+
.option('--json', 'Emit machine-readable JSON')
|
|
186
|
+
.option('--arguments <json>', 'Tool arguments as a JSON object', '{}');
|
|
187
|
+
call.action(async (server, tool, options) => {
|
|
188
|
+
const { runStandaloneMcp } = await import('./standalone.js');
|
|
189
|
+
const result = await runStandaloneMcp({ command: 'call', server, tool, argumentsJson: options.arguments }, options);
|
|
190
|
+
printStandaloneResult(result, options.json);
|
|
191
|
+
});
|
|
192
|
+
const tools = mcp.command('tools <server>').description('List upstream MCP tools and schemas');
|
|
193
|
+
tools
|
|
194
|
+
.option('--config <path>', 'MCP-only YAML configuration', '.dexto/mcp.yml')
|
|
195
|
+
.option('--json', 'Emit machine-readable JSON');
|
|
196
|
+
tools.action(async (server, options) => {
|
|
197
|
+
const { runStandaloneMcp } = await import('./standalone.js');
|
|
198
|
+
const result = await runStandaloneMcp({ command: 'tools', server }, options);
|
|
199
|
+
printStandaloneResult(result, options.json);
|
|
200
|
+
});
|
|
201
|
+
const resources = mcp
|
|
202
|
+
.command('resources <server>')
|
|
203
|
+
.description('List upstream MCP resource metadata');
|
|
204
|
+
resources
|
|
205
|
+
.option('--config <path>', 'MCP-only YAML configuration', '.dexto/mcp.yml')
|
|
206
|
+
.option('--json', 'Emit machine-readable JSON');
|
|
207
|
+
resources.action(async (server, options) => {
|
|
208
|
+
const { runStandaloneMcp } = await import('./standalone.js');
|
|
209
|
+
const result = await runStandaloneMcp({ command: 'resources', server }, options);
|
|
210
|
+
printStandaloneResult(result, options.json);
|
|
211
|
+
});
|
|
212
|
+
const readResource = mcp
|
|
213
|
+
.command('read-resource <server> <uri>')
|
|
214
|
+
.description('Read an exact upstream MCP resource, then close the connection');
|
|
215
|
+
readResource
|
|
216
|
+
.option('--config <path>', 'MCP-only YAML configuration', '.dexto/mcp.yml')
|
|
217
|
+
.option('--json', 'Emit machine-readable JSON');
|
|
218
|
+
readResource.action(async (server, uri, options) => {
|
|
219
|
+
const { runStandaloneMcp } = await import('./standalone.js');
|
|
220
|
+
const result = await runStandaloneMcp({ command: 'read-resource', server, uri }, options);
|
|
221
|
+
printStandaloneResult(result, options.json);
|
|
222
|
+
});
|
|
223
|
+
const prompts = mcp
|
|
224
|
+
.command('prompts <server>')
|
|
225
|
+
.description('List upstream MCP prompt metadata');
|
|
226
|
+
prompts
|
|
227
|
+
.option('--config <path>', 'MCP-only YAML configuration', '.dexto/mcp.yml')
|
|
228
|
+
.option('--json', 'Emit machine-readable JSON');
|
|
229
|
+
prompts.action(async (server, options) => {
|
|
230
|
+
const { runStandaloneMcp } = await import('./standalone.js');
|
|
231
|
+
const result = await runStandaloneMcp({ command: 'prompts', server }, options);
|
|
232
|
+
printStandaloneResult(result, options.json);
|
|
233
|
+
});
|
|
234
|
+
const getPrompt = mcp
|
|
235
|
+
.command('get-prompt <server> <prompt>')
|
|
236
|
+
.description('Render an exact upstream MCP prompt, then close the connection');
|
|
237
|
+
getPrompt
|
|
238
|
+
.option('--config <path>', 'MCP-only YAML configuration', '.dexto/mcp.yml')
|
|
239
|
+
.option('--json', 'Emit machine-readable JSON')
|
|
240
|
+
.option('--arguments <json>', 'Prompt arguments as a JSON object of strings', '{}');
|
|
241
|
+
getPrompt.action(async (server, prompt, options) => {
|
|
242
|
+
const { runStandaloneMcp } = await import('./standalone.js');
|
|
243
|
+
const result = await runStandaloneMcp({ command: 'get-prompt', server, prompt, argumentsJson: options.arguments }, options);
|
|
244
|
+
printStandaloneResult(result, options.json);
|
|
245
|
+
});
|
|
246
|
+
const add = mcp.command('add <server>').description('Add MCP server configuration');
|
|
247
|
+
add.option('--config <path>', 'MCP-only YAML configuration', '.dexto/mcp.yml')
|
|
248
|
+
.option('--json', 'Emit machine-readable JSON')
|
|
249
|
+
.option('--server-config <json>', 'Server configuration as a JSON object')
|
|
250
|
+
.option('--transport <type>', 'stdio, http or sse (inferred from command or URL)')
|
|
251
|
+
.option('--command <executable>', 'Local stdio server executable')
|
|
252
|
+
.option('--arg <value>', 'Server argument (repeat; use --arg=--flag for option arguments)', appendOption)
|
|
253
|
+
.option('--env <NAME=VALUE>', 'Server environment assignment (repeat)', appendOption)
|
|
254
|
+
.option('--url <url>', 'Remote MCP endpoint')
|
|
255
|
+
.option('--header <NAME=VALUE>', 'Remote request header (repeat)', appendOption)
|
|
256
|
+
.option('--replace', 'Replace an existing server');
|
|
257
|
+
add.action(async (server, options) => {
|
|
258
|
+
const { runStandaloneMcp, serverConfigurationFromOptions } = await import('./standalone.js');
|
|
259
|
+
let result;
|
|
260
|
+
try {
|
|
261
|
+
result = await runStandaloneMcp({
|
|
262
|
+
command: 'add',
|
|
263
|
+
server,
|
|
264
|
+
serverConfig: serverConfigurationFromOptions(options),
|
|
265
|
+
...(options.replace ? { replace: true } : {}),
|
|
266
|
+
}, options);
|
|
267
|
+
}
|
|
268
|
+
catch {
|
|
269
|
+
result = {
|
|
270
|
+
exitCode: 2,
|
|
271
|
+
output: {
|
|
272
|
+
error: {
|
|
273
|
+
code: 'invalid_setup_options',
|
|
274
|
+
message: 'Use --command with --arg/--env, --url with --header, or --server-config by itself.',
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
printStandaloneResult(result, options.json);
|
|
280
|
+
});
|
|
281
|
+
const remove = mcp.command('remove <server>').description('Remove configured MCP server');
|
|
282
|
+
remove
|
|
283
|
+
.option('--config <path>', 'MCP-only YAML configuration', '.dexto/mcp.yml')
|
|
284
|
+
.option('--json', 'Emit machine-readable JSON');
|
|
285
|
+
remove.action(async (server, options) => {
|
|
286
|
+
const { runStandaloneMcp } = await import('./standalone.js');
|
|
287
|
+
const result = await runStandaloneMcp({ command: 'remove', server }, options);
|
|
288
|
+
printStandaloneResult(result, options.json);
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
function appendOption(value, previous = []) {
|
|
292
|
+
return [...previous, value];
|
|
293
|
+
}
|
|
294
|
+
function printStandaloneResult(result, compact) {
|
|
295
|
+
process.stdout.write(JSON.stringify(result.output, null, compact ? undefined : 2) + '\n');
|
|
296
|
+
process.exitCode = result.exitCode;
|
|
64
297
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { parseDocument } from 'yaml';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const documentSchema: z.ZodObject<{
|
|
4
|
+
mcpServers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
|
+
type: z.ZodLiteral<"stdio">;
|
|
6
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
timeout: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
8
|
+
connectionMode: z.ZodDefault<z.ZodEnum<{
|
|
9
|
+
strict: "strict";
|
|
10
|
+
lenient: "lenient";
|
|
11
|
+
}>>;
|
|
12
|
+
command: z.ZodString;
|
|
13
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
14
|
+
env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
15
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
16
|
+
type: z.ZodLiteral<"http">;
|
|
17
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
18
|
+
timeout: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
19
|
+
connectionMode: z.ZodDefault<z.ZodEnum<{
|
|
20
|
+
strict: "strict";
|
|
21
|
+
lenient: "lenient";
|
|
22
|
+
}>>;
|
|
23
|
+
url: z.ZodString;
|
|
24
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
25
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"sse">;
|
|
27
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
28
|
+
timeout: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
29
|
+
connectionMode: z.ZodDefault<z.ZodEnum<{
|
|
30
|
+
strict: "strict";
|
|
31
|
+
lenient: "lenient";
|
|
32
|
+
}>>;
|
|
33
|
+
url: z.ZodString;
|
|
34
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
35
|
+
}, z.core.$strict>], "type">>>;
|
|
36
|
+
}, z.core.$loose>;
|
|
37
|
+
type McpOperation = {
|
|
38
|
+
command: 'connect' | 'tools' | 'resources' | 'prompts';
|
|
39
|
+
server: string;
|
|
40
|
+
} | {
|
|
41
|
+
command: 'call';
|
|
42
|
+
server: string;
|
|
43
|
+
tool: string;
|
|
44
|
+
argumentsJson: string;
|
|
45
|
+
} | {
|
|
46
|
+
command: 'read-resource';
|
|
47
|
+
server: string;
|
|
48
|
+
uri: string;
|
|
49
|
+
} | {
|
|
50
|
+
command: 'get-prompt';
|
|
51
|
+
server: string;
|
|
52
|
+
prompt: string;
|
|
53
|
+
arguments: Record<string, string>;
|
|
54
|
+
};
|
|
55
|
+
export type StandaloneMcpCommand = {
|
|
56
|
+
command: 'list';
|
|
57
|
+
} | Exclude<McpOperation, {
|
|
58
|
+
command: 'get-prompt';
|
|
59
|
+
}> | {
|
|
60
|
+
command: 'get-prompt';
|
|
61
|
+
server: string;
|
|
62
|
+
prompt: string;
|
|
63
|
+
argumentsJson: string;
|
|
64
|
+
} | {
|
|
65
|
+
command: 'remove';
|
|
66
|
+
server: string;
|
|
67
|
+
} | {
|
|
68
|
+
command: 'add';
|
|
69
|
+
server: string;
|
|
70
|
+
serverConfig: string;
|
|
71
|
+
replace?: boolean;
|
|
72
|
+
};
|
|
73
|
+
export interface StandaloneMcpOptions {
|
|
74
|
+
config?: string;
|
|
75
|
+
}
|
|
76
|
+
export interface StandaloneMcpResult {
|
|
77
|
+
exitCode: number;
|
|
78
|
+
output: unknown;
|
|
79
|
+
}
|
|
80
|
+
export declare function runStandaloneMcp(command: StandaloneMcpCommand, options: StandaloneMcpOptions): Promise<StandaloneMcpResult>;
|
|
81
|
+
/** Load MCP-only YAML for direct commands or the aggregation host without agent setup. */
|
|
82
|
+
export declare function loadStandaloneMcpConfiguration(path: string, allowMissing: boolean): Promise<{
|
|
83
|
+
document: ReturnType<typeof parseDocument>;
|
|
84
|
+
servers: z.output<typeof documentSchema>['mcpServers'];
|
|
85
|
+
}>;
|
|
86
|
+
export interface McpAddOptions {
|
|
87
|
+
serverConfig?: string;
|
|
88
|
+
transport?: string;
|
|
89
|
+
command?: string;
|
|
90
|
+
arg?: string[];
|
|
91
|
+
env?: string[];
|
|
92
|
+
url?: string;
|
|
93
|
+
header?: string[];
|
|
94
|
+
}
|
|
95
|
+
/** Convert CLI setup forms to literal configuration without expanding credentials. */
|
|
96
|
+
export declare function serverConfigurationFromOptions(options: McpAddOptions): string;
|
|
97
|
+
export {};
|
|
98
|
+
//# sourceMappingURL=standalone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/mcp/standalone.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2BxB,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEF,CAAC;AACnB,KAAK,YAAY,GACX;IAAE,OAAO,EAAE,SAAS,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1E;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GACxE;IAAE,OAAO,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GACzD;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AACnG,MAAM,MAAM,oBAAoB,GAC1B;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GACnB,OAAO,CAAC,YAAY,EAAE;IAAE,OAAO,EAAE,YAAY,CAAA;CAAE,CAAC,GAChD;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,GAChF;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAClF,MAAM,WAAW,oBAAoB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,mBAAmB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,gBAAgB,CAClC,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,oBAAoB,GAC9B,OAAO,CAAC,mBAAmB,CAAC,CA4G9B;AAsJD,0FAA0F;AAC1F,wBAAsB,8BAA8B,CAChD,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,OAAO,GACtB,OAAO,CAAC;IACP,QAAQ,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC,YAAY,CAAC,CAAC;CAC1D,CAAC,CA8BD;AAsLD,MAAM,WAAW,aAAa;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,sFAAsF;AACtF,wBAAgB,8BAA8B,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAkC7E"}
|