Skip to main content

run

Function run 

Source
pub async fn run(
    source: ServerSource,
    name: Option<String>,
    output_dir: Option<PathBuf>,
    dry_run: bool,
    output_format: OutputFormat,
) -> Result<ExitCode>
Expand description

Runs the generate command.

Generates progressive loading TypeScript files from an MCP server.

This command performs the following steps:

  1. Builds ServerConfig from CLI arguments or loads from ~/.claude/mcp.json
  2. Introspects the MCP server to discover tools
  3. Generates TypeScript files (one per tool) using progressive loading pattern
  4. Exports VFS to ~/.claude/servers/{server-id}/ directory

§Arguments

  • source - Resolved server-selection source: either a ~/.claude/mcp.json name or CLI transport flags with timeout overrides. Timeout overrides only exist on the Flags arm — a Config source always uses the mcp.json entry’s own connectTimeoutSecs/discoverTimeoutSecs, so there is no “ignored override” state to document.
  • name - Custom server name for directory (default: server_id)
  • output_dir - Custom output directory (default: ~/.claude/servers/)
  • dry_run - When true, preview files without writing to disk
  • output_format - Output format (json, text, pretty)

§Errors

Returns an error if:

  • Server configuration is invalid
  • Server not found in mcp.json (when using –from-config)
  • Server connection fails
  • Tool introspection fails
  • Code generation fails
  • File export fails (skipped in dry-run mode)