|
11 | 11 |
|
12 | 12 | import { resolve } from "node:path"; |
13 | 13 | import { parseArgs } from "node:util"; |
| 14 | +import open from "open"; |
14 | 15 | import { |
15 | 16 | formatConfigWarning, |
16 | 17 | getMcpServers, |
17 | 18 | resolveConfigFiles, |
18 | 19 | } from "./config.js"; |
| 20 | +import type { McpClientConfig } from "./mcp-client.js"; |
19 | 21 | import { generateClient, writeGeneratedClient } from "./pipeline.js"; |
20 | 22 | import { runInteractiveSetup, showGenerationProgress } from "./prompts.js"; |
21 | 23 | import type { McpServerConfig } from "./types.js"; |
22 | 24 |
|
| 25 | +/** Default client config for CLI - enables browser-based OAuth */ |
| 26 | +const CLI_CLIENT_CONFIG: McpClientConfig = { |
| 27 | + oauth: { launch: open }, |
| 28 | +}; |
| 29 | + |
23 | 30 | /** |
24 | 31 | * CLI execution modes - explicitly modeled for clarity and extensibility. |
25 | 32 | * |
@@ -172,6 +179,7 @@ async function runGeneration(servers: McpServerConfig[], outputFile: string) { |
172 | 179 |
|
173 | 180 | const result = await showGenerationProgress(servers, () => |
174 | 181 | generateClient(servers, { |
| 182 | + clientConfig: CLI_CLIENT_CONFIG, |
175 | 183 | treeShakable: true, |
176 | 184 | outputPath: absoluteOutput, |
177 | 185 | }), |
@@ -213,7 +221,10 @@ async function main() { |
213 | 221 | await runGeneration([server], mode.output); |
214 | 222 | } else { |
215 | 223 | // Stdout: just output the code |
216 | | - const result = await generateClient([server], { treeShakable: true }); |
| 224 | + const result = await generateClient([server], { |
| 225 | + clientConfig: CLI_CLIENT_CONFIG, |
| 226 | + treeShakable: true, |
| 227 | + }); |
217 | 228 | process.stdout.write(result.code); |
218 | 229 | } |
219 | 230 | } catch (error) { |
|
0 commit comments