mcp-client-gen 0.0.7 → 0.0.9
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/cli.js +1072 -459
- package/dist/cli.js.map +18 -4
- package/package.json +10 -3
- package/src/cli.ts +12 -1
package/package.json
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-client-gen",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Generate type-safe TypeScript clients from MCP (Model Context Protocol) servers",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
6
7
|
"exports": {
|
|
7
|
-
".":
|
|
8
|
-
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./src/index.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./internal": {
|
|
13
|
+
"types": "./src/internal.ts",
|
|
14
|
+
"default": "./dist/internal.js"
|
|
15
|
+
}
|
|
9
16
|
},
|
|
10
17
|
"bin": {
|
|
11
18
|
"mcp-client-gen": "./dist/cli.js"
|
package/src/cli.ts
CHANGED
|
@@ -11,15 +11,22 @@
|
|
|
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], {
|
|
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) {
|