Skip to content

Commit add5ccd

Browse files
authored
fix: enable browser OAuth flow in CLI (#6)
1 parent 32bb7b3 commit add5ccd

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mcp-client-gen",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "Generate type-safe TypeScript clients from MCP (Model Context Protocol) servers",
55
"type": "module",
66
"main": "./dist/index.js",

src/cli.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,22 @@
1111

1212
import { resolve } from "node:path";
1313
import { parseArgs } from "node:util";
14+
import open from "open";
1415
import {
1516
formatConfigWarning,
1617
getMcpServers,
1718
resolveConfigFiles,
1819
} from "./config.js";
20+
import type { McpClientConfig } from "./mcp-client.js";
1921
import { generateClient, writeGeneratedClient } from "./pipeline.js";
2022
import { runInteractiveSetup, showGenerationProgress } from "./prompts.js";
2123
import type { McpServerConfig } from "./types.js";
2224

25+
/** Default client config for CLI - enables browser-based OAuth */
26+
const CLI_CLIENT_CONFIG: McpClientConfig = {
27+
oauth: { launch: open },
28+
};
29+
2330
/**
2431
* CLI execution modes - explicitly modeled for clarity and extensibility.
2532
*
@@ -172,6 +179,7 @@ async function runGeneration(servers: McpServerConfig[], outputFile: string) {
172179

173180
const result = await showGenerationProgress(servers, () =>
174181
generateClient(servers, {
182+
clientConfig: CLI_CLIENT_CONFIG,
175183
treeShakable: true,
176184
outputPath: absoluteOutput,
177185
}),
@@ -213,7 +221,10 @@ async function main() {
213221
await runGeneration([server], mode.output);
214222
} else {
215223
// 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+
});
217228
process.stdout.write(result.code);
218229
}
219230
} catch (error) {

0 commit comments

Comments
 (0)