Skip to main content

run

Function run 

Source
pub async fn run(
    from_config: Option<String>,
    server: Option<String>,
    args: Vec<String>,
    env: Vec<String>,
    cwd: Option<String>,
    http: Option<String>,
    sse: Option<String>,
    headers: Vec<String>,
    name: Option<String>,
    output_dir: Option<PathBuf>,
    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

  • from_config - Load server config from ~/.claude/mcp.json by name
  • server - Server command (binary name or path), None for HTTP/SSE
  • args - Arguments to pass to the server command
  • env - Environment variables in KEY=VALUE format
  • cwd - Working directory for the server process
  • http - HTTP transport URL
  • sse - SSE transport URL
  • headers - HTTP headers in KEY=VALUE format
  • name - Custom server name for directory (default: server_id)
  • output_dir - Custom output directory (default: ~/.claude/servers/)
  • 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