@mcp-use/cli 2.13.10-canary.1 → 2.13.10

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/index.cjs CHANGED
@@ -5845,5 +5845,54 @@ program.command("deploy").description("Deploy MCP server from GitHub to Manufact
5845
5845
  });
5846
5846
  program.addCommand(createClientCommand());
5847
5847
  program.addCommand(createDeploymentsCommand());
5848
+ program.command("generate-types").description(
5849
+ "Generate TypeScript type definitions for tools (writes .mcp-use/tool-registry.d.ts)"
5850
+ ).option("-p, --path <path>", "Path to project directory", process.cwd()).option("--server <file>", "Server entry file", "index.ts").action(async (options) => {
5851
+ const projectPath = import_node_path6.default.resolve(options.path);
5852
+ const serverFile = import_node_path6.default.join(projectPath, options.server);
5853
+ try {
5854
+ if (!await (0, import_promises5.access)(serverFile).then(() => true).catch(() => false)) {
5855
+ console.error(source_default.red(`Server file not found: ${serverFile}`));
5856
+ process.exit(1);
5857
+ }
5858
+ console.log(source_default.blue("Generating tool registry types..."));
5859
+ globalThis.__mcpUseHmrMode = true;
5860
+ const { tsImport } = await import("tsx/esm/api");
5861
+ await tsImport(serverFile, {
5862
+ parentURL: importMetaUrl,
5863
+ tsconfig: import_node_path6.default.join(projectPath, "tsconfig.json")
5864
+ });
5865
+ const server = globalThis.__mcpUseLastServer;
5866
+ if (!server) {
5867
+ console.error(
5868
+ source_default.red(
5869
+ "No MCPServer instance found. Make sure your server file creates an MCPServer instance."
5870
+ )
5871
+ );
5872
+ process.exit(1);
5873
+ }
5874
+ const mcpUsePath = import_node_path6.default.join(projectPath, "node_modules", "mcp-use");
5875
+ const { generateToolRegistryTypes } = await import(import_node_path6.default.join(mcpUsePath, "dist", "src", "server", "index.js")).then((mod) => mod);
5876
+ if (!generateToolRegistryTypes) {
5877
+ throw new Error(
5878
+ "generateToolRegistryTypes not found in mcp-use package"
5879
+ );
5880
+ }
5881
+ await generateToolRegistryTypes(server.registrations.tools, projectPath);
5882
+ console.log(source_default.green("\u2713 Tool registry types generated successfully"));
5883
+ process.exit(0);
5884
+ } catch (error) {
5885
+ console.error(
5886
+ source_default.red("Failed to generate types:"),
5887
+ error instanceof Error ? error.message : String(error)
5888
+ );
5889
+ if (error instanceof Error && error.stack) {
5890
+ console.error(source_default.gray(error.stack));
5891
+ }
5892
+ process.exit(1);
5893
+ } finally {
5894
+ globalThis.__mcpUseHmrMode = false;
5895
+ }
5896
+ });
5848
5897
  program.parse();
5849
5898
  //# sourceMappingURL=index.cjs.map